PooledClient

Struct PooledClient 

Source
pub struct PooledClient<'a> { /* private fields */ }
Expand description

A client borrowed from the connection pool.

The connection is automatically returned to the pool when dropped.

Implementations§

Source§

impl<'a> PooledClient<'a>

Source

pub fn client(&self) -> &ElectrumClient

Get a reference to the underlying client.

Source

pub fn use_count(&self) -> usize

Get the connection’s use count.

Source

pub fn age(&self) -> Duration

Get the connection’s age.

Methods from Deref<Target = ElectrumClient>§

Source

pub async fn get_balance(&self, address: &str) -> Result<Balance>

Get balance for a single address.

§Arguments
  • address - Bitcoin address (P2PKH, P2SH, P2WPKH, P2WSH, P2TR)
§Returns
  • Balance with confirmed and unconfirmed amounts in satoshis
Source

pub async fn get_balance_scripthash(&self, scripthash: &str) -> Result<Balance>

Get balance using scripthash directly.

Source

pub async fn get_balances(&self, addresses: &[&str]) -> Result<Vec<Balance>>

Get balances for multiple addresses in a single batch request.

This is much more efficient than calling get_balance multiple times.

§Arguments
  • addresses - Slice of Bitcoin addresses
§Returns
  • Vector of Balance in the same order as input addresses
Source

pub async fn get_balances_scripthash( &self, scripthashes: &[String], ) -> Result<Vec<Balance>>

Get balances using scripthashes directly (batch).

Source

pub async fn list_unspent(&self, address: &str) -> Result<Vec<Utxo>>

List unspent outputs (UTXOs) for an address.

§Arguments
  • address - Bitcoin address
§Returns
  • Vector of Utxo for the address
Source

pub async fn list_unspent_scripthash( &self, scripthash: &str, ) -> Result<Vec<Utxo>>

List unspent outputs using scripthash directly.

Source

pub async fn get_transaction(&self, txid: &str) -> Result<String>

Get raw transaction by txid.

§Arguments
  • txid - Transaction ID (hex)
§Returns
  • Raw transaction hex string
Source

pub async fn broadcast(&self, raw_tx: &str) -> Result<String>

Broadcast a signed transaction.

§Arguments
  • raw_tx - Signed transaction in hex format
§Returns
  • Transaction ID if broadcast successful
Source

pub async fn get_history(&self, address: &str) -> Result<Vec<TxHistory>>

Get transaction history for an address.

§Arguments
  • address - Bitcoin address
§Returns
  • Vector of TxHistory entries
Source

pub async fn get_history_scripthash( &self, scripthash: &str, ) -> Result<Vec<TxHistory>>

Get transaction history using scripthash directly.

Source

pub async fn server_version(&self) -> Result<ServerVersion>

Get server version information.

Also performs protocol version negotiation.

Source

pub async fn ping(&self) -> Result<()>

Ping the server to check connection.

Source

pub async fn get_block_height(&self) -> Result<u64>

Get the current block height.

Source

pub async fn estimate_fee(&self, blocks: u32) -> Result<f64>

Get estimated fee rate (satoshis per kilobyte).

§Arguments
  • blocks - Target confirmation blocks (e.g., 1, 6, 144)

Trait Implementations§

Source§

impl<'a> Deref for PooledClient<'a>

Source§

type Target = ElectrumClient

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> Drop for PooledClient<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for PooledClient<'a>

§

impl<'a> !RefUnwindSafe for PooledClient<'a>

§

impl<'a> Send for PooledClient<'a>

§

impl<'a> Sync for PooledClient<'a>

§

impl<'a> Unpin for PooledClient<'a>

§

impl<'a> !UnwindSafe for PooledClient<'a>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.