Class: NodeClient

client.NodeClient(optionsnullable)

Node Client

Constructor

new NodeClient(optionsnullable)

Creat a node client.

Extends:
  • bcurl.Client
Parameters:
Name Type Attributes Description
options Object <nullable>
Source:

Extends

  • bcurl.Client

Methods

addFilter(data) → {Promise}

Add data to filter.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Promise

(async) auth() → {Promise}

Auth with server.

Source:
Returns:
Type
Promise

broadcast(tx) → {Promise}

Add a transaction to the mempool and broadcast it.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise

broadcastClaim(claim) → {Promise}

Add a claim to the mempool and broadcast it.

Parameters:
Name Type Description
claim Claim
Source:
Returns:
Type
Promise

estimateFee(blocksnullable) → {Promise}

Esimate smart fee.

Parameters:
Name Type Attributes Description
blocks Number <nullable>
Source:
Returns:
Type
Promise

execute() → {Promise}

Make an RPC call.

Source:
Returns:
Type
Promise

getBlock(block) → {Promise}

Retrieve a block from the chain database.

Parameters:
Name Type Description
block Hash | Number
Source:
Returns:
Type
Promise

getBlockHeader(block) → {Promise}

Retrieve a block header.

Parameters:
Name Type Description
block Hash | Number
Source:
Returns:
Type
Promise

getCoin(hash, index) → {Promise}

Retrieve a coin from the mempool or chain database. Takes into account spent coins in the mempool.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Promise

getCoinsByAddress(address) → {Promise}

Get coins that pertain to an address from the mempool or chain database. Takes into account spent coins in the mempool.

Parameters:
Name Type Description
address String
Source:
Returns:
Type
Promise

getCoinsByAddresses(addresses) → {Promise}

Get coins that pertain to addresses from the mempool or chain database. Takes into account spent coins in the mempool.

Parameters:
Name Type Description
addresses Array.<String>
Source:
Returns:
Type
Promise

getEntry(hash) → {Promise}

Get chain entry.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
Type
Promise

getHashes(startopt, endopt) → {Promise}

Get hashes.

Parameters:
Name Type Attributes Default Description
start Number <optional>
-1
end Number <optional>
-1
Source:
Returns:
Type
Promise

getInfo() → {Promise}

Get some info about the server (network and version).

Source:
Returns:
Type
Promise

getMempool() → {Promise}

Get a mempool snapshot.

Source:
Returns:
Type
Promise

getNameStatus(nameHash) → {Promise}

Get name state.

Parameters:
Name Type Description
nameHash Buffer
Source:
Returns:
Type
Promise

getTip() → {Promise}

Get chain tip.

Source:
Returns:
Type
Promise

getTX(hash) → {Promise}

Retrieve a transaction from the mempool or chain database.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
Type
Promise

getTXByAddress(address) → {Promise}

Retrieve transactions pertaining to an address from the mempool or chain database.

Parameters:
Name Type Description
address String
Source:
Returns:
Type
Promise

getTXByAddresses(addresses) → {Promise}

Retrieve transactions pertaining to addresses from the mempool or chain database.

Parameters:
Name Type Description
addresses Array.<String>
Source:
Returns:
Type
Promise

rescan(start) → {Promise}

Rescan for any missed transactions.

Parameters:
Name Type Description
start Number | Hash

Start block.

Source:
Returns:
Type
Promise

reset(height) → {Promise}

Reset the chain.

Parameters:
Name Type Description
height Number
Source:
Returns:
Type
Promise

resetFilter() → {Promise}

Reset filter.

Source:
Returns:
Type
Promise

send(tx) → {Promise}

Send a transaction. Do not wait for promise.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise

sendClaim(claim) → {Promise}

Send a claim. Do not wait for promise.

Parameters:
Name Type Description
claim Claim
Source:
Returns:
Type
Promise

setFilter(filter) → {Promise}

Set bloom filter.

Parameters:
Name Type Description
filter Bloom
Source:
Returns:
Type
Promise

(private) watchChain() → {Promise}

Watch the blockchain.

Source:
Returns:
Type
Promise

(private) watchMempool() → {Promise}

Watch the blockchain.

Source:
Returns:
Type
Promise