Skip to content

Commit 52a6e78

Browse files
committed
src/args.rs:block block_header block_height
1 parent 52a0f55 commit 52a6e78

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/args.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub struct Args {
8484
/// `https://mempool.space/api/v1/historical-price?currency=USD?timestamp=0`
8585
pub timestamp: Option<String>,
8686

87-
// ADDRESSES
87+
/// - ADDRESSES
8888
/// `https://mempool.space/api/address/<ADDRESS>`
8989
pub address: Option<String>,
9090
/// `https://mempool.space/api/address/<ADDRESS>/txs`
@@ -101,6 +101,8 @@ pub struct Args {
101101
/// - BLOCK
102102
/// `https://mempool.space/api/block/<BLOCK_HASH>`
103103
pub block: Option<String>,
104+
105+
/// - BLOCK_HEADER
104106
/// `https://mempool.space/api/block/<BLOCK_HASH>/header`
105107
pub block_header: Option<String>,
106108

@@ -213,7 +215,10 @@ impl Args {
213215
opts.optopt("", "address_utxos", "address_utxos api call", "ADDRESS_UTXOS");
214216
opts.optopt("", "validate_address", "validate an address", "VALIDATE_ADDRESS");
215217

218+
// BLOCK/S
216219
opts.optopt("", "block", "block api call", "BLOCK");
220+
opts.optopt("", "block_header", "block-header api call", "BLOCK_HEADER");
221+
opts.optopt("", "block_height", "block-height api call", "BLOCK_HEIGHT");
217222

218223
//OPTOPT
219224
opts.optopt("c", "config", "sets the configuration file", "CONFIG");
@@ -293,7 +298,18 @@ impl Args {
293298
}
294299

295300
if matches.opt_present("block") {
296-
print!("69:block");
301+
let block = matches.opt_str("block");
302+
generic_sys_call("block", &block.unwrap());
303+
std::process::exit(0);
304+
}
305+
if matches.opt_present("block_header") {
306+
let block_header = matches.opt_str("block_header");
307+
generic_sys_call("block_header", &block_header.unwrap());
308+
std::process::exit(0);
309+
}
310+
if matches.opt_present("block_height") {
311+
let block_height = matches.opt_str("block_height");
312+
generic_sys_call("block_height", &block_height.unwrap());
297313
std::process::exit(0);
298314
}
299315

0 commit comments

Comments
 (0)