Struct bitcoincore_rest::BitcoinRest
source · [−]pub struct BitcoinRest { /* private fields */ }
Expand description
Holds the endpoint and http client
Implementations
sourceimpl BitcoinRest
impl BitcoinRest
sourcepub fn new(endpoint: String) -> Self
pub fn new(endpoint: String) -> Self
Create a new BitcoinRest instance with given endpoint url Must be in the format “http://{ip}:{port}/rest/”
sourcepub fn network_default(network: Network) -> Self
pub fn network_default(network: Network) -> Self
Create a new BitcoinRest instance with the default endpoint for that network For example, Network::Bitcoin creates an instance with “http://localhost:8332/rest/”
sourcepub async fn get_json<T: for<'a> Deserialize<'a>>(
&self,
path: &str
) -> Result<T, Error>
pub async fn get_json<T: for<'a> Deserialize<'a>>(
&self,
path: &str
) -> Result<T, Error>
Get a response from a json endpoint
sourcepub async fn get_bin(&self, path: &str) -> Result<Bytes, Error>
pub async fn get_bin(&self, path: &str) -> Result<Bytes, Error>
Get a response from a bin endpoint
sourcepub async fn get_block_headers(
&self,
start_hash: &BlockHash,
count: u32
) -> Result<Vec<BlockHeader>, Error>
pub async fn get_block_headers(
&self,
start_hash: &BlockHash,
count: u32
) -> Result<Vec<BlockHeader>, Error>
Get a series of block headers beginning from a block hash See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockheaders
sourcepub async fn get_block_at_height(&self, height: u64) -> Result<Block, Error>
pub async fn get_block_at_height(&self, height: u64) -> Result<Block, Error>
Convenience function to get a block at a specific height
sourcepub async fn get_block_hash(&self, height: u64) -> Result<BlockHash, Error>
pub async fn get_block_hash(&self, height: u64) -> Result<BlockHash, Error>
Get a block hash at a specific height See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockhash-by-height
sourcepub async fn get_block(&self, hash: &BlockHash) -> Result<Block, Error>
pub async fn get_block(&self, hash: &BlockHash) -> Result<Block, Error>
Get a block by its hash See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blocks
sourcepub async fn get_transaction(&self, txid: &Txid) -> Result<Transaction, Error>
pub async fn get_transaction(&self, txid: &Txid) -> Result<Transaction, Error>
Get a transaction by its txid See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#transactions
sourcepub async fn get_block_filter_headers(
&self,
start_hash: &BlockHash,
count: u32
) -> Result<Vec<FilterHeader>, Error>
pub async fn get_block_filter_headers(
&self,
start_hash: &BlockHash,
count: u32
) -> Result<Vec<FilterHeader>, Error>
Get a series of block filter headers beggining from a block hash See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockfilter-headers
sourcepub async fn get_block_filter(
&self,
hash: &BlockHash
) -> Result<BlockFilter, Error>
pub async fn get_block_filter(
&self,
hash: &BlockHash
) -> Result<BlockFilter, Error>
Get a block filter for a given block hash See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#blockfilters
sourcepub async fn get_chain_info(&self) -> Result<GetBlockchainInfoResult, Error>
pub async fn get_chain_info(&self) -> Result<GetBlockchainInfoResult, Error>
Get info on the block chain state See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#chaininfos
sourcepub async fn get_utxos(
&self,
outpoints: Vec<OutPoint>,
check_mempool: bool
) -> Result<GetUtxosResult, Error>
pub async fn get_utxos(
&self,
outpoints: Vec<OutPoint>,
check_mempool: bool
) -> Result<GetUtxosResult, Error>
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
sourcepub async fn get_mempool_info(&self) -> Result<GetMempoolInfoResult, Error>
pub async fn get_mempool_info(&self) -> Result<GetMempoolInfoResult, Error>
Get info on the mempool state See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#memory-pool
sourcepub async fn get_mempool(
&self
) -> Result<HashMap<Txid, GetMempoolEntryResult>, Error>
pub async fn get_mempool(
&self
) -> Result<HashMap<Txid, GetMempoolEntryResult>, Error>
Get info for every transaction in the mempool See https://github.com/bitcoin/bitcoin/blob/master/doc/REST-interface.md#memory-pool
Trait Implementations
sourceimpl Clone for BitcoinRest
impl Clone for BitcoinRest
sourcefn clone(&self) -> BitcoinRest
fn clone(&self) -> BitcoinRest
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for BitcoinRest
impl Send for BitcoinRest
impl Sync for BitcoinRest
impl Unpin for BitcoinRest
impl !UnwindSafe for BitcoinRest
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more