Skip to content

Commit 68aadc4

Browse files
committed
feat(client): add get_mempool_stats method
1 parent ab4fdde commit 68aadc4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/async.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ impl<S: Sleeper> AsyncClient<S> {
452452

453453
self.get_response_json(&path).await
454454
}
455+
456+
/// Get statistics about the mempool.
457+
pub async fn get_mempool_stats(&self) -> Result<MempoolStats, Error> {
458+
self.get_response_json("/mempool").await
459+
}
460+
455461
/// Get an map where the key is the confirmation target (in number of
456462
/// blocks) and the value is the estimated feerate (in sat/vB).
457463
pub async fn get_fee_estimates(&self) -> Result<HashMap<u16, f64>, Error> {

src/blocking.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ impl BlockingClient {
316316
.map(|s| BlockHash::from_str(s.as_str()).map_err(Error::HexToArray))?
317317
}
318318

319+
/// Get statistics about the mempool.
320+
pub fn get_mempool_stats(&self) -> Result<MempoolStats, Error> {
321+
self.get_response_json("/mempool")
322+
}
323+
319324
/// Get an map where the key is the confirmation target (in number of
320325
/// blocks) and the value is the estimated feerate (in sat/vB).
321326
pub fn get_fee_estimates(&self) -> Result<HashMap<u16, f64>, Error> {

0 commit comments

Comments
 (0)