Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

List topdown messages in range #409

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions ipc/cli/src/commands/crossmsg/topdown_cross.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand All @@ -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;
Expand Down
Loading