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

feature(rpc): add remaining anvil rpc methods to provider #831

Merged
Merged
Show file tree
Hide file tree
Changes from 8 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: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ url = "2.5"
derive_more = "0.99.17"

## serde
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
serde = { version = "1.0", default-features = false, features = [
zerosnacks marked this conversation as resolved.
Show resolved Hide resolved
"derive",
"alloc",
] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
serde_with = "3.3.0"

Expand Down
4 changes: 3 additions & 1 deletion crates/alloy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ alloy-pubsub = { workspace = true, default-features = false, optional = true }
# rpc
alloy-json-rpc = { workspace = true, default-features = false, optional = true }
alloy-rpc-client = { workspace = true, default-features = false, optional = true }
alloy-rpc-types-anvil = { workspace = true, default-features = false, optional = true }
alloy-rpc-types-beacon = { workspace = true, default-features = false, optional = true }
alloy-rpc-types-engine = { workspace = true, default-features = false, optional = true }
alloy-rpc-types-trace = { workspace = true, default-features = false, optional = true }
Expand Down Expand Up @@ -98,7 +99,7 @@ contract = ["dep:alloy-contract", "dyn-abi", "json-abi", "json", "sol-types"]
eips = ["dep:alloy-eips"]
genesis = ["dep:alloy-genesis"]
network = ["dep:alloy-network"]
node-bindings = ["dep:alloy-node-bindings", "alloy-provider?/anvil"]
node-bindings = ["dep:alloy-node-bindings", "alloy-provider?/anvil-node"]

# providers
providers = ["dep:alloy-provider"]
Expand All @@ -121,6 +122,7 @@ rpc-client = ["rpc", "dep:alloy-rpc-client"]
rpc-client-ws = ["rpc", "alloy-rpc-client?/ws"]
rpc-client-ipc = ["rpc", "alloy-rpc-client?/ipc"]
rpc-types = ["rpc"]
rpc-types-anvil = ["rpc-types", "dep:alloy-rpc-types-anvil"]
rpc-types-eth = ["rpc-types", "dep:alloy-rpc-types"]
rpc-types-beacon = ["rpc-types", "dep:alloy-rpc-types-beacon"]
rpc-types-engine = ["rpc-types", "dep:alloy-rpc-types-engine"]
Expand Down
8 changes: 6 additions & 2 deletions crates/alloy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ pub mod rpc {
/// Ethereum JSON-RPC type definitions.
#[cfg(feature = "rpc-types")]
pub mod types {
#[cfg(feature = "rpc-types-eth")]
#[cfg(feature = "rpc-types-anvil")]
#[doc(inline)]
pub use alloy_rpc_types as eth;
pub use alloy_rpc_types_anvil as anvil;

#[cfg(feature = "rpc-types-beacon")]
#[doc(inline)]
Expand All @@ -139,6 +139,10 @@ pub mod rpc {
#[doc(inline)]
pub use alloy_rpc_types_engine as engine;

#[cfg(feature = "rpc-types-eth")]
#[doc(inline)]
pub use alloy_rpc_types as eth;

#[cfg(feature = "rpc-types-trace")]
#[doc(inline)]
pub use alloy_rpc_types_trace as trace;
Expand Down
2 changes: 1 addition & 1 deletion crates/contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ alloy-pubsub = { workspace = true, optional = true }
alloy-rpc-client = { workspace = true, features = ["pubsub", "ws"] }
alloy-transport-http.workspace = true
alloy-node-bindings.workspace = true
alloy-provider = { workspace = true, features = ["anvil"] }
alloy-provider = { workspace = true, features = ["anvil-node"] }

reqwest.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
Expand Down
9 changes: 8 additions & 1 deletion crates/provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ alloy-network.workspace = true
alloy-node-bindings = { workspace = true, optional = true }
alloy-signer-wallet = { workspace = true, optional = true }
alloy-rpc-client.workspace = true
alloy-rpc-types-anvil = { workspace = true, optional = true }
alloy-rpc-types-trace.workspace = true
alloy-rpc-types.workspace = true
alloy-rpc-types-engine = { workspace = true, optional = true }
Expand Down Expand Up @@ -77,5 +78,11 @@ ipc = ["pubsub", "alloy-rpc-client/ipc", "alloy-transport-ipc"]
reqwest-default-tls = ["alloy-transport-http?/reqwest-default-tls"]
reqwest-rustls-tls = ["alloy-transport-http?/reqwest-rustls-tls"]
reqwest-native-tls = ["alloy-transport-http?/reqwest-native-tls"]
anvil = ["reqwest", "dep:alloy-node-bindings", "dep:alloy-signer-wallet"]
anvil-api = ["dep:alloy-rpc-types-anvil"]
Copy link
Member

Choose a reason for hiding this comment

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

unsure if newlines are from your formatter, or if other formatters would also produce them.

Copy link
Member Author

@zerosnacks zerosnacks Jun 6, 2024

Choose a reason for hiding this comment

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

its my formatter (Even Better TOML extension) with the default configuration

anvil-node = [
"anvil-api",
"reqwest",
"dep:alloy-node-bindings",
"dep:alloy-signer-wallet",
]
engine-api = ["dep:alloy-rpc-types-engine"]
2 changes: 1 addition & 1 deletion crates/provider/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ impl<L, F, N> ProviderBuilder<L, F, N> {

// Enabled when the `anvil` feature is enabled, or when both in test and the
// `reqwest` feature is enabled.
#[cfg(any(test, feature = "anvil"))]
#[cfg(any(test, feature = "anvil-node"))]
impl<L, F> ProviderBuilder<L, F, Ethereum> {
/// Build this provider with anvil, using an Reqwest HTTP transport.
pub fn on_anvil(self) -> F::Provider
Expand Down
Loading
Loading