11// SPDX-License-Identifier: CC0-1.0
22
3- //! Async JSON-RPC client with the RPC set used by BDK for Core versions 25 to 30.
3+ //! RPC set used by BDK.
4+ //! All functions return the version nonspecific, strongly typed types.
45
56use bitcoin:: { block, Block , BlockHash , Transaction , Txid } ;
67
7- use crate :: client_async :: { into_json, Client , Result } ;
8+ use crate :: bdk_client :: { into_json, Client , Result } ;
89use crate :: types:: model:: { GetBlockFilter , GetBlockHeaderVerbose , GetBlockVerboseOne } ;
910
1011impl Client {
@@ -15,13 +16,13 @@ impl Client {
1516 Ok ( json. into_model ( ) ?. 0 )
1617 }
1718
18- /// Gets block count.
19+ /// Gets the block count.
1920 pub async fn get_block_count ( & self ) -> Result < u64 > {
2021 let json: crate :: types:: v25:: GetBlockCount = self . call ( "getblockcount" , & [ ] ) . await ?;
2122 Ok ( json. into_model ( ) . 0 )
2223 }
2324
24- /// Gets block hash for a height.
25+ /// Gets the block hash for a height.
2526 pub async fn get_block_hash ( & self , height : u32 ) -> Result < BlockHash > {
2627 let json: crate :: types:: v25:: GetBlockHash =
2728 self . call ( "getblockhash" , & [ into_json ( height) ?] ) . await ?;
@@ -34,14 +35,14 @@ impl Client {
3435 Ok ( json. into_model ( ) ?. 0 )
3536 }
3637
37- /// Gets block header by blockhash.
38+ /// Gets the block header by blockhash.
3839 pub async fn get_block_header ( & self , hash : & BlockHash ) -> Result < block:: Header > {
3940 let json: crate :: types:: v25:: GetBlockHeader =
4041 self . call ( "getblockheader" , & [ into_json ( hash) ?, into_json ( false ) ?] ) . await ?;
4142 Ok ( json. into_model ( ) ?. 0 )
4243 }
4344
44- /// Gets block header with verbose output.
45+ /// Gets the block header with verbose output.
4546 pub async fn get_block_header_verbose (
4647 & self ,
4748 hash : & BlockHash ,
@@ -74,20 +75,20 @@ impl Client {
7475 }
7576 }
7677
77- /// Gets block filter for a blockhash.
78+ /// Gets the block filter for a blockhash.
7879 pub async fn get_block_filter ( & self , hash : & BlockHash ) -> Result < GetBlockFilter > {
7980 let json: crate :: types:: v25:: GetBlockFilter =
8081 self . call ( "getblockfilter" , & [ into_json ( hash) ?] ) . await ?;
8182 Ok ( json. into_model ( ) ?)
8283 }
8384
84- /// Gets transaction IDs currently in the mempool.
85+ /// Gets the transaction IDs currently in the mempool.
8586 pub async fn get_raw_mempool ( & self ) -> Result < Vec < Txid > > {
8687 let json: crate :: types:: v25:: GetRawMempool = self . call ( "getrawmempool" , & [ ] ) . await ?;
8788 Ok ( json. into_model ( ) ?. 0 )
8889 }
8990
90- /// Gets raw transaction by txid.
91+ /// Gets the raw transaction by txid.
9192 pub async fn get_raw_transaction ( & self , txid : & Txid ) -> Result < Transaction > {
9293 let json: crate :: types:: v25:: GetRawTransaction =
9394 self . call ( "getrawtransaction" , & [ into_json ( txid) ?] ) . await ?;
0 commit comments