Struct RestClient

Source
pub struct RestClient { /* private fields */ }
Available on crate feature use-reqwest only.
Expand description

Creates HTTP REST requests to bitcoind.

See RestApi for the available methods.

Implementations§

Source§

impl RestClient

Source

pub fn new(endpoint: impl IntoUrl) -> Result<Self, Error>

Create a new RestClient instance with given endpoint url

Source

pub fn network_default(network: Network) -> Self

Create a new RestClient instance with the default endpoint for that network

For example, Network::Bitcoin creates an instance with "http://localhost:8332"

Trait Implementations§

Source§

impl Clone for RestClient

Source§

fn clone(&self) -> RestClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl RestApi for RestClient

Source§

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
Source§

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,

Get a response from a bin endpoint
Source§

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 Read more
Source§

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
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more
Source§

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 Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,