Sitelet https://github.com/SharkHand3/examples/commit/09055d548c5d48d85cee209ed4975b98e1a52a0d
Skip to content

Commit 09055d5

Browse files
feat(transactions): send_(legacy|eip1559|eip4844)_tx (alloy-rs#77)
* add explicit send_(legacy|eip1559|eip4844)_tx * Update examples/transactions/examples/send_eip1559_tx.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * Update examples/transactions/examples/send_eip1559_tx.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fix display type * fix merge issue * use display type properly when printing now that it is supported * fix clippy lint --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
1 parent 52a7c26 commit 09055d5

27 files changed

Lines changed: 210 additions & 89 deletions

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ This repository contains the following examples:
6666
- [x] [Transfer ERC20 token](./examples/transactions/examples/transfer_erc20.rs)
6767
- [x] [Transfer ETH](./examples/transactions/examples/transfer_eth.rs)
6868
- [x] [Sign and send a raw transaction](./examples/transactions/examples/sign_transaction.rs)
69+
- [x] [Send EIP-1559 transaction](./examples/transactions/examples/send_eip1559_tx.rs)
70+
- [x] [Send legacy transaction](./examples/transactions/examples/send_legacy_tx.rs)
71+
- [x] [Send EIP-4844 transaction](./examples/transactions/examples/send_eip4844_tx.rs)
6972
- [x] [Send transaction with access list](./examples/transactions/examples/with_access_list.rs)
70-
- [x] [Send 4844 transaction](./examples/transactions/examples/send_4844.rs)
7173
- [x] Wallets
7274
- [x] [AWS signer](./examples/wallets/examples/aws_signer.rs)
7375
- [x] [Ledger signer](./examples/wallets/examples/ledger_signer.rs)

‎examples/anvil/examples/deploy_contract_anvil.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,24 @@ async fn main() -> Result<()> {
4545
// Deploy the contract.
4646
let contract = Counter::deploy(&provider).await?;
4747

48-
println!("Deployed contract at address: {:?}", contract.address());
48+
println!("Deployed contract at address: {}", contract.address());
4949

5050
// Set the number to 42.
5151
let builder = contract.setNumber(U256::from(42));
5252
let receipt = builder.send().await?.get_receipt().await?;
5353

54-
println!("Set number to 42: {:?}", receipt.transaction_hash);
54+
println!("Set number to 42: {}", receipt.transaction_hash);
5555

5656
// Increment the number to 43.
5757
let builder = contract.increment();
5858
let receipt = builder.send().await?.get_receipt().await?;
5959

60-
println!("Incremented number: {:?}", receipt.transaction_hash);
60+
println!("Incremented number: {}", receipt.transaction_hash);
6161

6262
// Retrieve the number, which should be 43.
6363
let Counter::numberReturn { _0 } = contract.number().call().await?;
6464

65-
println!("Retrieved number: {:?}", _0.to_string());
65+
println!("Retrieved number: {_0}");
6666

6767
Ok(())
6868
}

‎examples/contracts/examples/deploy_from_artifact.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ async fn main() -> Result<()> {
3535
// Deploy the contract.
3636
let contract = Counter::deploy(&provider).await?;
3737

38-
println!("Deployed contract at address: {:?}", contract.address());
38+
println!("Deployed contract at address: {}", contract.address());
3939

4040
let builder = contract.setNumber(U256::from(42));
4141
let receipt = builder.send().await?.get_receipt().await?;
4242

43-
println!("Set number to 42: {:?}", receipt.transaction_hash);
43+
println!("Set number to 42: {}", receipt.transaction_hash);
4444

4545
// Increment the number to 43.
4646
let builder = contract.increment();
4747
let receipt = builder.send().await?.get_receipt().await?;
4848

49-
println!("Incremented number: {:?}", receipt.transaction_hash);
49+
println!("Incremented number: {}", receipt.transaction_hash);
5050

5151
// Retrieve the number, which should be 43.
5252
let Counter::numberReturn { _0 } = contract.number().call().await?;
5353

54-
println!("Retrieved number: {:?}", _0.to_string());
54+
println!("Retrieved number: {_0}");
5555

5656
Ok(())
5757
}

‎examples/contracts/examples/deploy_from_contract.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ async fn main() -> Result<()> {
4747
// Deploy the contract.
4848
let contract = Counter::deploy(&provider).await?;
4949

50-
println!("Deployed contract at address: {:?}", contract.address());
50+
println!("Deployed contract at address: {}", contract.address());
5151

5252
let builder = contract.setNumber(U256::from(42));
5353
let receipt = builder.send().await?.get_receipt().await?;
5454

55-
println!("Set number to 42: {:?}", receipt.transaction_hash);
55+
println!("Set number to 42: {}", receipt.transaction_hash);
5656

5757
// Increment the number to 43.
5858
let builder = contract.increment();
5959
let receipt = builder.send().await?.get_receipt().await?;
6060

61-
println!("Incremented number: {:?}", receipt.transaction_hash);
61+
println!("Incremented number: {}", receipt.transaction_hash);
6262

6363
// Retrieve the number, which should be 43.
6464
let Counter::numberReturn { _0 } = contract.number().call().await?;
6565

66-
println!("Retrieved number: {:?}", _0.to_string());
66+
println!("Retrieved number: {_0}");
6767

6868
Ok(())
6969
}

‎examples/providers/examples/builder.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ async fn main() -> Result<()> {
3737
// Send the transaction and wait for the receipt.
3838
let pending_tx = provider.send_transaction(tx).await?;
3939

40-
println!("Pending transaction...{:?}", pending_tx.tx_hash());
40+
println!("Pending transaction... {}", pending_tx.tx_hash());
4141

4242
// Wait for the transaction to be included.
4343
let receipt = pending_tx.get_receipt().await?;
4444

4545
println!(
46-
"Transaction included in block: {:?}",
47-
receipt.block_number.expect("Failed to get block number").to_string()
46+
"Transaction included in block {}",
47+
receipt.block_number.expect("Failed to get block number")
4848
);
4949

5050
assert_eq!(receipt.from, alice);

‎examples/providers/examples/builtin.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async fn main() -> Result<()> {
3232

3333
let handle = tokio::spawn(async move {
3434
while let Some(block) = stream.next().await {
35-
println!("{:?}", block.header.number);
35+
println!("{}", block.header.number.unwrap());
3636
}
3737
});
3838

‎examples/providers/examples/ws.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async fn main() -> Result<()> {
2727
// Take the stream and print the block number upon receiving a new block.
2828
let handle = tokio::spawn(async move {
2929
while let Some(block) = stream.next().await {
30-
println!("Latest block number: {:?}", block.header.number.unwrap().to_string());
30+
println!("Latest block number: {}", block.header.number.unwrap());
3131
}
3232
});
3333

‎examples/providers/examples/ws_with_auth.rs‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,14 @@ async fn main() -> Result<()> {
3838
// Take the basic stream and print the block number upon receiving a new block.
3939
let basic_handle = tokio::spawn(async move {
4040
while let Some(block) = stream_basic.next().await {
41-
println!("Latest block number (basic): {:?}", block.header.number.unwrap().to_string());
41+
println!("Latest block number (basic): {}", block.header.number.unwrap());
4242
}
4343
});
4444

4545
// Take the bearer stream and print the block number upon receiving a new block.
4646
let bearer_handle = tokio::spawn(async move {
4747
while let Some(block) = stream_bearer.next().await {
48-
println!(
49-
"Latest block number (bearer): {:?}",
50-
block.header.number.unwrap().to_string()
51-
);
48+
println!("Latest block number (bearer): {}", block.header.number.unwrap());
5249
}
5350
});
5451

‎examples/subscriptions/examples/event_multiplexer.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async fn main() -> Result<()> {
5050
// Deploy the `EventExample` contract.
5151
let contract = EventMultiplexer::deploy(provider).await?;
5252

53-
println!("Deployed contract at: {:?}", contract.address());
53+
println!("Deployed contract at: {}", contract.address());
5454

5555
// Create filters for each event.
5656
let add_filter = contract.Add_filter().watch().await?;

‎examples/subscriptions/examples/poll_logs.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async fn main() -> Result<()> {
4040
// Deploy the `Counter` contract.
4141
let contract = Counter::deploy(provider.clone()).await?;
4242

43-
println!("Deployed contract at: {:?}", contract.address());
43+
println!("Deployed contract at: {}", contract.address());
4444

4545
// Create filters for each event.
4646
let increment_filter = contract.Increment_filter().watch().await?;

0 commit comments

Comments
 (0)