From 5d6009cbf5a9f91a993b1358ec6b145714309187 Mon Sep 17 00:00:00 2001 From: cryptoAtwill Date: Thu, 30 Nov 2023 15:29:50 +0800 Subject: [PATCH] list in range --- .../src/commands/crossmsg/topdown_cross.rs | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/ipc/cli/src/commands/crossmsg/topdown_cross.rs b/ipc/cli/src/commands/crossmsg/topdown_cross.rs index d969477f..fdb963a0 100644 --- a/ipc/cli/src/commands/crossmsg/topdown_cross.rs +++ b/ipc/cli/src/commands/crossmsg/topdown_cross.rs @@ -26,17 +26,24 @@ impl CommandLineHandler for ListTopdownMsgs { let provider = get_ipc_provider(global)?; let subnet = SubnetID::from_str(&arguments.subnet)?; - let result = provider.get_top_down_msgs(&subnet, arguments.epoch).await?; - println!("block hash: {}", hex::encode(result.block_hash)); - for msg in result.value { + for h in arguments.from..=arguments.to { + let result = provider.get_top_down_msgs(&subnet, h).await?; println!( - "from: {}, to: {}, value: {}, nonce: {}, fee: {} ", - msg.msg.from.to_string()?, - msg.msg.to.to_string()?, - msg.msg.value, - msg.msg.nonce, - msg.msg.fee + "block height: {}, block hash: {}, number of messages: {}", + h, + hex::encode(result.block_hash), + result.value.len() ); + for msg in result.value { + println!( + "from: {}, to: {}, value: {}, nonce: {}, fee: {} ", + msg.msg.from.to_string()?, + msg.msg.to.to_string()?, + msg.msg.value, + msg.msg.nonce, + msg.msg.fee + ); + } } Ok(()) @@ -48,8 +55,14 @@ impl CommandLineHandler for ListTopdownMsgs { pub(crate) struct ListTopdownMsgsArgs { #[arg(long, short, help = "The subnet id of the topdown subnet")] pub subnet: String, - #[arg(long, short, help = "Include topdown messages of this epoch")] - pub epoch: ChainEpoch, + #[arg( + long, + short, + help = "Include topdown messages starting from this epoch" + )] + pub from: ChainEpoch, + #[arg(long, short, help = "Include topdown messages to this epoch")] + pub to: ChainEpoch, } pub(crate) struct LatestParentFinality;