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

feat: add alloy-node-bindings #111

Merged
merged 6 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ jobs:
- name: cargo hack
run: |
cargo hack check --workspace --target wasm32-unknown-unknown \
--exclude alloy-transport-ipc \
--exclude alloy-signer \
--exclude alloy-signer-aws \
--exclude alloy-signer-ledger \
--exclude alloy-signer-trezor
--exclude alloy-signer-trezor \
--exclude alloy-test-utils \
--exclude alloy-transport-ipc

feature-checks:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ alloy-signer = { version = "0.1.0", path = "crates/signer" }
alloy-signer-aws = { version = "0.1.0", path = "crates/signer-aws" }
alloy-signer-ledger = { version = "0.1.0", path = "crates/signer-ledger" }
alloy-signer-trezor = { version = "0.1.0", path = "crates/signer-trezor" }
alloy-test-utils = { version = "0.1.0", path = "crates/test-utils" }
alloy-transport = { version = "0.1.0", path = "crates/transport" }
alloy-transport-http = { version = "0.1.0", path = "crates/transport-http" }
alloy-transport-ipc = { version = "0.1.0", path = "crates/transport-ipc" }
Expand Down
2 changes: 1 addition & 1 deletion crates/providers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ reqwest.workspace = true
auto_impl = "1.1.0"

[dev-dependencies]
alloy-test-utils.workspace = true
tokio = { version = "1.33.0", features = ["macros"] }
ethers-core = "2.0.10"

[features]
anvil = []
4 changes: 2 additions & 2 deletions crates/providers/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,14 @@ impl<'a> TryFrom<&'a String> for Provider<Http<Client>> {
}

#[cfg(test)]
mod providers_test {
mod tests {
use crate::{
provider::{Provider, TempProvider},
utils,
};
use alloy_primitives::{address, b256, bytes, U256, U64};
use alloy_rpc_types::{Block, BlockNumberOrTag, Filter};
use ethers_core::utils::Anvil;
use alloy_test_utils::Anvil;

#[tokio::test]
async fn gets_block_number() {
Expand Down
9 changes: 5 additions & 4 deletions crates/rpc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ alloy-transport-ipc = { workspace = true, optional = true }

[dev-dependencies]
alloy-primitives.workspace = true
alloy-test-utils.workspace = true
alloy-transport-ipc = { workspace = true, features = ["mock"] }
alloy-transport-ws.workspace = true

tempfile = "3"
test-log = { version = "0.2.13", default-features = false, features = ["trace"] }
tracing-subscriber = { version = "0.3.17", features = ["std", "env-filter"] }
ethers-core = "2.0.10"
alloy-transport-ipc = { workspace = true, features = ["mock"] }
tempfile = "3"

[features]
default = ["reqwest"]
reqwest = ["dep:url", "dep:reqwest", "alloy-transport-http/reqwest"]
hyper = ["dep:url", "dep:hyper", "alloy-transport-http/hyper"]
pubsub = ["dep:tokio", "dep:alloy-pubsub", "dep:alloy-primitives"]
ws = ["pubsub", "dep:alloy-transport-ws"]
ipc = ["pubsub", "dep:alloy-transport-ipc"]
ipc = ["pubsub", "dep:alloy-transport-ipc"]
2 changes: 1 addition & 1 deletion crates/rpc-client/tests/it/ipc.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use alloy_primitives::U64;
use alloy_pubsub::PubSubFrontend;
use alloy_rpc_client::{ClientBuilder, RpcCall, RpcClient};
use alloy_test_utils::{Geth, GethInstance};
use alloy_transport_ipc::IpcConnect;
use ethers_core::utils::{Geth, GethInstance};
use std::borrow::Cow;
use tempfile::NamedTempFile;

Expand Down
22 changes: 22 additions & 0 deletions crates/test-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "alloy-test-utils"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about the name, because these are not only used for testing, for example run some simulations using anvil.

perhaps alloy-nodes, alloy-node-bindings, alloy-node-commands|cmd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description = "Common Ethereum testing utilities"

version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
exclude.workspace = true

[dependencies]
alloy-primitives = { workspace = true, features = ["k256"] }
k256.workspace = true
serde_json.workspace = true
serde.workspace = true
tempfile.workspace = true

[dev-dependencies]
rand.workspace = true
3 changes: 3 additions & 0 deletions crates/test-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# alloy-test-utils

Common Ethereum testing utilities.
Loading
Loading