This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
[package] | ||
name = "debugging" | ||
description = "Testing utils for reth." | ||
version.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
license.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
secp256k1.workspace = true | ||
alloy-genesis.workspace = true | ||
reth-primitives = { workspace = true, features = ["alloy-compat"] } | ||
alloy-rpc-types.workspace = true | ||
alloy-provider = { workspace = true, features = ["reqwest"] } | ||
alloy-transport-http.workspace = true | ||
tokio = { workspace = true, features = ["rt-multi-thread"] } | ||
url.workspace = true | ||
eyre.workspace = true | ||
futures-util.workspace = true |
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,30 @@ | ||
use alloy_provider::{Provider as AlloyProvider, ReqwestProvider}; | ||
use alloy_rpc_types::{transaction, Block, BlockId, EIP1186AccountProofResponse}; | ||
use alloy_transport_http::Http; | ||
use reth_primitives::{Block as RethBlock, U256}; | ||
use url::Url; | ||
|
||
#[tokio::main] | ||
async fn main() -> eyre::Result<()> { | ||
let block_number = 18884920u64; | ||
let rpc_url = Url::parse("https://docs-demo.quiknode.pro/").expect("Invalid RPC URL"); | ||
let provider: ReqwestProvider = ReqwestProvider::new_http(rpc_url); | ||
|
||
let alloy_block = | ||
provider.get_block_by_number(block_number.into(), true).await.unwrap().unwrap(); | ||
if let Some(transactions) = alloy_block.transactions.as_transactions() { | ||
for (i, tx) in transactions.iter().enumerate() { | ||
if i == 3 { | ||
println!("Transaction: {:?}", tx.hash); | ||
} | ||
} | ||
} | ||
|
||
let block = RethBlock::try_from(alloy_block).unwrap(); | ||
for (i, transaction) in block.body.iter().enumerate() { | ||
if i == 3 { | ||
println!("Transaction: {:?}", transaction); | ||
} | ||
} | ||
Ok(()) | ||
} |