pub struct Client { /* private fields */ }Expand description
Client implements a JSON-RPC client for the Bitcoin Core daemon or compatible APIs.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(url: &str) -> Client
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn new(url: &str) -> Client
26_2 and non-crate feature 27_0 only.Creates a client to a bitcoind JSON-RPC server without authentication.
Source§impl Client
impl Client
pub fn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
Sourcepub fn best_block_hash(&self) -> Result<BlockHash, Error>
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn best_block_hash(&self) -> Result<BlockHash, Error>
26_2 and non-crate feature 27_0 only.Gets the blockhash of the current chain tip.
pub fn get_best_block_hash(&self) -> Result<GetBestBlockHash, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
Sourcepub fn get_block(&self, hash: BlockHash) -> Result<Block, Error>
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn get_block(&self, hash: BlockHash) -> Result<Block, Error>
26_2 and non-crate feature 27_0 only.Gets a block by blockhash.
pub fn get_block_verbosity_zero( &self, hash: BlockHash, ) -> Result<GetBlockVerbosityZero, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.pub fn get_block_verbosity_one( &self, hash: BlockHash, ) -> Result<GetBlockVerbosityOne, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn generate_to_address( &self, nblocks: usize, address: &Address, ) -> Result<GenerateToAddress, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
Sourcepub fn server_version(&self) -> Result<usize, Error>
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn server_version(&self) -> Result<usize, Error>
26_2 and non-crate feature 27_0 only.Returns the server version field of GetNetworkInfo.
pub fn get_network_info(&self) -> Result<GetNetworkInfo, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
Sourcepub fn check_expected_server_version(&self) -> Result<(), Error>
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn check_expected_server_version(&self) -> Result<(), Error>
26_2 and non-crate feature 27_0 only.Checks that the JSON-RPC endpoint is for a bitcoind instance with the expected version.
Source§impl Client
impl Client
pub fn send_raw_transaction( &self, tx: &Transaction, ) -> Result<SendRawTransaction, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn create_wallet(&self, wallet: &str) -> Result<CreateWallet, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn unload_wallet(&self, wallet: &str) -> Result<UnloadWallet, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn load_wallet(&self, wallet: &str) -> Result<LoadWallet, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn get_balance(&self) -> Result<GetBalance, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn get_balances(&self) -> Result<GetBalances, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
Sourcepub fn new_address(&self) -> Result<Address, Error>
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn new_address(&self) -> Result<Address, Error>
26_2 and non-crate feature 27_0 only.Gets a new address from bitcoind and parses it assuming its correct.
Sourcepub fn new_address_with_type(&self, ty: AddressType) -> Result<Address, Error>
Available on crate feature 26_2 and non-crate feature 27_0 only.
pub fn new_address_with_type(&self, ty: AddressType) -> Result<Address, Error>
26_2 and non-crate feature 27_0 only.Gets a new address from bitcoind and parses it assuming its correct.
pub fn get_new_address(&self) -> Result<GetNewAddress, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.pub fn get_new_address_with_type( &self, ty: AddressType, ) -> Result<GetNewAddress, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn send_to_address( &self, address: &Address, amount: Amount, ) -> Result<SendToAddress, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Source§impl Client
impl Client
pub fn get_transaction(&self, txid: Txid) -> Result<GetTransaction, Error>
Available on crate feature
26_2 and non-crate feature 27_0 only.Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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