grpc-bchrpc-browser

A bchd rpc client for browsers using grpc/grpc-web

View the Project on GitHub 2qx/grpc-bchrpc-browser

grpc-bchrpc-browserGlobalsgrpc-bchrpc-browserGrpcClient

Class: GrpcClient

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new GrpcClient(__namedParameters: object): GrpcClient

Defined in client.ts:8

Create a client.

Parameters:

__namedParameters: object

Name Type Default Description
options null | object - grpc client options.
testnet boolean false Whether testnet is being used, default:false.
url undefined | string - The bchd server expressed as host:port.

Returns: GrpcClient

Properties

client

client: bchrpcClient

Defined in client.ts:8

Methods

getAddressTransactions

getAddressTransactions(__namedParameters: object): Promise‹GetAddressTransactionsResponse›

Defined in client.ts:158

Get transactions related to a particular address

Parameters:

__namedParameters: object

Name Type Description
address string Bitcoin cash address in casharr format.
hashHex undefined | string the hash as a big-endian hexadecimal encoded string, will be overridden by hash, if provided.
height undefined | number Filter to only return transactions after this block number.
nbFetch undefined | number Number of transactions return.
nbSkip undefined | number Number of transactions to skip, in chronological order.

Returns: Promise‹GetAddressTransactionsResponse›


getAddressUtxos

getAddressUtxos(__namedParameters: object): Promise‹GetAddressUnspentOutputsResponse›

Defined in client.ts:236

Parameters:

__namedParameters: object

Name Type
address string
includeMempool boolean

Returns: Promise‹GetAddressUnspentOutputsResponse›


getBlock

getBlock(__namedParameters: object): Promise‹GetBlockResponse›

Defined in client.ts:284

Retrieve block info given a block number or hash

Parameters:

__namedParameters: object

Name Type Description
fullTransactions undefined | false | true a flag to return full transaction data, by defult false only transaction hashes are returned.
hash undefined | string | Uint8Array‹› the hash, in either a ‘base64’ encoded string or byte array, little-endian.
hashHex undefined | string the hash as a big-endian ‘hex’ encoded string, will be overridden by hash if also provided.
index undefined | number the block number to be retrieved.

Returns: Promise‹GetBlockResponse›


getBlockFilter

getBlockFilter(__namedParameters: object): Promise‹GetBlockFilterResponse›

Defined in client.ts:315

Retrieve block filter given a block number or hash

Parameters:

__namedParameters: object

Name Type Description
hash undefined | string | Uint8Array‹› the hash, expressed in little-endian in either a base64 encoded string or byte array.
hashHex undefined | string the hash as a big-endian ‘hex’ encoded string, will be overridden a hash if provided.
height undefined | number the block number index to be retrieved.

Returns: Promise‹GetBlockFilterResponse›


getBlockInfo

getBlockInfo(__namedParameters: object): Promise‹GetBlockInfoResponse›

Defined in client.ts:338

Retrieve block info given a block number or hash

Parameters:

__namedParameters: object

Name Type Description
hash undefined | string | Uint8Array‹› the hash, expressed in little-endian in either a base64 encoded string or byte array.
hashHex undefined | string the hash as a big-endian ‘hex’ encoded string, will be overridden a hash if provided.
height undefined | number the block number index to be retrieved.

Returns: Promise‹GetBlockInfoResponse›


getBlockchainInfo

getBlockchainInfo(): Promise‹GetBlockchainInfoResponse›

Defined in client.ts:358

Retrieve block info for the network, network state and host node.

Returns: Promise‹GetBlockchainInfoResponse›


getHeaders

getHeaders(__namedParameters: object): Promise‹GetHeadersResponse›

Defined in client.ts:129

Get block header information

Parameters:

__namedParameters: object

Name Type Description
blockLocatorHashes undefined | string | Uint8Array‹›[] Sparse list of hashes known to the client.
stopHash undefined | string -Last block hash to return.

Returns: Promise‹GetHeadersResponse›


getMempool

getMempool(__namedParameters: object): Promise‹GetMempoolResponse›

Defined in client.ts:56

Get transactions from mempool

Parameters:

__namedParameters: object

Name Type Description
fullTransactions undefined | false | true A flag to return full transaction data. Default is false, only transaction hashes are returned.

