Browse Source

Created README.md and added an installation and usage/example section.

get-transaction-merkle
Corey Phillips 4 years ago
parent
commit
1301007a37
No known key found for this signature in database GPG Key ID: 80C0975F55D3A07B
  1. 44
      README.md
  2. 2
      package-lock.json

44
README.md

@ -0,0 +1,44 @@
## 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);
```

2
package-lock.json

@ -1,6 +1,6 @@
{
"name": "rn-electrum-client",
"version": "0.0.6",
"version": "0.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

Loading…
Cancel
Save