Skip to content

Commit f74411a

Browse files
committed
src/bin/mempool-space_address_txs_mempool.rs:
mempool-space --address_txs_mempool
1 parent bea3afe commit f74411a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/args.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ impl Args {
158158
opts.optopt("", "address", "address api call", "ADDRESS");
159159
opts.optopt("", "address_txs", "address_txs api call", "ADDRESS_TXS");
160160
opts.optopt("", "address_txs_chain", "address_txs_chain api call", "ADDRESS_TXS_CHAIN");
161+
opts.optopt("", "address_txs_mempool", "address_txs_mempool api call", "ADDRESS_TXS_MEMPOOL");
161162
opts.optopt("", "address_utxos", "address_utxos api call", "ADDRESS_UTXOS");
162163
opts.optopt("", "validate_address", "validate an address", "VALIDATE_ADDRESS");
163164

@@ -229,6 +230,11 @@ impl Args {
229230
generic_sys_call("address_txs_chain", &address.unwrap());
230231
std::process::exit(0);
231232
}
233+
if matches.opt_present("address_txs_mempool") {
234+
let address = matches.opt_str("address_txs_mempool");
235+
generic_sys_call("address_txs_mempool", &address.unwrap());
236+
std::process::exit(0);
237+
}
232238
if matches.opt_present("validate_address") {
233239
let validate_address = matches.opt_str("validate_address");
234240
generic_sys_call("validate_address", &validate_address.unwrap());
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use mempool_space::blocking;
2+
use std::env;
3+
4+
fn main() {
5+
{
6+
let args: Vec<String> = env::args().collect();
7+
let mut address = &String::from("");
8+
if args.len() > 1 {
9+
address = &args[1];
10+
} else {
11+
// silence is golden
12+
std::process::exit(0);
13+
}
14+
let _res = blocking(&format!("/address/{}/txs/mempool", &address));
15+
}
16+
}

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ mod tests {
257257
fn test_address_txs_mempool() {
258258
// GET /api/address/:address/txs/mempool
259259
let binding = format!("address/1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv/txs/mempool").clone();
260-
let prices: &str = blocking(&binding).expect("REASON");
260+
let address_txs_mempool: &str = blocking(&binding).expect("REASON");
261+
let address_txs_mempool = generic_sys_call("address_txs_mempool", "1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv");
261262
wait("1");
262263
}
263264
#[test]

0 commit comments

Comments
 (0)