Skip to content

This library packages the mymonero-core-cpp library for use on React Native.

Notifications You must be signed in to change notification settings

Beldex-Coin/react-native-beldex-core

 
 

Repository files navigation

react-native-beldex-core

This library packages Beldex C++ crypto methods for use on React Native.

It has a single default export that mostly matches the WABridge interface found in @bdxi/beldex-client. The big difference is that react-native-beldex-core only has async methods, whereas many of the upstream WABridge methods are synchronous.

Usage

First, add this library to your React Native app using NPM or Yarn, and run pod install as necessary to integrate it with your app's native code.

Here is a simple usage example. Note the await on the method call, but not on the require:

const bridge = require('react-native-beldex-core')

const addressInfo = await bridge.decodeAddress('...', 'MAINNET')

You can also use ES6 imports if you prefer:

import bridge from 'react-native-beldex-core'

We have types too, if you need those:

import type { CppBridge } from 'react-native-beldex-core'

The available methods are:

  • addressAndKeysFromSeed
  • compareMnemonics
  • createTransaction
  • decodeAddress
  • estimateTxFee
  • generateKeyImage
  • generatePaymentId
  • generateWallet
  • isIntegratedAddress
  • isSubaddress
  • isValidKeys
  • mnemonicFromSeed
  • newIntegratedAddress
  • seedAndKeysFromMnemonic

See the documentation at @bdxi/beldex-client for more information.

Developing

This library relies on a large amount of native C++ code from other repos. To integrate this code, you must run the following script before publishing this library to NPM:

npm run update-sources

This script does the following tasks:

  • Download third-party source code.
  • Set up the Android build system:
    • Determine which C++ headers are actually necessary.
    • Copy the necessary sources into android/src/main/cpp.
    • Assemble CMakeLists.txt.
  • Compile an iOS universal static library and put it into an XCFramework.
  • Generate Flow types from the TypeScript definitions.

The update-sources script is also the place to make edits when upgrading any of the third-party dependencies. The react-native-beldex-core repo doesn't include these third-party C++ sources, since they are enormous.

About

This library packages the mymonero-core-cpp library for use on React Native.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 36.4%
  • TypeScript 35.6%
  • C++ 14.8%
  • Java 5.2%
  • Objective-C++ 4.9%
  • Ruby 1.8%
  • Other 1.3%