Skip to content

Commit

Permalink
use alloy namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
zerosnacks committed Mar 21, 2024
1 parent fbf851e commit dd1428d
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 87 deletions.
69 changes: 35 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,42 @@ repository = "https://github.com/alloy-rs/examples"
publish = false

[workspace.dependencies]
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-signer-aws = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-signer-gcp = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-signer-ledger = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-signer-trezor = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", default-features = false }

alloy-core = { version = "0.6.4", default-features = false, features = ["std"] }
alloy-dyn-abi = { version = "0.6.4", default-features = false, features = [
"std",
] }
alloy-json-abi = { version = "0.6.4", default-features = false, features = [
"std",
] }
alloy-primitives = { version = "0.6.4", default-features = false, features = [
"std",
alloy = { git = "https://github.com/alloy-rs/alloy", rev = "fd8f065", features = [
# "dyn-abi",
# "json-abi",
# "json",
# "sol-types",
# "rlp",
# "serde",
"contract",
# "consensus",
# "eips",
"network",
# "genesis",
"node-bindings",
"providers",
"rpc",
# "json-rpc",
"rpc-client",
# "rpc-types",
"rpc-types-eth",
# "rpc-types-engine",
# "rpc-types-trace",
"signers",
# "signer-aws",
# "signer-gcp",
"signer-ledger",
"signer-trezor",
"signer-wallet",
"signer-mnemonic",
"signer-yubihsm",
# "transports",
"transport-http",
# "transport-ipc",
# "transport-ws",
# "pubsub",
] }
# TODO: sol! macro somehow requires this to be present
alloy-sol-types = { version = "0.6.4", default-features = false, features = [
"std",
] }
Expand Down
4 changes: 1 addition & 3 deletions examples/big-numbers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ homepage.workspace = true
repository.workspace = true

[dev-dependencies]
alloy-core.workspace = true
alloy-primitives.workspace = true
alloy-serde.workspace = true
alloy.workspace = true

eyre.workspace = true
2 changes: 1 addition & 1 deletion examples/big-numbers/examples/comparison_equivalence.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example of comparison and equivalence of `U256` instances.
use alloy_primitives::U256;
use alloy::primitives::U256;

/// `U256` implements traits in `std::cmp`, that means `U256` instances
/// can be easily compared using standard Rust operators.
Expand Down
2 changes: 1 addition & 1 deletion examples/big-numbers/examples/conversion.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example of converting `U256` to native Rust types.
use alloy_primitives::{utils::format_units, U256};
use alloy::primitives::{utils::format_units, U256};
use eyre::Result;

/// `U256` provides useful conversion functions to enable transformation into native Rust types.
Expand Down
2 changes: 1 addition & 1 deletion examples/big-numbers/examples/create_instances.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example of creating instances of `U256` from strings and numbers.
use alloy_primitives::{
use alloy::primitives::{
utils::{parse_units, ParseUnits},
U256,
};
Expand Down
2 changes: 1 addition & 1 deletion examples/big-numbers/examples/math_operations.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example of performing arithmetic operations with `U256`.
use alloy_primitives::{utils::format_units, U256};
use alloy::primitives::{utils::format_units, U256};
use eyre::Result;
use std::ops::{Div, Mul};

Expand Down
2 changes: 1 addition & 1 deletion examples/big-numbers/examples/math_utilities.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example of using math utilities to handle big numbers in 'wei' units.
use alloy_primitives::{
use alloy::primitives::{
utils::{format_units, parse_units},
U256,
};
Expand Down
11 changes: 1 addition & 10 deletions examples/wallets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@ homepage.workspace = true
repository.workspace = true

[dev-dependencies]
alloy-network.workspace = true
alloy-node-bindings.workspace = true
alloy-primitives.workspace = true
alloy-provider.workspace = true
alloy-rpc-client.workspace = true
alloy-rpc-types.workspace = true
alloy-signer = { workspace = true, features = ["eip712"] }
alloy-signer-ledger.workspace = true
alloy-signer-trezor.workspace = true
alloy-signer-wallet = { workspace = true, features = ["mnemonic", "yubihsm"] }
alloy.workspace = true
alloy-sol-types.workspace = true

eyre.workspace = true
Expand Down
13 changes: 7 additions & 6 deletions examples/wallets/examples/ledger_signer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! Example of signing and sending a transaction using a Ledger device.
use alloy_network::EthereumSigner;
use alloy_primitives::{address, U256};
use alloy_provider::{Provider, ProviderBuilder};
use alloy_rpc_client::RpcClient;
use alloy_rpc_types::request::TransactionRequest;
use alloy_signer_ledger::{HDPath, LedgerSigner};
use alloy::{
network::EthereumSigner,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
rpc::{client::RpcClient, types::eth::request::TransactionRequest},
signers::ledger::{HDPath, LedgerSigner},
};
use eyre::Result;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/wallets/examples/mnemonic_signer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example of using `MnemonicBuilder` to access a wallet from a mnemonic phrase.
use alloy_signer_wallet::{coins_bip39::English, MnemonicBuilder};
use alloy::signers::wallet::{coins_bip39::English, MnemonicBuilder};
use eyre::Result;

#[tokio::main]
Expand Down
15 changes: 8 additions & 7 deletions examples/wallets/examples/private_key_signer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! Example of using a local wallet to sign and broadcast a transaction on a local Anvil node.
use alloy_network::EthereumSigner;
use alloy_node_bindings::Anvil;
use alloy_primitives::U256;
use alloy_provider::{Provider, ProviderBuilder};
use alloy_rpc_client::RpcClient;
use alloy_rpc_types::request::TransactionRequest;
use alloy_signer_wallet::LocalWallet;
use alloy::{
network::EthereumSigner,
node_bindings::Anvil,
primitives::U256,
providers::{Provider, ProviderBuilder},
rpc::{client::RpcClient, types::eth::request::TransactionRequest},
signers::wallet::LocalWallet,
};
use eyre::Result;

#[tokio::main]
Expand Down
3 changes: 1 addition & 2 deletions examples/wallets/examples/sign_message.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Example of signing a message with a wallet.
use alloy_signer::Signer;
use alloy_signer_wallet::LocalWallet;
use alloy::signers::{wallet::LocalWallet, Signer};
use eyre::Result;

#[tokio::main]
Expand Down
11 changes: 6 additions & 5 deletions examples/wallets/examples/sign_permit_hash.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//! Example of signing a permit hash using a wallet.
use alloy_primitives::{address, keccak256, U256};
use alloy_signer::Signer;
use alloy_signer_wallet::LocalWallet;
use alloy_sol_types::{eip712_domain, sol, SolStruct};
use alloy::{
primitives::{address, keccak256, U256},
signers::{wallet::LocalWallet, Signer},
sol_types::{eip712_domain, sol, SolStruct},
};
use eyre::Result;
use serde::Serialize;

Expand Down Expand Up @@ -43,7 +44,7 @@ async fn main() -> Result<()> {
let hash = permit.eip712_signing_hash(&domain);

// Sign the hash asynchronously with the wallet.
let signature = wallet.sign_typed_data(&permit, &domain).await?;
let signature = wallet.sign_hash(&hash).await?;

println!(
"Recovered address matches wallet address: {:?}",
Expand Down
13 changes: 7 additions & 6 deletions examples/wallets/examples/trezor_signer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! Example of signing and sending a transaction using a Trezor device.
use alloy_network::EthereumSigner;
use alloy_primitives::{address, U256};
use alloy_provider::{Provider, ProviderBuilder};
use alloy_rpc_client::RpcClient;
use alloy_rpc_types::request::TransactionRequest;
use alloy_signer_trezor::{HDPath, TrezorSigner};
use alloy::{
network::EthereumSigner,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
rpc::{client::RpcClient, types::eth::request::TransactionRequest},
signers::trezor::{HDPath, TrezorSigner},
};
use eyre::Result;

#[tokio::main]
Expand Down
17 changes: 9 additions & 8 deletions examples/wallets/examples/yubi_signer.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Example of signing and sending a transaction using a Yubi device.
use alloy_network::EthereumSigner;
use alloy_primitives::{address, U256};
use alloy_provider::{Provider, ProviderBuilder};
use alloy_rpc_client::RpcClient;
use alloy_rpc_types::request::TransactionRequest;
use alloy_signer_wallet::{
yubihsm::{Connector, Credentials, UsbConfig},
YubiWallet,
use alloy::{
network::EthereumSigner,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
rpc::{client::RpcClient, types::eth::request::TransactionRequest},
signers::wallet::{
yubihsm::{Connector, Credentials, UsbConfig},
YubiWallet,
},
};
use eyre::Result;

Expand Down

0 comments on commit dd1428d

Please sign in to comment.