You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Corey Phillips
36d7a389a6
|
4 years ago | |
---|---|---|
example | 4 years ago | |
helpers | 4 years ago | |
lib | 4 years ago | |
test | 4 years ago | |
.gitignore | 4 years ago | |
LICENSE | 4 years ago | |
README.md | 4 years ago | |
index.js | 4 years ago | |
package-lock.json | 4 years ago | |
package.json | 4 years ago |
README.md
Install
yarn add https://github.com/synonymdev/rn-electrum-client
Usage & Examples
import {
start,
getPeers,
getAddressScriptHashBalance,
subscribeHeader,
subscribeAddress
} from "rn-electrum-client/helpers";
//Connect To A Random Electrum Server
const startResponse = await start({ network: "bitcoinTestnet" });
console.log(startResponse);
if (startResponse.error) return;
//Get Server Peers
const getPeersResponse = await getPeers({ network: "bitcoinTestnet" });
console.log(getPeersResponse);
//Get Address Balance
const getAddressScriptHashBalanceResponse = await getAddressScriptHashBalance({
network: "bitcoinTestnet",
scriptHash: "77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd"
});
console.log(getAddressScriptHashBalanceResponse);
//Subscribe To Headers
const subscribeHeaderResponse = await subscribeHeader({
network: "bitcoinTestnet",
onReceive: (data) => { console.log("New block!", data); }
});
console.log(subscribeHeaderResponse);
//Subscribe To An Address
const subscribeAddressResponse = await subscribeAddress({
network: "bitcoinTestnet",
scriptHash: "77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd", //tb1qnv5luf8mav8263sxfa4fdr3m6kws74n0yfzzrx
onReceive: (data) => { console.log("Received some Testnet BTC!", data); }
});
console.log(subscribeAddressResponse);