@cybavo/react-native-wallet-service
React version of CYBAVO WALLET SDK
Last updated a day ago by cybavo-dev .
UNLICENSED · Original npm · Tarball · package.json
$ cnpm install @cybavo/react-native-wallet-service 
SYNC missed versions from official npm registry.

@cybavo/react-native-wallet-service

React-native version of CYBAVO Wallet SDK. Learn more on our website: https://www.cybavo.com/wallet-app-sdk/

Institutional-grade security for your customers

Protect your customers’ wallets with the same robust technology we use to protect the most important cryptocurrency exchanges. CYBAVO Wallet App SDK allows you to develop your own cryptocurrency wallet, backed by CYBAVO private key protection technology.

Mobile SDK

Use CYBAVO Wallet App SDK to easily develop secure wallets for your users without having to code any cryptography on your side. Our SDK allows you to perform the most common operations, such as creating a wallet, querying balances and executing cryptocurrency payments.

Secure key management system

Key management is the most critical part of cryptocurrency storage. CYBAVO Wallet App SDK makes our robust private key storage system available to all of your users. Our unique encryption scheme and a shared responsibility model offers top notch protection for your customer’s keys.

CYBAVO Security Cloud

Cryptocurrency transactions performed by wallets developed with CYBAVO Wallet App SDK will be shielded by our Security Cloud, ensuring their integrity.

Complete solution for cryptocurrency wallets

Cost saving

Leverage your in-house developing team and develop mobile cryptocurrency apps without compromising on security.

Fast development

Quickly and easily develop cryptocurrency applications using mobile native languages, without having to worry about cryptographic code.

Full Node maintenance

Leverage CYBAVO Wallet App SDK infrastructure and avoid maintaining a full node for your application.

Feel free to contact us for product inquiries or mail us: info@cybavo.com

CYBAVO

A group of cybersecurity experts making crypto-currency wallet secure and usable for your daily business operation.

We provide VAULT, wallet, ledger service for cryptocurrency. Trusted by many exchanges and stable-coin ico teams, please feel free to contact us when your company or business need any help in cryptocurrency operation.

Getting started

$ npm install @cybavo/react-native-wallet-service --save

  1. Polyfill NodeJS modules for React-Native
    $ yarn add rn-nodeify
    $ rn-nodeify --install --hack
    
  2. unmark require('crypto') in shim.js

Mostly automatic installation

$ react-native link @cybavo/react-native-wallet-service

Manual installation

