Adding missing Block Tip Hash API

This commit is contained in:
softsimon
2022-06-22 13:15:44 +02:00
parent f75da3cc8f
commit e64bfc039a
5 changed files with 24 additions and 0 deletions

View File

@@ -64,6 +64,13 @@ class BitcoinApi implements AbstractBitcoinApi {
});
}
$getBlockHashTip(): Promise<string> {
return this.bitcoindClient.getChainTips()
.then((result: IBitcoinApi.ChainTips[]) => {
return result.find(tip => tip.status === 'active')!.hash;
});
}
$getTxIdsForBlock(hash: string): Promise<string[]> {
return this.bitcoindClient.getBlock(hash, 1)
.then((rpcBlock: IBitcoinApi.Block) => rpcBlock.tx);