Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Debt] Improve alloy prelude crate exports and defaults #39

Merged
merged 10 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ jobs:
sed -i 's/\(alloy = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \
Cargo.toml

# Temporary patch until https://github.com/alloy-rs/alloy/pull/392 is resolved
sed -i 's/\(alloy-rpc-client = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \
examples/providers/Cargo.toml
sed -i 's/\(alloy-provider = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \
examples/providers/Cargo.toml
sed -i 's/\(alloy-rpc-client = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \
examples/subscriptions/Cargo.toml
sed -i 's/\(alloy-provider = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \
examples/subscriptions/Cargo.toml

# Temporary patch until `patch` section in Alloy is removed
sed -i 's/\(alloy-core = { git = "https:\/\/github.com\/alloy-rs\/core", rev = "\)[^"]*/\1'"$latest_alloy_core_commit"'/' \
Cargo.toml
Expand Down
27 changes: 6 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,41 +81,26 @@ unnecessary_struct_initialization = "allow"
use_self = "allow"

[workspace.dependencies]
alloy = { git = "https://github.com/alloy-rs/alloy", rev = "66fa192", features = [
# "dyn-abi",
# "json-abi",
# "json",
"sol-types",
# "rlp",
# "serde",
alloy = { git = "https://github.com/zerosnacks/alloy", branch = "feat/improve-export-flags-alloy-prelude-crate", features = [
zerosnacks marked this conversation as resolved.
Show resolved Hide resolved
"contract",
# "consensus",
# "eips",
"network",
# "genesis",
"node-bindings",
"providers",
"rpc",
# "json-rpc",
"provider-http",
"provider-ipc",
"provider-ws",
"rpc-client",
# "rpc-types",
"rpc-client-ipc",
"rpc-client-ws",
"rpc-types-eth",
# "rpc-types-engine",
"rpc-types-trace",
"signers",
# "signer-aws",
# "signer-gcp",
"signer-keystore",
"signer-ledger",
"signer-mnemonic",
"signer-trezor",
"signer-wallet",
"signer-yubihsm",
"transports",
"transport-http",
"transport-ipc",
"transport-ws",
"pubsub",
] }

# async
Expand Down
9 changes: 0 additions & 9 deletions examples/providers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ workspace = true

[dev-dependencies]
alloy.workspace = true
# Temp dependency fix to enable relevant features - Ref: https://github.com/alloy-rs/examples/pull/3#discussion_r1537842062
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "66fa192", features = [
"pubsub",
] }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "66fa192", features = [
"pubsub",
"ws",
] }


eyre.workspace = true
futures-util = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/providers/examples/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use alloy::{
network::Ethereum,
providers::{Provider, RootProvider},
rpc::client::RpcClient,
transports::ipc::IpcConnect,
};
use alloy_rpc_client::RpcClient;
use eyre::Result;

#[tokio::main]
Expand Down
10 changes: 5 additions & 5 deletions examples/providers/examples/ws.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Example of using the WS provider to subscribe to new blocks.

use alloy::network::Ethereum;
// Temp Fix
use alloy_provider::{Provider, RootProvider};
use alloy_rpc_client::{RpcClient, WsConnect};
//
use alloy::{
network::Ethereum,
providers::{Provider, RootProvider},
rpc::client::{RpcClient, WsConnect},
};
use eyre::Result;
use futures_util::StreamExt;

Expand Down
11 changes: 6 additions & 5 deletions examples/providers/examples/ws_with_auth.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! Example of using the WS provider with auth to subscribe to new blocks.

use alloy::{network::Ethereum, transports::Authorization};
// Temp Fix
use alloy_provider::{Provider, RootProvider};
use alloy_rpc_client::{RpcClient, WsConnect};
//
use alloy::{
network::Ethereum,
providers::{Provider, RootProvider},
rpc::client::{RpcClient, WsConnect},
transports::Authorization,
};
use eyre::Result;
use futures_util::StreamExt;

Expand Down
17 changes: 0 additions & 17 deletions examples/subscriptions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@ workspace = true

[dev-dependencies]
alloy.workspace = true
# Temp fix for enabling features. Ref: https://github.com/alloy-rs/examples/pull/3/#discussion_r1537842062
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "66fa192", features = [
"pubsub",
"ws",
] }
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "66fa192", features = [
"pubsub",
] }
# alloy-contract.workspace = true
# alloy-network.workspace = true
# alloy-node-bindings.workspace = true
# alloy-provider = { workspace = true, features = ["pubsub", "ws"] }
# alloy-pubsub.workspace = true
# alloy-primitives.workspace = true
# alloy-rpc-client.workspace = true
# alloy-rpc-types.workspace = true
# alloy-sol-types = { workspace = true }

eyre.workspace = true
futures-util = "0.3"
Expand Down
12 changes: 9 additions & 3 deletions examples/subscriptions/examples/event_multiplexer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
//! Example of multiplexing the watching of event logs.

use alloy::{network::Ethereum, node_bindings::Anvil, primitives::I256, sol, sol_types::SolEvent};
use alloy_provider::RootProvider;
use alloy_rpc_client::{RpcClient, WsConnect};
use alloy::{
network::Ethereum,
node_bindings::Anvil,
primitives::I256,
providers::RootProvider,
rpc::client::{RpcClient, WsConnect},
sol,
sol_types::SolEvent,
};
use eyre::Result;
use futures_util::StreamExt;
use std::str::FromStr;
Expand Down
11 changes: 7 additions & 4 deletions examples/subscriptions/examples/subscribe_blocks.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
//! Example of subscribing to blocks and watching block headers by polling.

use alloy::{network::Ethereum, node_bindings::Anvil};
use alloy_provider::{Provider, RootProvider};
use alloy_rpc_client::RpcClient;
use alloy::{
network::Ethereum,
node_bindings::Anvil,
providers::{Provider, RootProvider},
rpc::client::{RpcClient, WsConnect},
};
use eyre::Result;
use futures_util::{stream, StreamExt};

Expand All @@ -13,7 +16,7 @@ async fn main() -> Result<()> {
let anvil = Anvil::new().block_time(1).try_spawn()?;

// Create a provider.
let ws = alloy_rpc_client::WsConnect::new(anvil.ws_endpoint());
let ws = WsConnect::new(anvil.ws_endpoint());
let provider = RootProvider::<Ethereum, _>::new(RpcClient::connect_pubsub(ws).await?);

// Subscribe to blocks.
Expand Down
12 changes: 8 additions & 4 deletions examples/subscriptions/examples/watch_contract_event.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
//! Example of watching contract events.

use alloy::{network::Ethereum, node_bindings::Anvil, sol};
use alloy_provider::RootProvider;
use alloy_rpc_client::RpcClient;
use alloy::{
network::Ethereum,
node_bindings::Anvil,
providers::RootProvider,
rpc::client::{RpcClient, WsConnect},
sol,
};
use eyre::Result;
use futures_util::StreamExt;

Expand Down Expand Up @@ -37,7 +41,7 @@ async fn main() -> Result<()> {

// Create a WebSocket provider.
let ws_rpc_url = anvil.ws_endpoint();
let ws = alloy_rpc_client::WsConnect::new(ws_rpc_url);
let ws = WsConnect::new(ws_rpc_url);
let provider = RootProvider::<Ethereum, _>::new(RpcClient::connect_pubsub(ws).await?);

// Deploy the `Counter` contract.
Expand Down
Loading