Skip to content

Commit

Permalink
feat: fetch block receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed May 20, 2024
1 parent c95c49c commit 7b243d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/subcommands/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pub struct Block {
provider: ProviderArgs,
#[clap(long, help = "Fetch full transactions instead of hashes only")]
full: bool,
#[clap(long, help = "Fetch receipts alongside transactions")]
receipts: bool,
#[clap(
default_value = "latest",
help = "Block number, hash, or tag (latest/pending)"
Expand All @@ -28,7 +30,9 @@ impl Block {

let block_id = parse_block_id(&self.block_id)?;

let block_json = if self.full {
let block_json = if self.receipts {
serde_json::to_value(provider.get_block_with_receipts(block_id).await?)?
} else if self.full {
serde_json::to_value(provider.get_block_with_txs(block_id).await?)?
} else {
serde_json::to_value(provider.get_block_with_tx_hashes(block_id).await?)?
Expand Down

0 comments on commit 7b243d1

Please sign in to comment.