Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya committed Nov 8, 2024
1 parent 2387389 commit 3b78d96
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
9 changes: 5 additions & 4 deletions examples/fillers/examples/gas_filler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Example of using the `GasFiller` in the provider.
use alloy::{
consensus::Transaction,
network::TransactionBuilder,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
Expand Down Expand Up @@ -34,9 +35,9 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 0);
assert_eq!(pending_tx.nonce(), 0);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

// Update the nonce and send the transaction again.
let tx = tx.with_nonce(1);
Expand All @@ -46,9 +47,9 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 1);
assert_eq!(pending_tx.nonce(), 1);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

Ok(())
}
9 changes: 5 additions & 4 deletions examples/fillers/examples/nonce_filler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Example of using the `NonceFiller` in the provider.
use alloy::{
consensus::Transaction,
network::TransactionBuilder,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
Expand Down Expand Up @@ -51,18 +52,18 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Transaction not found");
assert_eq!(pending_tx.nonce, 0);
assert_eq!(pending_tx.nonce(), 0);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

// Send the transaction, the nonce (1) is automatically managed by the provider.
let builder = provider.send_transaction(tx).await?;
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Transaction not found");
assert_eq!(pending_tx.nonce, 1);
assert_eq!(pending_tx.nonce(), 1);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

Ok(())
}
9 changes: 5 additions & 4 deletions examples/fillers/examples/recommended_fillers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Example of using the `.with_recommended_fillers()` method in the provider.
use alloy::{
consensus::Transaction,
network::TransactionBuilder,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
Expand Down Expand Up @@ -30,18 +31,18 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 0);
assert_eq!(pending_tx.nonce(), 0);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

// Send the transaction, the nonce (1) is automatically managed by the provider.
let builder = provider.send_transaction(tx).await?;
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 1);
assert_eq!(pending_tx.nonce(), 1);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

Ok(())
}
2 changes: 0 additions & 2 deletions examples/layers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ alloy.workspace = true
eyre.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tower = { version = "0.5", features = ["retry"] }
tower-http = { version = "0.6.1", features = ["timeout"] }
http-body-util = "0.1"

0 comments on commit 3b78d96

Please sign in to comment.