Struct Client

Source
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

Source

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

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

Source

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

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

Source

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

Call an RPC method with given args list.

Source§

impl Client

Source

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

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

Source§

impl Client

Source§

impl Client

Source

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

Gets the blockhash of the current chain tip.

Source

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

Source§

impl Client

Source

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

Gets a block by blockhash.

Source

pub fn get_block_verbose_zero( &self, hash: BlockHash, ) -> Result<GetBlockVerboseZero>

Gets a block by blockhash with verbose set to 0.

Source

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

Gets a block by blockhash with verbose set to 1.

Source§

impl Client

Source§

impl Client

Source

pub fn get_block_hash(&self, height: u64) -> Result<GetBlockHash>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

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

Source§

impl Client

Source

pub fn get_tx_out_proof(&self, txids: &[Txid]) -> Result<String>

Source§

impl Client

Source§

impl Client

Source

pub fn precious_block(&self, hash: BlockHash) -> Result<()>

Source§

impl Client

Source

pub fn prune_blockchain(&self, target: u64) -> Result<PruneBlockchain>

Instructs the node to prune the blockchain up to a specified height or timestamp.

Source§

impl Client

Source

pub fn save_mempool(&self) -> Result<()>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn help(&self) -> Result<String>

Source§

impl Client

Source

pub fn logging(&self) -> Result<Logging>

Source§

impl Client

Source

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

Source§

impl Client

Source

pub fn uptime(&self) -> Result<u32>

Source§

impl Client

Source

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

Source§

impl Client

Source

pub fn generate(&self, nblocks: usize) -> Result<Generate>

Source§

impl Client

Source

pub fn invalidate_block(&self, hash: BlockHash) -> Result<()>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn prioritise_transaction( &self, txid: &Txid, fee_delta: SignedAmount, ) -> Result<bool>

Source§

impl Client

Source

pub fn submit_block(&self, block: &Block) -> Result<()>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

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

Returns the server version field of GetNetworkInfo.

Source

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

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn analyze_psbt(&self, psbt: &Psbt) -> Result<AnalyzePsbt>

Source§

impl Client

Source

pub fn combine_psbt(&self, txs: &[Psbt]) -> Result<CombinePsbt>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn create_psbt( &self, inputs: &[Input], outputs: &[Output], ) -> Result<CreatePsbt>

Source§

impl Client

Source

pub fn create_raw_transaction( &self, inputs: &[Input], outputs: &[Output], ) -> Result<CreateRawTransaction>

Source§

impl Client

Source

pub fn decode_psbt(&self, psbt: &str) -> Result<DecodePsbt>

Source§

impl Client

Source§

impl Client

Source

pub fn decode_script(&self, script: &str) -> Result<DecodeScript>

Source§

impl Client

Source

pub fn finalize_psbt(&self, psbt: &Psbt) -> Result<FinalizePsbt>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn join_psbts(&self, psbts: &[Psbt]) -> Result<JoinPsbts>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn utxo_update_psbt(&self, psbt: &Psbt) -> Result<JoinPsbts>

Source§

impl Client

Source

pub fn create_multisig( &self, nrequired: u32, keys: Vec<PublicKey>, ) -> Result<CreateMultisig>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

pub fn verify_message( &self, address: &Address<NetworkChecked>, signature: &MessageSignature, message: &str, ) -> Result<VerifyMessage>

Source§

impl Client

Source§

impl Client

Source

pub fn bump_fee(&self, txid: Txid) -> Result<BumpFee>

Source§

impl Client

Source

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

Source§

impl Client

Source

pub fn dump_priv_key(&self, address: &Address) -> Result<DumpPrivKey>

Source§

impl Client

Source

pub fn dump_wallet(&self, filename: &Path) -> Result<DumpWallet>

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

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

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

Source

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

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

Source

pub fn new_address_with_label( &self, label: &str, ) -> Result<Address<NetworkUnchecked>>

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

Source

pub fn get_new_address( &self, label: Option<&str>, ty: Option<AddressType>, ) -> Result<GetNewAddress>

Gets a new address - low level RPC call.

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source§

impl Client

Source

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

Source§

impl Client

Source§

impl Client

Source

pub fn send_many(&self, amounts: BTreeMap<Address, Amount>) -> Result<SendMany>

Source§

impl Client

Source

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

Source

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

Source§

impl Client

Source

pub fn sign_message( &self, address: &Address, message: &str, ) -> Result<SignMessage>

Source§

impl Client

Source§

impl Client

Source

pub fn unload_wallet(&self, wallet_name: &str) -> Result<()>

Source§

impl Client

Source§

impl Client

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§

§

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