npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ramper/react-native-evm

v1.0.4

Published

Ramper's EVM React Native SDK works with Ramper's Core React Native SDK to help developer easily onboard new users onto their Ethereum DApp through account management, wallet creation, and wallet interactions.

Downloads

44

Readme

Ramper EVM SDK for React Native

npm

$ npm install @ramper/react-native-evm react-native-get-random-values

yarn

$ yarn add @ramper/react-native-evm react-native-get-random-values

Step 1

$ cd ios && pod install

Step 2

You will need to register react-native-get-random-values and @ethersproject/shims in the entry file of your application, such as index.js:

// Import the crypto getRandomValues shim (**BEFORE** the shims)
import 'react-native-get-random-values';

// Import the the ethers shims (**BEFORE** ethers)
import '@ethersproject/shims';

Usage

import { ethers } from 'ethers';
import { EtherTx, SUPPORTED_ETHEREUM_NETWORKS } from '@ramper/react-native-evm';

Transactions

import { Transactions } from '@ramper/react-native-core';

Note: before doing a transaction you need to create a provider

const provider = ethers.getDefaultProvider(
  `https://polygon-mumbai.g.alchemy.com/v2/${yourApiKey}`
);

Sign Transactions

const value = ethers.utils.parseEther('0.0000001');
try {
  const transaction = await Transactions.signTransaction({
    serializedTx: await EtherTx.serializeTransactionRequest(
      {
        from: 'fromAddress',
        to: 'toAddress',
        value,
      },
      provider
    ),
    network: SUPPORTED_ETHEREUM_NETWORKS.MATICMUM,
    theme: 'light',
  });
  const deserializedTransaction = EtherTx.deserializeTransaction(transaction);

  // broadcast the Signed Transaction to the network:
  const transaction = await provider.sendTransaction(
    deserializedTransaction.transaction
  );

} catch (error) {
  // handle error
}

Sign Typed Data

try {
  const signTypedDataResponse = await Transactions.signTypedData({
    serializedTx: await EtherTx.serializeSignTypedDataRequest(
      {
        name: 'Ether Mail',
        version: '1',
        chainId: 1,
        verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
      },
      {
        Person: [
          { name: 'name', type: 'string' },
          { name: 'wallet', type: 'address' },
        ],
        Mail: [
          { name: 'from', type: 'Person' },
          { name: 'to', type: 'Person' },
          { name: 'contents', type: 'string' },
        ],
      },
      {
        from: {
          name: 'Cow',
          wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
        },
        to: {
          name: 'Bob',
          wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
        },
        contents: 'Hello, Bob!',
      }
    ),
    network: SUPPORTED_ETHEREUM_NETWORKS.MATICMUM,
  });
  const deserializedTypedData = EtherTx.deserializeTransaction(signResponse);
  // handle response
} catch (error) {
  // handle error
}

Sign Message

try {
  const signMessageResponse = await Transactions.signMessage({
    serializedTx: EtherTx.serializeMessage({
      message: 'Hello World',
      method: 'eth_sign',
    }),
    network: SUPPORTED_ETHEREUM_NETWORKS.MATICMUM,
    theme: 'light',
  });
  const deserializedRespone =
    EtherTx.deserializeTransaction(signMessageResponse);
  // handle response
} catch (error) {
  // handle error
}

Personal Sign

try {
  const signPersonalMessageResponse = await Transactions.signMessage({
    serializedTx: EtherTx.serializeMessage({
      message: 'My email is [email protected] - Thu, 22 Sep 2022 22:45:02 GMT',
      method: 'personal_sign',
    }),
    network: SUPPORTED_ETHEREUM_NETWORKS.MATICMUM,
    theme: 'light',
  });
  const deserializedRespone = EtherTx.deserializeTransaction(
    signPersonalMessageResponse
  );
  // handle response
} catch (error) {
  // handle error
}

Deserialize Transaction

const deserializedTx = EtherTx.deserializeTransaction(serializedTx);

Method Signature:

type DeserializedTx = {
   transaction: string // Signed Transaction
   msgs: any[]
}