-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses the `starknet_traceBlockTransactions` under the hood.
- Loading branch information
1 parent
ccac7ca
commit ca1739c
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use anyhow::Result; | ||
use clap::Parser; | ||
use colored_json::{ColorMode, Output}; | ||
use starknet::providers::Provider; | ||
|
||
use crate::{utils::parse_block_id, verbosity::VerbosityArgs, ProviderArgs}; | ||
|
||
#[derive(Debug, Parser)] | ||
pub struct BlockTraces { | ||
#[clap(flatten)] | ||
provider: ProviderArgs, | ||
#[clap( | ||
default_value = "latest", | ||
help = "Block number, hash, or tag (latest/pending)" | ||
)] | ||
block_id: String, | ||
#[clap(flatten)] | ||
verbosity: VerbosityArgs, | ||
} | ||
|
||
impl BlockTraces { | ||
pub async fn run(self) -> Result<()> { | ||
self.verbosity.setup_logging(); | ||
|
||
let provider = self.provider.into_provider()?; | ||
|
||
let block_id = parse_block_id(&self.block_id)?; | ||
|
||
let traces_json = serde_json::to_value(provider.trace_block_transactions(block_id).await?)?; | ||
|
||
let traces_json = | ||
colored_json::to_colored_json(&traces_json, ColorMode::Auto(Output::StdOut))?; | ||
println!("{traces_json}"); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters