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
Added requestObjectBatch to client.js.
4 years ago
example Initial merge of node-electrum-client & rn-electrum-client. 4 years ago
helpers Added getAddressScriptHashBalances to helpers/index.js. 4 years ago
lib Added requestObjectBatch to client.js. 4 years ago
test Added pingTest, startRandomPeerTest, disconnectTest, startCustomPeerTest, getAddressScriptHashBalanceTest, getPeersTest, subscribeHeaderTest, subscribeAddressTest & getFeeEstimateTest tests to electrum-client-helpers-test.js. 4 years ago
.gitignore Initial merge of node-electrum-client & rn-electrum-client. 4 years ago
LICENSE Initial commit 4 years ago
README.md Created README.md and added an installation and usage/example section. 4 years ago
index.js Initial merge of node-electrum-client & rn-electrum-client. 4 years ago
package-lock.json Created README.md and added an installation and usage/example section. 4 years ago
package.json Initial merge of node-electrum-client & rn-electrum-client. 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);