Returns: Promise‹GetMempoolResponse›


getMempoolInfo

getMempoolInfo(): Promise‹GetMempoolInfoResponse›

Defined in client.ts:38

Get information about transactions in mempool

Returns: Promise‹GetMempoolInfoResponse›


getMerkleProof

getMerkleProof(__namedParameters: object): Promise‹GetMerkleProofResponse›

Defined in client.ts:217

Retrieve merkle (SPV) proof that the given transaction is in the provided block.

Parameters:

__namedParameters: object

Name Type Description
hash undefined | string | Uint8Array‹› the tx hash, in either a ‘base64’ encoded string or byte array, little-endian.
hashHex undefined | string the tx hash as a big-endian ‘hex’ encoded string, will be overridden by hash if also provided.

Returns: Promise‹GetMerkleProofResponse›


getRawBlock

getRawBlock(__namedParameters: object): Promise‹GetRawBlockResponse›

Defined in client.ts:257

Retrieve raw block from a hash

Parameters:

__namedParameters: object

Name Type Description
hash undefined | string | Uint8Array‹› the hash, in either a ‘base64’ encoded string or byte array, little-endian.
hashHex undefined | string the hash as a big-endian ‘hex’ encoded string, will be overridden by hash if also provided.

Returns: Promise‹GetRawBlockResponse›


getRawTransaction

getRawTransaction(__namedParameters: object): Promise‹GetRawTransactionResponse›

Defined in client.ts:79

Get a raw transaction

Parameters:

__namedParameters: object

Name Type Description
hash undefined | string | Uint8Array‹› the hash, in either a base64 encoded string or byte array, little-endian.
hashHex undefined | string the hash as a big-endian hexadecimal encoded string, sill be overridden by hash if provided.

Returns: Promise‹GetRawTransactionResponse›


getTransaction

getTransaction(__namedParameters: object): Promise‹GetTransactionResponse›

Defined in client.ts:104

Get a transaction

Parameters:

__namedParameters: object

Name Type Description
hash undefined | string | Uint8Array‹› the hash, expressed in little-endian in either a base64 encoded string or byte array.
hashHex undefined | string the hash as a big-endian hexadecimal encoded string, will be overridden by hash, if provided.

Returns: Promise‹GetTransactionResponse›


getUnspentOutput

getUnspentOutput(__namedParameters: object): Promise‹GetUnspentOutputResponse›

Defined in client.ts:188

Parameters:

__namedParameters: object

Name Type
hash undefined | string | Uint8Array‹›
hashHex undefined | string
includeMempool undefined | false | true
vout number

Returns: Promise‹GetUnspentOutputResponse›


submitTransaction

submitTransaction(__namedParameters: object): Promise‹SubmitTransactionResponse›

Defined in client.ts:431

Parameters:

__namedParameters: object

Name Type
txn undefined | Uint8Array‹›
txnHex undefined | string

Returns: Promise‹SubmitTransactionResponse›


subscribeBlocks

subscribeBlocks(__namedParameters: object): Promise‹ClientReadableStream‹BlockNotification››

Defined in client.ts:415

Parameters:

__namedParameters: object

Name Type
includeSerializedBlock undefined | false | true
includeTxnData undefined | false | true
includeTxnHashes undefined | false | true

Returns: Promise‹ClientReadableStream‹BlockNotification››


subscribeTransactions

subscribeTransactions(__namedParameters: object): Promise‹ClientReadableStream‹TransactionNotification››

Defined in client.ts:378

Parameters:

__namedParameters: object

Name Type Description
includeBlockAcceptance undefined | false | true If true, transactions are included when they are confirmed. This notification is sent in addition to any requested mempool notifications.
includeMempoolAcceptance undefined | false | true If true, new unconfirmed transactions from mempool are included apart from the ones confirmed in a block.
includeSerializedTxn undefined | false | true If true, transactions are serialized using bitcoin protocol encoding. Default is false, transaction will be Marshaled.
transactionFilter undefined | TransactionFilter‹› -
unsubscribe undefined | false | true NOT IMPLEMENTED, see ClientReadableStream.cancel()

Returns: Promise‹ClientReadableStream‹TransactionNotification››