Sitelet https://github.com/SharkHand3/examples/commit/66bab275ed10360e05839854af7463ddaf0b972d
Skip to content

Commit 66bab27

Browse files
committed
update wallets
1 parent f6d7945 commit 66bab27

7 files changed

Lines changed: 108 additions & 15 deletions

File tree

‎examples/README.md‎

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Examples
2+
3+
These examples demonstrate the main features of Alloy and how to use them.
4+
To run an example, use the command `cargo run --example <Example>`.
5+
6+
```sh
7+
cargo run --example mnemonic_signer
8+
```
9+
10+
---
11+
12+
## Table of Contents
13+
14+
- [ ] Address book
15+
- [ ] Anvil
16+
- [ ] Boot anvil
17+
- [ ] Deploy contracts
18+
- [ ] Fork
19+
- [ ] Testing
20+
- [ ] Big numbers
21+
- [ ] Comparison and equivalence
22+
- [ ] Conversion
23+
- [ ] Creating Instances
24+
- [ ] Math operations
25+
- [ ] Utilities
26+
- [ ] Contracts
27+
- [ ] Abigen
28+
- [ ] Compile
29+
- [ ] Creating Instances
30+
- [ ] Deploy Anvil
31+
- [ ] Deploy from ABI and bytecode
32+
- [ ] Deploy Moonbeam
33+
- [ ] Events
34+
- [ ] Events with meta
35+
- [ ] Methods
36+
- [ ] Events
37+
- [ ] Logs and filtering
38+
- [ ] Solidity topics
39+
- [ ] Middleware
40+
- [ ] Builder
41+
- [ ] Create custom middleware
42+
- [ ] Gas escalator
43+
- [ ] Gas oracle
44+
- [ ] Nonce manager
45+
- [ ] Policy
46+
- [ ] Signer
47+
- [ ] Time lag
48+
- [ ] Transformer
49+
- [ ] Providers
50+
- [ ] Http
51+
- [ ] IPC
52+
- [ ] Mock
53+
- [ ] Quorum
54+
- [ ] Retry
55+
- [ ] RW
56+
- [ ] WS
57+
- [ ] Queries
58+
- [ ] Blocks
59+
- [ ] Contracts
60+
- [ ] Events
61+
- [ ] Paginated logs
62+
- [ ] UniswapV2 pair
63+
- [ ] Transactions
64+
- [ ] Subscriptions
65+
- [ ] Watch blocks
66+
- [ ] Subscribe events by type
67+
- [ ] Subscribe logs
68+
- [ ] Transactions
69+
- [ ] Call override
70+
- [ ] Create raw transaction
71+
- [ ] Create typed transaction
72+
- [ ] Decode input
73+
- [ ] EIP-1559
74+
- [ ] ENS
75+
- [ ] Estimate gas
76+
- [ ] Get gas price
77+
- [ ] Get gas price USD
78+
- [ ] Remove liquidity
79+
- [ ] Set gas for a transaction
80+
- [ ] Send raw transaction
81+
- [ ] Send typed transaction
82+
- [ ] Trace
83+
- [ ] Transaction receipt
84+
- [ ] Transaction status
85+
- [ ] Transfer ETH
86+
- [ ] Transfer ERC20 token
87+
- [ ] Wallets
88+
- [ ] AWS signer
89+
- [ ] GCP signer
90+
- [x] [Ledger signer](./wallets/examples/ledger_signer.rs)
91+
- [x] [Private key signer](./wallets/examples/private_key_signer.rs)
92+
- [x] [Mnemonic signer](./wallets/examples/mnemonic_signer.rs)
93+
- [x] [Sign message](./wallets/examples/sign_message.rs)
94+
- [x] [Sign permit hash](./wallets/examples/sign_permit_hash.rs)
95+
- [x] [Trezor signer](./wallets/examples/trezor_signer.rs)
96+
- [x] [Yubi signer](./wallets/examples/yubi_signer.rs)
97+
- [ ] Keystore signer

‎examples/wallets/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "examples-wallets"
3+
publish = false
34

45
version.workspace = true
56
edition.workspace = true
@@ -9,7 +10,6 @@ license.workspace = true
910
homepage.workspace = true
1011
repository.workspace = true
1112
exclude.workspace = true
12-
publish.workspace = true
1313

