Skip to content

Commit

Permalink
src/bin/mempool-space_address_txs_mempool.rs:
Browse files Browse the repository at this point in the history
mempool-space --address_txs_mempool
  • Loading branch information
RandyMcMillan committed Aug 11, 2024
1 parent bea3afe commit f74411a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ impl Args {
opts.optopt("", "address", "address api call", "ADDRESS");
opts.optopt("", "address_txs", "address_txs api call", "ADDRESS_TXS");
opts.optopt("", "address_txs_chain", "address_txs_chain api call", "ADDRESS_TXS_CHAIN");
opts.optopt("", "address_txs_mempool", "address_txs_mempool api call", "ADDRESS_TXS_MEMPOOL");
opts.optopt("", "address_utxos", "address_utxos api call", "ADDRESS_UTXOS");
opts.optopt("", "validate_address", "validate an address", "VALIDATE_ADDRESS");

Expand Down Expand Up @@ -229,6 +230,11 @@ impl Args {
generic_sys_call("address_txs_chain", &address.unwrap());
std::process::exit(0);
}
if matches.opt_present("address_txs_mempool") {
let address = matches.opt_str("address_txs_mempool");
generic_sys_call("address_txs_mempool", &address.unwrap());
std::process::exit(0);
}
if matches.opt_present("validate_address") {
let validate_address = matches.opt_str("validate_address");
generic_sys_call("validate_address", &validate_address.unwrap());
Expand Down
16 changes: 16 additions & 0 deletions src/bin/mempool-space_address_txs_mempool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use mempool_space::blocking;
use std::env;

fn main() {
{
let args: Vec<String> = env::args().collect();
let mut address = &String::from("");
if args.len() > 1 {
address = &args[1];
} else {
// silence is golden
std::process::exit(0);
}
let _res = blocking(&format!("/address/{}/txs/mempool", &address));
}
}
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ mod tests {
fn test_address_txs_mempool() {
// GET /api/address/:address/txs/mempool
let binding = format!("address/1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv/txs/mempool").clone();
let prices: &str = blocking(&binding).expect("REASON");
let address_txs_mempool: &str = blocking(&binding).expect("REASON");
let address_txs_mempool = generic_sys_call("address_txs_mempool", "1wiz18xYmhRX6xStj2b9t1rwWX4GKUgpv");
wait("1");
}
#[test]
Expand Down

0 comments on commit f74411a

Please sign in to comment.