0.1.1 • Published 5 years ago

react-native-samsung-bks v0.1.1

Weekly downloads
11
License
MIT
Repository
github
Last release
5 years ago

react-native-samsung-bks

npm_version license

React Native wrapper for the Samsung Blockchain Keystore SDK

Getting started

$ npm install react-native-samsung-bks --save

Automatic installatation (RN > 0.60)

Mostly automatic installation (RN < 0.59.x)

$ react-native link react-native-samsung-bks

Add the following into the root project build.gradle

allprojects {
    ...
    repositories {
        ...
        flatDir {
            dirs "$rootDir/aar"
        }
    }
}

Download the Samsung Blockchain Keystore SDK aar file and put it in android/aar.

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNSamsungBKS; to the imports at the top of the file
  • Add new RNSamsungBKS() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-samsung-bks'
    project(':react-native-samsung-bks').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-react-native-sbksdk/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      implementation project(':react-native-samsung-bks')
  3. Add the following into the root project build.gradle
allprojects {
    ...
    repositories {
        ...
        flatDir {
            dirs "$rootDir/aar"
        }
    }
}

Usage

import RNSamsungBKS from 'react-native-samsung-bks';

The following methods of the SDK are available:

RNSamsungBKS.isSupported()

RNSamsungBKS.getDeepLinks()

RNSamsungBKS.getSeedHash()

RNSamsungBKS.checkForMandatoryAppUpdate()

RNSamsungBKS.getAddressList(hdPath)

RNSamsungBKS.signEthTransaction(hdPath, nonce, gasPrice, gasLimit, to, value, data)

RNSamsungBKS.signEthPersonalMessage(hdPath, b64MessageToSign)