Skip to content

Commit 4f2630c

Browse files
committed
feat(client): add get_mempool_txids method
1 parent a1e4fd3 commit 4f2630c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/async.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,13 @@ impl<S: Sleeper> AsyncClient<S> {
463463
self.get_response_json("/mempool/recent").await
464464
}
465465

466+
/// Get the full list of [`Txid`]s in the mempool.
467+
///
468+
/// The order of the [`Txid`]s is arbitrary.
469+
pub async fn get_mempool_txids(&self) -> Result<Vec<Txid>, Error> {
470+
self.get_response_json("/mempool/txids").await
471+
}
472+
466473
/// Get an map where the key is the confirmation target (in number of
467474
/// blocks) and the value is the estimated feerate (in sat/vB).
468475
pub async fn get_fee_estimates(&self) -> Result<HashMap<u16, f64>, Error> {

src/blocking.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ impl BlockingClient {
326326
self.get_response_json("/mempool/recent")
327327
}
328328

329+
/// Get the full list of [`Txid`]s in the mempool.
330+
///
331+
/// The order of the txids is arbitrary and does not match bitcoind's.
332+
pub fn get_mempool_txids(&self) -> Result<Vec<Txid>, Error> {
333+
self.get_response_json("/mempool/txids")
334+
}
335+
329336
/// Get an map where the key is the confirmation target (in number of
330337
/// blocks) and the value is the estimated feerate (in sat/vB).
331338
pub fn get_fee_estimates(&self) -> Result<HashMap<u16, f64>, Error> {

0 commit comments

Comments
 (0)