pub struct MempoolHttpClient { /* private fields */ }Expand description
A MempoolLookup backed by the mempool.space REST API over reqwest.
Cheap to clone (holds an Arc-internal reqwest::Client and the base
URL). Construct with MempoolHttpClient::from_env to honour
JSS_PAY_MEMPOOL_URL, or MempoolHttpClient::new for an explicit base.
Implementations§
Source§impl MempoolHttpClient
impl MempoolHttpClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Construct a client against an explicit base URL (e.g.
https://mempool.space/testnet4). A trailing / is trimmed.
Sourcepub fn from_selection(selection: MempoolSelection) -> Self
pub fn from_selection(selection: MempoolSelection) -> Self
Construct from an already-resolved MempoolSelection. Does not log —
the caller owns whether this choice is recorded (see
log_mempool_selection).
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Construct from JSS_PAY_MEMPOOL_URL, falling back to
DEFAULT_MEMPOOL_URL (testnet4).
The resolved endpoint is logged exactly once via
log_mempool_selection, so the startup log always records which
explorer — and therefore which Bitcoin network — the pod is using, with
a warning when that endpoint was defaulted or is unclassifiable.
Sourcepub fn selection(&self) -> &MempoolSelection
pub fn selection(&self) -> &MempoolSelection
The resolved endpoint selection: base URL, inferred Bitcoin network, and whether the URL was operator-supplied or defaulted.
Sourcepub async fn transaction_exists(&self, txid: &str) -> Result<bool, PaymentError>
pub async fn transaction_exists(&self, txid: &str) -> Result<bool, PaymentError>
Check whether a transaction is known without collapsing an HTTP 404
into the same result as an ambiguous transport/server failure. Payment
intent recovery may compensate a debit only for Ok(false).
Trait Implementations§
Source§impl Clone for MempoolHttpClient
impl Clone for MempoolHttpClient
Source§fn clone(&self) -> MempoolHttpClient
fn clone(&self) -> MempoolHttpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MempoolHttpClient
impl Debug for MempoolHttpClient
Source§impl MempoolBroadcast for MempoolHttpClient
impl MempoolBroadcast for MempoolHttpClient
Source§fn broadcast_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
raw_hex: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, PaymentError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn broadcast_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
raw_hex: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, PaymentError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
raw_hex to the mempool’s broadcast endpoint; return the txid.Source§impl MempoolLookup for MempoolHttpClient
impl MempoolLookup for MempoolHttpClient
Source§fn address_utxos<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Utxo>, PaymentError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn address_utxos<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Utxo>, PaymentError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
address (confirmed or in-mempool). Read more