Class: BitcoinBlock ​
Defined in: packages/bitcoin/src/client/rest/block.ts:9
Implements a strongly-typed BitcoinRest to connect to remote bitcoin node via REST API for block-related operations. BitcoinBlock
Constructors ​
Constructor ​
new BitcoinBlock(
api):BitcoinBlock
Defined in: packages/bitcoin/src/client/rest/block.ts:12
Parameters ​
api ​
(params) => Promise<any>
Returns ​
BitcoinBlock
Methods ​
count() ​
count():
Promise<number>
Defined in: packages/bitcoin/src/client/rest/block.ts:20
Returns the blockheight of the most-work fully-validated chain. The genesis block has height 0.
Returns ​
Promise<number>
The number of the blockheight with the most-work of the fully-validated chain.
get() ​
get(
params):Promise<BlockResponse|undefined>
Defined in: packages/bitcoin/src/client/rest/block.ts:32
Returns the block data associated with a blockhash of a valid block.
Parameters ​
params ​
See GetBlockParams for details.
Returns ​
Promise<BlockResponse | undefined>
A promise resolving to a BlockResponse formatted depending on verbosity level.
Throws ​
If neither blockhash nor height is provided.
getHash() ​
getHash(
height):Promise<string>
Defined in: packages/bitcoin/src/client/rest/block.ts:54
Get the block hash for a given block height. See Esplora GET /block-height/:height for details.
Parameters ​
height ​
number
The block height (required).
Returns ​
Promise<string>
The hash of the block currently at height..