pub struct MempoolClient { /* private fields */ }Expand description
Mempool.space API client.
Provides methods for querying fee estimates, address information, transactions, and broadcasting.
§Example
use rustywallet_mempool::MempoolClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = MempoolClient::new();
// Get fee estimates
let fees = client.get_fees().await?;
println!("Next block fee: {} sat/vB", fees.fastest_fee);
// Get address info
let info = client.get_address("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa").await?;
println!("Balance: {} sats", info.confirmed_balance());
Ok(())
}Implementations§
Source§impl MempoolClient
impl MempoolClient
Sourcepub fn with_base_url(base_url: &str) -> Self
pub fn with_base_url(base_url: &str) -> Self
Create a new client with custom base URL.
Sourcepub async fn get_fees(&self) -> Result<FeeEstimates>
pub async fn get_fees(&self) -> Result<FeeEstimates>
Get recommended fee estimates.
Returns fee rates in sat/vB for different confirmation targets.
Sourcepub async fn get_address(&self, address: &str) -> Result<AddressInfo>
pub async fn get_address(&self, address: &str) -> Result<AddressInfo>
Get address information including balance and transaction count.
Sourcepub async fn get_address_txs(&self, address: &str) -> Result<Vec<Transaction>>
pub async fn get_address_txs(&self, address: &str) -> Result<Vec<Transaction>>
Get transaction history for an address.
Returns up to 50 most recent transactions.
Sourcepub async fn get_tx(&self, txid: &str) -> Result<Transaction>
pub async fn get_tx(&self, txid: &str) -> Result<Transaction>
Get transaction details by txid.
Sourcepub async fn get_tx_hex(&self, txid: &str) -> Result<String>
pub async fn get_tx_hex(&self, txid: &str) -> Result<String>
Get raw transaction hex by txid.
Sourcepub async fn get_block_height(&self) -> Result<u64>
pub async fn get_block_height(&self) -> Result<u64>
Get current block height.
Sourcepub async fn get_block_hash(&self, height: u64) -> Result<String>
pub async fn get_block_hash(&self, height: u64) -> Result<String>
Get block hash by height.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MempoolClient
impl !RefUnwindSafe for MempoolClient
impl Send for MempoolClient
impl Sync for MempoolClient
impl Unpin for MempoolClient
impl !UnwindSafe for MempoolClient
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