pub trait RestApi {
Show 17 methods
// Required methods
fn get_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>
where T: 'async_trait + for<'a> Deserialize<'a>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_bin<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_block_headers<'life0, 'async_trait>(
&'life0 self,
start_hash: BlockHash,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_block_at_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_block_hash<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockHash, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_block<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_transaction<'life0, 'async_trait>(
&'life0 self,
txid: Txid,
) -> Pin<Box<dyn Future<Output = Result<Transaction, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_block_filter_headers<'life0, 'async_trait>(
&'life0 self,
start_hash: BlockHash,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<FilterHeader>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_block_filter<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<BlockFilter, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_chain_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetBlockchainInfoResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_utxos<'life0, 'life1, 'async_trait>(
&'life0 self,
outpoints: &'life1 [OutPoint],
check_mempool: bool,
) -> Pin<Box<dyn Future<Output = Result<GetUtxosResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_mempool_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetMempoolInfoResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_mempool<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Txid, GetMempoolEntryResult>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_mempool_txids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Txid>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_mempool_txids_and_sequence<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetMempoolTxidsAndSequenceResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn get_deployment_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetDeploymentInfoResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
unsafe fn get_deployment_info_at_block<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<GetDeploymentInfoResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Implements all the REST API calls for Bitcoin Core, except
get_json
and get_bin
.
These are implemented using reqwest
in
RestClient
, but this dependency can be removed by using
default-features = false
in Cargo.toml
and implementing RestApi
yourself.
Required Methods§
Sourcefn get_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
T: 'async_trait + for<'a> Deserialize<'a>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>where
T: 'async_trait + for<'a> Deserialize<'a>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a response from a json
endpoint
Provided Methods§
Sourcefn get_block_headers<'life0, 'async_trait>(
&'life0 self,
start_hash: BlockHash,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_block_headers<'life0, 'async_trait>(
&'life0 self,
start_hash: BlockHash,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Header>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get a series of block headers beginning from a block hash
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockheaders
Sourcefn get_block_at_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_block_at_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Convenience function to get a block at a specific height
Sourcefn get_block_hash<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockHash, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_block_hash<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockHash, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get a block hash at a specific height
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockhash-by-height
Sourcefn get_block<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_block<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get a block by its hash
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blocks
Sourcefn get_transaction<'life0, 'async_trait>(
&'life0 self,
txid: Txid,
) -> Pin<Box<dyn Future<Output = Result<Transaction, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_transaction<'life0, 'async_trait>(
&'life0 self,
txid: Txid,
) -> Pin<Box<dyn Future<Output = Result<Transaction, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get a transaction by its txid
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#transactions
Sourcefn get_block_filter_headers<'life0, 'async_trait>(
&'life0 self,
start_hash: BlockHash,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<FilterHeader>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_block_filter_headers<'life0, 'async_trait>(
&'life0 self,
start_hash: BlockHash,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<FilterHeader>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get a series of block filter headers beginning from a block hash
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockfilter-headers
Sourcefn get_block_filter<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<BlockFilter, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_block_filter<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<BlockFilter, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get a block filter for a given block hash
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockfilters
Sourcefn get_chain_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetBlockchainInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_chain_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetBlockchainInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get info on the block chain state
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#chaininfos
Sourcefn get_utxos<'life0, 'life1, 'async_trait>(
&'life0 self,
outpoints: &'life1 [OutPoint],
check_mempool: bool,
) -> Pin<Box<dyn Future<Output = Result<GetUtxosResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_utxos<'life0, 'life1, 'async_trait>(
&'life0 self,
outpoints: &'life1 [OutPoint],
check_mempool: bool,
) -> Pin<Box<dyn Future<Output = Result<GetUtxosResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get utxos for a given set of outpoints
Optionally check unconfirmed utxos in the mempool
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#query-utxo-set
Sourcefn get_mempool_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetMempoolInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_mempool_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetMempoolInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get info on the mempool state
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#memory-pool
Sourcefn get_mempool<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Txid, GetMempoolEntryResult>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_mempool<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Txid, GetMempoolEntryResult>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get info for every transaction in the mempool
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#memory-pool
Sourcefn get_mempool_txids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Txid>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_mempool_txids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Txid>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get the txid for every transaction in the mempool Only available on Bitcoin Core v25.0.0 and later
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#memory-pool
Sourcefn get_mempool_txids_and_sequence<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetMempoolTxidsAndSequenceResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_mempool_txids_and_sequence<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetMempoolTxidsAndSequenceResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get the txid for every transaction in the mempool and the mempool sequence Only available on Bitcoin Core v25.0.0 and later
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#memory-pool
Sourcefn get_deployment_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetDeploymentInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_deployment_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<GetDeploymentInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get soft fork deployment status info Only available on Bitcoin Core v25.0.0 and later
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#deployment-info
Sourceunsafe fn get_deployment_info_at_block<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<GetDeploymentInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
unsafe fn get_deployment_info_at_block<'life0, 'async_trait>(
&'life0 self,
hash: BlockHash,
) -> Pin<Box<dyn Future<Output = Result<GetDeploymentInfoResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Get soft fork deployment status info Only available on Bitcoin Core v25.1.0 and later
WARNING: CALLING THIS CONNECTED TO BITCOIN CORE V25.0 WILL CRASH BITCOIND
IT IS MARKED UNSAFE TO ENSURE YOU ARE NOT USING BITCOIN CORE V25.0
See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#deployment-info
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl RestApi for RestClient
use-reqwest
only.