react-native-elastos-unity-wallet
v1.0.8
Published
## Getting started
Downloads
15
Maintainers
Readme
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
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-elastos-unity-wallet
and addRNElastosMainchain.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNElastosMainchain.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)
Android
- 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 thegetPackages()
method
- 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')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-elastos-wallet-core')
- 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