1.0.8 • Published 4 years ago

react-native-elastos-unity-wallet v1.0.8

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
4 years ago

React Native Elastos Wallet Plugin

The React Native Elastos Unity Wallet repository provides all the necessary code to port the Elastos wallet functionnalities to React Native. Developers can use the Elastos Unity wallet module to implement the Elastos wallet functionalities into their existing app. Elastos Wallet is used to manage private and public keys and to make transactions on the Elastos network including DID sidechain.

Installation

You can install the react-native-unity-elastos-wallet package using npm or yarn:

## with npm
npm install react-native-elastos-unity-wallet --save
## with yarn
yarn add react-native-elastos-unity-wallet

Platform specific linking

Automatic linking

iOS

  • RN < 0.60
react-native link react-native-elastos-unity-wallet
  • RN > 0.60
cd ios
pod install

Android

The only step required for Android is to insert the following lines inside the android block in android/app/build.gradle:

packagingOptions {
	pickFirst '**/libc++_shared.so'
}

Manual linking

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-elastos-unity-wallet and add RNElastosMainchain.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNElastosMainchain.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import org.elastos.mainchain.reactnative.RNElastosMainchainPackage; to the imports at the top of the file
  • Add new RNElastosMainchainPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-elastos-wallet-core'
    project(':react-native-elastos-wallet-core').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-elastos-wallet-core/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    implementation project(':react-native-elastos-wallet-core')
  3. Insert the following lines inside the android block in android/app/build.gradle:
    packagingOptions {
        pickFirst '**/libc++_shared.so'
    }

Usage

import Wallet from 'react-native-elastos-unity-wallet';

// Generate a new mnemonic (defaults to English)
Wallet.generateMnemonic((err, mnemonic) => {
    console.log(mnemonic)
});

The complete documentation is available on: elastosunity.com/docs/wallet