Bitcoin wallet helpers for React Native
Prepare your React Native app following those steps
API documentation can be found here
Create a BitcoinWallet
instance
const Wallet = require("dex-btc")
const wallet = new Wallet("testnet")
//OPTIONAL: default blockcypher API
wallet.setProvider("blockcypher")
Get the balance
// Get balance of address
wallet.getBalance("2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF").then(console.log)
Unlock the privatekey
//set the privatekey for signing
wallet.privateKeyToAccount("<privateKey>")
//Now the default account has been set
console.log(wallet.defaultAccount)
Send a transaction to a
address
//Send the actual transaction to an address with the amount of satoshi comprhensive of actual value + fee
wallet.sendTransaction(addressTo, 20000).then(console.log).catch(console.log)
- Node/npm >= 8
Install Dependencies
npm install