Struct bitcoind_json_rpc_regtest::Client

source ·
pub struct Client { /* private fields */ }
Available on crate feature 26_0 only.
Expand description

The version specific client and json types.

THIS IS AVAILABLE FOR ALL VERSION NUMBER FEATURES (eg 25_0, 24_2 etc). This crate is unusual in that it expects exactly one version number feature to be selected, docs.rs is not set up to handle such oddity.

Client implements a JSON-RPC client for the Bitcoin Core daemon or compatible APIs.

Implementations§

source§

impl Client

source

pub fn new(url: &str) -> Client

Creates a client to a bitcoind JSON-RPC server without authentication.

source

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

Creates a client to a bitcoind JSON-RPC server without authentication.

source

pub fn call<T>(&self, method: &str, args: &[Value]) -> Result<T, Error>
where T: for<'a> Deserialize<'a>,

Call an RPC method with given args list.

source§

impl Client

source§

impl Client

source

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

Gets the blockhash of the current chain tip.

source

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

source§

impl Client

source

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

Gets a block by blockhash.

source

pub fn get_block_verbosity_zero( &self, hash: &BlockHash, ) -> Result<GetBlockVerbosityZero, Error>

source

pub fn get_block_verbosity_one( &self, hash: &BlockHash, ) -> Result<GetBlockVerbosityOne, Error>

source§

impl Client

source

pub fn get_tx_out(&self, txid: Txid, vout: u64) -> Result<GetTxOut, Error>

source§

impl Client

source

pub fn stop(&self) -> Result<String, Error>

source§

impl Client

source

pub fn generate_to_address( &self, nblocks: usize, address: &Address, ) -> Result<GenerateToAddress, Error>

source§

impl Client

source

pub fn server_version(&self) -> Result<usize, Error>

Returns the server version field of GetNetworkInfo.

source

pub fn get_network_info(&self) -> Result<GetNetworkInfo, Error>

source§

impl Client

source

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

Checks that the JSON-RPC endpoint is for a bitcoind instance with the expected version.

source§

impl Client

source§

impl Client

source

pub fn create_wallet(&self, wallet: &str) -> Result<CreateWallet, Error>

source§

impl Client

source

pub fn unload_wallet(&self, wallet: &str) -> Result<UnloadWallet, Error>

source§

impl Client

source

pub fn load_wallet(&self, wallet: &str) -> Result<LoadWallet, Error>

source§

impl Client

source§

impl Client

source§

impl Client

source

pub fn new_address(&self) -> Result<Address, Error>

Gets a new address from bitcoind and parses it assuming its correct.

source

pub fn new_address_with_type(&self, ty: AddressType) -> Result<Address, Error>

Gets a new address from bitcoind and parses it assuming its correct.

source

pub fn get_new_address(&self) -> Result<GetNewAddress, Error>

source

pub fn get_new_address_with_type( &self, ty: AddressType, ) -> Result<GetNewAddress, Error>

source§

impl Client

source

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

source§

impl Client

Trait Implementations§

source§

impl Debug for Client

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

§

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

§

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.