iOS

  1. Append this line in Podfile:
    pod 'CybavoWalletService', :path => "../node_modules/@cybavo/react-native-wallet-service/ios/CybavoWalletService.podspec"
    
  2. Go to ./ios, run pod install to install all dependencies.
  3. Open ./ios/{{your project}}.xcworkspace in XCode
  4. In XCode, run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.cybavo.reactnative.wallet.service.CybavoWalletServicePackage; to the imports at the top of the file
  • Add new CybavoWalletServicePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':@cybavo/react-native-wallet-service'
    project(':@cybavo/react-native-wallet-service').projectDir = new File(rootProject.projectDir, 	'../node_modules/@cybavo/react-native-wallet-service/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':@cybavo/react-native-wallet-service')
    

Usage

import { WalletSdk, Auth, Wallets } from "@cybavo/react-native-wallet-service";

WalletConnect

CYBAVO Wallet App SDK has integrated WalletConnect to support wallet apps connecting with Dapps (Web3 Apps).

  1. Following code snippet is the simple usage of how to new a session, approve session request and approve call request

    For further technical specification, please refer to WalletConnect's official document

    import { WalletConnectSdk } from "@cybavo/react-native-wallet-service";
    const { WalletConnectManager, WalletConnectHelper } = WalletConnectSdk;
    // Establish session, then the callback will receive session request 
    let connectorWrapper = WalletConnectManager.newSession(
            walletConnectUri,
            walletAddress,
            walletId,
            walletClientMeta,
            (error, payload) => {
                sessionRequestCallback(connectorWrapper.getConnector().peerId, error, payload);
            }
          );
    
    let sessionRequestCallback = (peerId, error, payload) => {
        //approve session, then pass the listeners to receive call request and disconnect event
        WalletConnectManager.approveSession(
              peerId,
              {
                accounts: [walletAddress],
                chainId: 1, //main net
              },
              (error: any, payload: any) => {
                    callRequestListener(peerId, error, payload);
              },
              disconnectListener
        )
    }
    let callRequestListener = (peerId, error: any, payload: any) => {
        WalletConnectManager.approveRequest(peerId, response).then(() => {})
    }
    let disconnectListener = (error: any, payload: any) => {}
    
  2. API to support handling call request

    Here defined methods that wallet app should implement. We also provided API to handle corresponding methods:

    • personal_sign, eth_sign
    let message = payload.params[0];
    let result = await Wallets.walletConnectSignMessage(
           walletId,
           convertHexToUtf8(message),
           pinSecret
         );
    
    • eth_sendTransaction
    let tx = payload.params[0];
    // 1. sign transaction
    let result = await Wallets.walletConnectSignTransaction(
           walletId,
           tx,
           transactionFee,
           pinSecret
         );
    // 2. send signed transaction
    let sendResult = await Wallets.walletConnectSendSignedTransaction(
                walletId,
                result.signedTx
              );
    // return TXID as approve response to the Dapp
    let response = { result: sendResult.txid, id: payload.id };
    await WalletConnectManager.approveRequest(peerId, response);
    
    
    • eth_signTypedData
    let message = payload.params[1];
         let result = await Wallets.walletConnectSignTypedData(
           walletId,
           message,
           pinSecret
         );
    let response = { result: '0x' + result.signedTx, id: payload.id };
    await WalletConnectManager.approveRequest(peerId, response);
    
    • eth_sendRawTransaction
    let signedTx = params[0];
    let sendResult = await Wallets.walletConnectSendSignedTransaction(
                walletId,
                signedTx
              );
    // return TXID as approve response to the Dapp
    let response = { result: sendResult.txid, id: payload.id };
    await WalletConnectManager.approveRequest(peerId, response);
    
    • eth_signTransaction
    let tx = payload.params[0];
    let result = await Wallets.walletConnectSignTransaction(
           walletId,
           tx,
           transactionFee,
           pinSecret
         );
     let response = { result: result.signedTx, id: payload.id };
     await WalletConnectManager.approveRequest(peerId, response);
    
  3. Other supportive API

    • Wallets.walletConnectSync

      Check if there're any changes after transactions committed through Wallets.walletConnectSendSignedTransaction or Wallets.sendSignedTx and perform the updates.

    • Wallets.getWalletConnectApiHistory

      All walletconnect related API will be logged as ApiHistoryItem with vary API Names. Use Wallets.getWalletConnectApiHistory to fetch API histories.

    • Wallets.cancelWalletConnectTransaction

      Use Wallets.cancelWalletConnectTransaction to cancel a pending transaction which sent through Wallets.walletConnectSendSignedTransaction.

      It's required a higher transaction fee (1.1 times) to replace the original transaction with 0 amount.

Check our sample app on GitHub: https://github.com/CYBAVO/react-native_wallet_sdk_sample

Refer to documents for details of extra parameters.

Current Tags

  • 1.2.142                                ...           latest (a day ago)

81 Versions

  • 1.2.142                                ...           a day ago
  • 1.2.140                                ...           2 days ago
  • 1.2.138                                ...           2 days ago
  • 1.2.125                                ...           2 months ago
  • 1.2.124                                ...           2 months ago
  • 1.2.122                                ...           3 months ago
  • 1.2.120                                ...           3 months ago
  • 1.2.117                                ...           3 months ago
  • 1.2.94                                ...           4 months ago
  • 1.2.92                                ...           6 months ago
  • 1.2.90                                ...           6 months ago
  • 1.2.89                                ...           6 months ago
  • 1.2.87                                ...           6 months ago
  • 1.2.79                                ...           7 months ago
  • 1.2.73                                ...           7 months ago
  • 1.2.69                                ...           7 months ago
  • 1.2.68                                ...           7 months ago
  • 1.2.65                                ...           7 months ago
  • 1.2.62                                ...           8 months ago
  • 1.2.59                                ...           8 months ago
  • 1.2.52                                ...           9 months ago
  • 1.2.50                                ...           10 months ago
  • 1.2.49                                ...           10 months ago
  • 1.2.46                                ...           10 months ago
  • 1.2.45                                ...           10 months ago
  • 1.2.43                                ...           a year ago
  • 1.2.42                                ...           a year ago
  • 1.2.39                                ...           a year ago
  • 1.2.38                                ...           a year ago
  • 1.2.37                                ...           a year ago
  • 1.2.35                                ...           a year ago
  • 1.2.30                                ...           a year ago
  • 1.2.29                                ...           a year ago
  • 1.2.27                                ...           a year ago
  • 1.2.24                                ...           a year ago
  • 1.2.22                                ...           a year ago
  • 1.2.21                                ...           a year ago
  • 1.2.20                                ...           a year ago
  • 1.2.19                                ...           a year ago
  • 1.2.18                                ...           a year ago
  • 1.2.17                                ...           a year ago
  • 1.2.16                                ...           a year ago
  • 1.2.15                                ...           a year ago
  • 1.2.14                                ...           a year ago
  • 1.2.13                                ...           a year ago
  • 1.2.12                                ...           a year ago
  • 1.2.11                                ...           a year ago
  • 1.2.10                                ...           a year ago
  • 1.2.9                                ...           a year ago
  • 1.2.8                                ...           a year ago
  • 1.2.6                                ...           a year ago
  • 1.2.5                                ...           a year ago
  • 1.2.4                                ...           a year ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.1.42                                ...           2 years ago
  • 1.1.41                                ...           2 years ago
  • 1.1.40                                ...           2 years ago
  • 1.1.39                                ...           2 years ago
  • 1.1.38                                ...           2 years ago
  • 1.1.37                                ...           2 years ago
  • 1.1.36                                ...           2 years ago
  • 1.1.35                                ...           2 years ago
  • 1.1.34                                ...           2 years ago
  • 1.1.33                                ...           2 years ago
  • 1.1.32                                ...           2 years ago
  • 1.1.31                                ...           2 years ago
  • 1.1.30                                ...           2 years ago
  • 1.1.29                                ...           2 years ago
  • 1.1.28                                ...           2 years ago
  • 1.1.27                                ...           2 years ago
  • 1.1.26                                ...           2 years ago
  • 1.1.25                                ...           2 years ago
  • 1.1.24                                ...           2 years ago
  • 1.1.23                                ...           2 years ago
  • 1.1.22                                ...           2 years ago
  • 1.1.21                                ...           2 years ago
  • 1.1.20                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 29
This Month 107
Last Day 5
Last Week 78
Last Month 78
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |