Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn new(url: &str, auth: Auth) -> Result<Self, Error>

Creates a simple_http client with url and auth.

This can fail if we are unable to read the configured Auth::CookieFile.

Source

pub fn new_user_pass(url: &str, user: String, pass: Option<String>) -> Self

Creates a simple_http client with user and pass.

Creates a simple_http client with cookie authentication.

Source§

impl Client

Source

pub fn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>

getblockchaininfo.

Source

pub fn get_descriptor_info( &self, descriptor: &str, ) -> Result<GetDescriptorInfo, Error>

getdescriptorinfo

Source

pub fn get_block_count(&self) -> Result<u32, Error>

getblockcount

Source

pub fn get_best_block_hash(&self) -> Result<BlockHash, Error>

getbestblockhash

Source

pub fn get_block_hash(&self, height: u32) -> Result<BlockHash, Error>

getblockhash

Source

pub fn get_block_header(&self, hash: &BlockHash) -> Result<Header, Error>

getblockheader

Source

pub fn get_block_header_verbose( &self, hash: &BlockHash, ) -> Result<GetBlockHeaderVerbose, Error>

getblockheader (verbose)

Source

pub fn get_block_filter( &self, hash: &BlockHash, ) -> Result<GetBlockFilter, Error>

getblockfilter

Source

pub fn get_block_raw(&self, hash: &BlockHash) -> Result<String, Error>

getblock (raw)

Source

pub fn get_block(&self, hash: &BlockHash) -> Result<Block, Error>

getblock

Source

pub fn get_raw_mempool(&self) -> Result<Vec<Txid>, Error>

getrawmempool

Source

pub fn send_to_address( &self, address: &Address, amount: Amount, ) -> Result<Txid, Error>

sendtoaddress

Source

pub fn get_raw_transaction(&self, txid: &Txid) -> Result<Transaction, Error>

getrawtransaction

Source

pub fn import_descriptors( &self, requests: &[ImportDescriptorsRequest], ) -> Result<Vec<ImportDescriptorsResponse>, Error>

importdescriptors

Source

pub fn estimate_smart_fee(&self, blocks: u32) -> Result<FeeRate, Error>

estimatesmartfee

Source§

impl Client

Source

pub fn get_block_verbose( &self, hash: &BlockHash, ) -> Result<GetBlockVerboseOne, Error>

getblock (verbose = 1)

Source

pub fn get_raw_mempool_verbose( &self, ) -> Result<BTreeMap<Txid, MempoolEntry>, Error>

getrawmempool (verbose = true)

Trait Implementations§

Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.