1414
[dev-dependencies]
1515
alloy-network.workspace = true

‎examples/wallets/examples/ledger_signer.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Example of signing and sending a transaction using a Ledger device.
22
3-
use alloy_network::{Ethereum, EthereumSigner};
3+
use alloy_network::EthereumSigner;
44
use alloy_primitives::{address, U256};
55
use alloy_provider::{Provider, ProviderBuilder, RootProvider};
66
use alloy_rpc_client::RpcClient;
@@ -16,9 +16,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1616

1717
// Create a provider with the signer and the network.
1818
let http = Http::<Client>::new("http://localhost:8545".parse()?);
19-
let provider = ProviderBuilder::<_, Ethereum>::new()
19+
let provider = ProviderBuilder::new()
2020
.signer(EthereumSigner::from(signer))
21-
.network::<Ethereum>()
2221
.provider(RootProvider::new(RpcClient::new(http, true)));
2322

2423
// Create a transaction.

‎examples/wallets/examples/mnemonic_signer.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1919
.password(password)
2020
.build()?;
2121

22-
println!("Wallet: {:?}", wallet);
22+
println!("Wallet: {:?}", wallet.address());
2323

2424
// Generate a random wallet (24 word phrase) at custom derivation path
2525
let mut rng = rand::thread_rng();
@@ -31,7 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3131
// .write_to(path)
3232
.build_random(&mut rng)?;
3333

34-
println!("Random wallet: {:?}", wallet);
34+
println!("Random wallet: {:?}", wallet.address());
3535

3636
Ok(())
3737
}

‎examples/wallets/examples/private_key_signer.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Example of using a local wallet to sign and broadcast a transaction on a local Anvil node.
22
3-
use alloy_network::{Ethereum, EthereumSigner};
3+
use alloy_network::EthereumSigner;
44
use alloy_node_bindings::Anvil;
55
use alloy_primitives::{U256, U64};
66
use alloy_provider::{Provider, ProviderBuilder, RootProvider};
@@ -21,9 +21,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2121

2222
// Create a provider with a signer and the network.
2323
let http = Http::<Client>::new(anvil.endpoint().parse()?);
24-
let provider = ProviderBuilder::<_, Ethereum>::new()
24+
let provider = ProviderBuilder::new()
2525
.signer(EthereumSigner::from(alice))
26-
.network::<Ethereum>()
2726
.provider(RootProvider::new(RpcClient::new(http, true)));
2827

2928
// Create a transaction.

‎examples/wallets/examples/trezor_signer.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Example of signing and sending a transaction using a Trezor device.
22
3-
use alloy_network::{Ethereum, EthereumSigner};
3+
use alloy_network::EthereumSigner;
44
use alloy_primitives::{address, U256};
55
use alloy_provider::{Provider, ProviderBuilder, RootProvider};
66
use alloy_rpc_client::RpcClient;
@@ -16,9 +16,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1616

1717
// Create a provider with the signer and the network.
1818
let http = Http::<Client>::new("http://localhost:8545".parse()?);
19-
let provider = ProviderBuilder::<_, Ethereum>::new()
19+
let provider = ProviderBuilder::new()
2020
.signer(EthereumSigner::from(signer))
21-
.network::<Ethereum>()
2221
.provider(RootProvider::new(RpcClient::new(http, true)));
2322

2423
// Create a transaction.

‎examples/wallets/examples/yubi_signer.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Example of signing and sending a transaction using a Yubi device.
22
3-
use alloy_network::{Ethereum, EthereumSigner};
3+
use alloy_network::EthereumSigner;
44
use alloy_primitives::{address, U256};
55
use alloy_provider::{Provider, ProviderBuilder, RootProvider};
66
use alloy_rpc_client::RpcClient;
@@ -25,9 +25,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2525

2626
// Create a provider with the signer and the network.
2727
let http = Http::<Client>::new("http://localhost:8545".parse()?);
28-
let provider = ProviderBuilder::<_, Ethereum>::new()
28+
let provider = ProviderBuilder::new()
2929
.signer(EthereumSigner::from(signer))
30-
.network::<Ethereum>()
3130
.provider(RootProvider::new(RpcClient::new(http, true)));
3231

3332
// Create a transaction.

0 commit comments

Comments
 (0)