@beincom/rn-wallet-sdk
v0.0.50
Published
<p align="center"> <br /> <a href="https://beincom.org/"> <img src="../../docs/assets/logo.webp" width="100" alt=""/></a> <br /> </p>
Downloads
14
Readme
Installation
Install the latest version of the SDK with npm
:
npm install @beincom/rn-wallet-sdk
or with yarn
:
yarn add @beincom/rn-wallet-sdk
dependencies:
{
"dependencies": {
"@ethersproject/shims": "^5.7.0",
"@react-native-community/netinfo": "^10.0.0",
"amazon-cognito-identity-js": "6.3.3",
"ethers": "^5",
"expo": "^49.0.3",
"node-libs-browser": "^2.2.1",
"react": "18.2.0",
"react-native": "0.72.6",
"react-native-aes-gcm-crypto": "^0.2.2",
"react-native-crypto": "^2.2.0",
"react-native-get-random-values": "^1.9.0",
"react-native-quick-base64": "^2.0.7",
"react-native-quick-crypto": "^0.6.1",
"react-native-randombytes": "^3.6.1"
}
}
Config
1. Create shims.js and import it to root (react-native-compact)
// shims.js
import "react-native-get-random-values";
import "@ethersproject/shims";
if (typeof BigInt === "undefined") {
global.BigInt = require("big-integer");
}
if (typeof Buffer === "undefined") {
global.Buffer = require("buffer").Buffer;
}
// @ts-ignore: Unreachable code error
global.process.version = "v0.9";
if (typeof process === "undefined") {
global.process = require("process");
}
global.btoa = global.btoa || require("base-64").encode;
global.atob = global.atob || require("base-64").decode;
// index.js
import "./shims";
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
2. add config to metro.config.js
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const extraNodeModules = require('node-libs-browser');
const config = {
resolver: {
extraNodeModules,
},
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
Quick start
1. Create wallet instance.
import axios from "axios";
import { BICWallet, ThirdwebProvider, WalletAPI, ArbitrumSepolia } from "@beincom/wallet-sdk";
// create wallet backend api client.
const api = new WalletAPI({
endpoint: "",// endpoint wallet backend
httpClient: axios //axios instance
});
// create wallet provider client.
const provider = new ThirdwebProvider(
"", // provider key
ArbitrumSepolia // network
);
// create BIC wallet instance.
const bicWallet = new BICWallet({
api: api,
provider: provider
})
Documentation
Visit docs to view the full documentation.