diff --git a/Cargo.toml b/Cargo.toml index cbb287479a3..77845b67f33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ alloy-node-bindings = { version = "0.1.0", default-features = false, path = "cra alloy-provider = { version = "0.1.0", default-features = false, path = "crates/provider" } alloy-pubsub = { version = "0.1.0", default-features = false, path = "crates/pubsub" } alloy-rpc-client = { version = "0.1.0", default-features = false, path = "crates/rpc-client" } +alloy-rpc-types-eth = { version = "0.1.0", default-features = false, path = "crates/rpc-types-eth" } alloy-rpc-types-engine = { version = "0.1.0", default-features = false, path = "crates/rpc-types-engine" } alloy-rpc-types-anvil = { version = "0.1.0", default-features = false, path = "crates/rpc-types-anvil" } alloy-rpc-types-beacon = { version = "0.1.0", default-features = false, path = "crates/rpc-types-beacon" } @@ -119,7 +120,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 = [ + "derive", + "alloc", +] } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } serde_with = "3.3.0" diff --git a/crates/alloy/Cargo.toml b/crates/alloy/Cargo.toml index 1cfa4443cb2..4ef665abf3f 100644 --- a/crates/alloy/Cargo.toml +++ b/crates/alloy/Cargo.toml @@ -35,10 +35,6 @@ 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 } alloy-rpc-types = { workspace = true, default-features = false, optional = true } # serde @@ -121,16 +117,13 @@ json-rpc = ["rpc", "dep:alloy-json-rpc"] 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"] -rpc-types-json = [ - "alloy-rpc-types?/jsonrpsee-types", - "alloy-rpc-types-engine?/jsonrpsee-types", -] -rpc-types-trace = ["rpc-types", "dep:alloy-rpc-types-trace"] +rpc-types = ["rpc", "dep:alloy-rpc-types", "alloy-rpc-types?/eth"] +rpc-types-anvil = ["rpc-types", "alloy-rpc-types?/anvil"] +rpc-types-beacon = ["rpc-types", "alloy-rpc-types?/beacon"] +rpc-types-engine = ["rpc-types", "alloy-rpc-types?/engine"] +rpc-types-eth = ["rpc-types", "alloy-rpc-types?/eth"] +rpc-types-json = ["rpc-types", "alloy-rpc-types?/jsonrpsee-types"] +rpc-types-trace = ["rpc-types", "alloy-rpc-types?/trace"] # signers signers = ["dep:alloy-signer"] @@ -172,15 +165,20 @@ getrandom = ["alloy-core/getrandom"] rand = ["alloy-core/rand"] rlp = ["alloy-core/rlp"] serde = ["alloy-core/serde", "alloy-eips?/serde", "alloy-serde"] -ssz = ["alloy-core/ssz", "alloy-rpc-types?/ssz", "alloy-rpc-types-engine?/ssz"] +ssz = ["alloy-core/ssz", "alloy-rpc-types?/ssz"] arbitrary = [ "alloy-core/arbitrary", "alloy-consensus?/arbitrary", "alloy-eips?/arbitrary", "alloy-rpc-types?/arbitrary", ] -k256 = ["alloy-core/k256", "alloy-consensus?/k256", "alloy-network?/k256"] -kzg = ["alloy-consensus?/kzg"] +k256 = [ + "alloy-core/k256", + "alloy-consensus?/k256", + "alloy-network?/k256", + "alloy-rpc-types?/k256", +] +kzg = ["alloy-consensus?/kzg", "alloy-rpc-types?/kzg"] eip712 = [ "alloy-core/eip712", "alloy-signer?/eip712", diff --git a/crates/alloy/src/lib.rs b/crates/alloy/src/lib.rs index ab4bac83ef6..42b89275c50 100644 --- a/crates/alloy/src/lib.rs +++ b/crates/alloy/src/lib.rs @@ -126,27 +126,8 @@ pub mod rpc { /// Ethereum JSON-RPC type definitions. #[cfg(feature = "rpc-types")] - pub mod types { - #[cfg(feature = "rpc-types-anvil")] - #[doc(inline)] - pub use alloy_rpc_types_anvil as anvil; - - #[cfg(feature = "rpc-types-beacon")] - #[doc(inline)] - pub use alloy_rpc_types_beacon as beacon; - - #[cfg(feature = "rpc-types-engine")] - #[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; - } + #[doc(inline)] + pub use alloy_rpc_types as types; } #[cfg(feature = "serde")] diff --git a/crates/contract/Cargo.toml b/crates/contract/Cargo.toml index db8182c08af..2284a371a03 100644 --- a/crates/contract/Cargo.toml +++ b/crates/contract/Cargo.toml @@ -17,7 +17,7 @@ workspace = true [dependencies] alloy-network.workspace = true alloy-provider.workspace = true -alloy-rpc-types.workspace = true +alloy-rpc-types-eth.workspace = true alloy-transport.workspace = true alloy-dyn-abi = { workspace = true, features = ["std"] } diff --git a/crates/contract/src/call.rs b/crates/contract/src/call.rs index 0cec8645fa3..da487a8d082 100644 --- a/crates/contract/src/call.rs +++ b/crates/contract/src/call.rs @@ -4,7 +4,7 @@ use alloy_json_abi::Function; use alloy_network::{Ethereum, Network, ReceiptResponse, TransactionBuilder}; use alloy_primitives::{Address, Bytes, ChainId, TxKind, U256}; use alloy_provider::{PendingTransactionBuilder, Provider}; -use alloy_rpc_types::{state::StateOverride, AccessList, BlobTransactionSidecar, BlockId}; +use alloy_rpc_types_eth::{state::StateOverride, AccessList, BlobTransactionSidecar, BlockId}; use alloy_sol_types::SolCall; use alloy_transport::Transport; use std::{ @@ -546,7 +546,7 @@ mod tests { use alloy_provider::{ layers::AnvilProvider, Provider, ProviderBuilder, RootProvider, WalletProvider, }; - use alloy_rpc_types::AccessListItem; + use alloy_rpc_types_eth::AccessListItem; use alloy_sol_types::sol; use alloy_transport_http::Http; use reqwest::Client; diff --git a/crates/contract/src/eth_call.rs b/crates/contract/src/eth_call.rs index f61ff931a64..3c601a62d20 100644 --- a/crates/contract/src/eth_call.rs +++ b/crates/contract/src/eth_call.rs @@ -4,7 +4,7 @@ use alloy_dyn_abi::{DynSolValue, FunctionExt}; use alloy_json_abi::Function; use alloy_network::Network; use alloy_primitives::Bytes; -use alloy_rpc_types::{state::StateOverride, BlockId}; +use alloy_rpc_types_eth::{state::StateOverride, BlockId}; use alloy_sol_types::SolCall; use alloy_transport::Transport; diff --git a/crates/contract/src/event.rs b/crates/contract/src/event.rs index 3307acb6366..4112a24e375 100644 --- a/crates/contract/src/event.rs +++ b/crates/contract/src/event.rs @@ -2,7 +2,7 @@ use crate::Error; use alloy_network::Ethereum; use alloy_primitives::{Address, LogData}; use alloy_provider::{FilterPollerBuilder, Network, Provider}; -use alloy_rpc_types::{Filter, Log}; +use alloy_rpc_types_eth::{Filter, Log}; use alloy_sol_types::SolEvent; use alloy_transport::{Transport, TransportResult}; use futures::Stream; diff --git a/crates/contract/src/instance.rs b/crates/contract/src/instance.rs index 582a4967ac7..5b9f3e5f483 100644 --- a/crates/contract/src/instance.rs +++ b/crates/contract/src/instance.rs @@ -4,7 +4,7 @@ use alloy_json_abi::{Function, JsonAbi}; use alloy_network::{Ethereum, Network}; use alloy_primitives::{Address, Selector}; use alloy_provider::Provider; -use alloy_rpc_types::Filter; +use alloy_rpc_types_eth::Filter; use alloy_sol_types::SolEvent; use alloy_transport::Transport; use std::marker::PhantomData; diff --git a/crates/network/Cargo.toml b/crates/network/Cargo.toml index 926befb65ab..3fc9ed18289 100644 --- a/crates/network/Cargo.toml +++ b/crates/network/Cargo.toml @@ -19,7 +19,7 @@ alloy-consensus = { workspace = true, features = ["std"] } alloy-eips = { workspace = true, features = ["serde"] } alloy-json-rpc.workspace = true alloy-primitives.workspace = true -alloy-rpc-types.workspace = true +alloy-rpc-types-eth.workspace = true alloy-signer.workspace = true alloy-sol-types.workspace = true diff --git a/crates/network/src/any/builder.rs b/crates/network/src/any/builder.rs index ebbeb75e333..05867896e25 100644 --- a/crates/network/src/any/builder.rs +++ b/crates/network/src/any/builder.rs @@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut}; use alloy_consensus::BlobTransactionSidecar; use alloy_primitives::Bytes; -use alloy_rpc_types::{AccessList, TransactionRequest, WithOtherFields}; +use alloy_rpc_types_eth::{AccessList, TransactionRequest, WithOtherFields}; use crate::{any::AnyNetwork, BuildResult, Network, TransactionBuilder, TransactionBuilderError}; diff --git a/crates/network/src/any/mod.rs b/crates/network/src/any/mod.rs index 24b823bc6bf..5976bd593b6 100644 --- a/crates/network/src/any/mod.rs +++ b/crates/network/src/any/mod.rs @@ -3,7 +3,7 @@ use core::fmt; use crate::{Network, ReceiptResponse, TransactionResponse}; use alloy_consensus::TxType; use alloy_eips::eip2718::Eip2718Error; -use alloy_rpc_types::{ +use alloy_rpc_types_eth::{ AnyTransactionReceipt, Header, Transaction, TransactionRequest, WithOtherFields, }; diff --git a/crates/network/src/ethereum/builder.rs b/crates/network/src/ethereum/builder.rs index a8f958e7964..74913e957e7 100644 --- a/crates/network/src/ethereum/builder.rs +++ b/crates/network/src/ethereum/builder.rs @@ -3,7 +3,7 @@ use crate::{ }; use alloy_consensus::{BlobTransactionSidecar, TxType, TypedTransaction}; use alloy_primitives::{Address, Bytes, ChainId, TxKind, U256}; -use alloy_rpc_types::{request::TransactionRequest, AccessList}; +use alloy_rpc_types_eth::{request::TransactionRequest, AccessList}; impl TransactionBuilder for TransactionRequest { fn chain_id(&self) -> Option { @@ -186,7 +186,7 @@ mod tests { use crate::{TransactionBuilder, TransactionBuilderError}; use alloy_consensus::{BlobTransactionSidecar, TxEip1559, TxType, TypedTransaction}; use alloy_primitives::Address; - use alloy_rpc_types::{AccessList, TransactionRequest}; + use alloy_rpc_types_eth::{AccessList, TransactionRequest}; #[test] fn from_eip1559_to_tx_req() { diff --git a/crates/network/src/ethereum/mod.rs b/crates/network/src/ethereum/mod.rs index 1cd309114a9..d4bb51f057b 100644 --- a/crates/network/src/ethereum/mod.rs +++ b/crates/network/src/ethereum/mod.rs @@ -22,22 +22,22 @@ impl Network for Ethereum { type Header = alloy_consensus::Header; - type TransactionRequest = alloy_rpc_types::transaction::TransactionRequest; + type TransactionRequest = alloy_rpc_types_eth::transaction::TransactionRequest; - type TransactionResponse = alloy_rpc_types::Transaction; + type TransactionResponse = alloy_rpc_types_eth::Transaction; - type ReceiptResponse = alloy_rpc_types::TransactionReceipt; + type ReceiptResponse = alloy_rpc_types_eth::TransactionReceipt; - type HeaderResponse = alloy_rpc_types::Header; + type HeaderResponse = alloy_rpc_types_eth::Header; } -impl ReceiptResponse for alloy_rpc_types::TransactionReceipt { +impl ReceiptResponse for alloy_rpc_types_eth::TransactionReceipt { fn contract_address(&self) -> Option { self.contract_address } } -impl TransactionResponse for alloy_rpc_types::Transaction { +impl TransactionResponse for alloy_rpc_types_eth::Transaction { #[doc(alias = "transaction_hash")] fn tx_hash(&self) -> alloy_primitives::B256 { self.hash diff --git a/crates/network/src/ethereum/signer.rs b/crates/network/src/ethereum/signer.rs index 7fe4bfde546..049d4c5f74f 100644 --- a/crates/network/src/ethereum/signer.rs +++ b/crates/network/src/ethereum/signer.rs @@ -45,7 +45,7 @@ impl EthereumSigner { /// [`TransactionRequest`] and [`TypedTransaction`] object that specify the /// signer's address in the `from` field. /// - /// [`TransactionRequest`]: alloy_rpc_types::TransactionRequest + /// [`TransactionRequest`]: alloy_rpc_types_eth::TransactionRequest pub fn register_signer(&mut self, signer: S) where S: TxSigner + Send + Sync + 'static, @@ -58,7 +58,7 @@ impl EthereumSigner { /// [`TypedTransaction`] objects that do not specify a signer address in the /// `from` field. /// - /// [`TransactionRequest`]: alloy_rpc_types::TransactionRequest + /// [`TransactionRequest`]: alloy_rpc_types_eth::TransactionRequest pub fn register_default_signer(&mut self, signer: S) where S: TxSigner + Send + Sync + 'static, diff --git a/crates/network/src/transaction/builder.rs b/crates/network/src/transaction/builder.rs index 50abc65028d..d2bbdbb2334 100644 --- a/crates/network/src/transaction/builder.rs +++ b/crates/network/src/transaction/builder.rs @@ -2,7 +2,7 @@ use super::signer::NetworkSigner; use crate::Network; use alloy_consensus::BlobTransactionSidecar; use alloy_primitives::{Address, Bytes, ChainId, TxKind, U256}; -use alloy_rpc_types::AccessList; +use alloy_rpc_types_eth::AccessList; use alloy_sol_types::SolCall; use futures_utils_wasm::impl_future; diff --git a/crates/provider/Cargo.toml b/crates/provider/Cargo.toml index 77d5e668b6a..1f58fd376af 100644 --- a/crates/provider/Cargo.toml +++ b/crates/provider/Cargo.toml @@ -23,8 +23,8 @@ 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-eth.workspace = true alloy-rpc-types-trace.workspace = true -alloy-rpc-types.workspace = true alloy-rpc-types-engine = { workspace = true, optional = true } alloy-transport-http = { workspace = true, optional = true } alloy-transport-ipc = { workspace = true, optional = true } diff --git a/crates/provider/src/chain.rs b/crates/provider/src/chain.rs index 7e7ccf5c3e8..75593351051 100644 --- a/crates/provider/src/chain.rs +++ b/crates/provider/src/chain.rs @@ -2,7 +2,7 @@ use crate::{Provider, RootProvider}; use alloy_network::{Ethereum, Network}; use alloy_primitives::{BlockNumber, U64}; use alloy_rpc_client::{PollerBuilder, WeakClient}; -use alloy_rpc_types::Block; +use alloy_rpc_types_eth::Block; use alloy_transport::{RpcError, Transport}; use async_stream::stream; use futures::{Stream, StreamExt}; diff --git a/crates/provider/src/ext/admin.rs b/crates/provider/src/ext/admin.rs index b206ad362f6..f405efbbd64 100644 --- a/crates/provider/src/ext/admin.rs +++ b/crates/provider/src/ext/admin.rs @@ -1,7 +1,7 @@ //! This module extends the Ethereum JSON-RPC provider with the Admin namespace's RPC methods. use crate::Provider; use alloy_network::Network; -use alloy_rpc_types::admin::{NodeInfo, PeerInfo}; +use alloy_rpc_types_eth::admin::{NodeInfo, PeerInfo}; use alloy_transport::{Transport, TransportResult}; /// Admin namespace rpc interface that gives access to several non-standard RPC methods. diff --git a/crates/provider/src/ext/anvil.rs b/crates/provider/src/ext/anvil.rs index 274f5fdde48..016ff780aa4 100644 --- a/crates/provider/src/ext/anvil.rs +++ b/crates/provider/src/ext/anvil.rs @@ -2,8 +2,8 @@ use crate::Provider; use alloy_network::Network; use alloy_primitives::{Address, Bytes, TxHash, B256, U256}; -use alloy_rpc_types::{Block, TransactionRequest, WithOtherFields}; use alloy_rpc_types_anvil::{Forking, Metadata, MineOptions, NodeInfo}; +use alloy_rpc_types_eth::{Block, TransactionRequest, WithOtherFields}; use alloy_transport::{Transport, TransportResult}; /// Anvil namespace rpc interface that gives access to several non-standard RPC methods. diff --git a/crates/provider/src/ext/debug.rs b/crates/provider/src/ext/debug.rs index 641a69cea00..0284a5c4db1 100644 --- a/crates/provider/src/ext/debug.rs +++ b/crates/provider/src/ext/debug.rs @@ -2,7 +2,7 @@ use crate::Provider; use alloy_network::Network; use alloy_primitives::{TxHash, B256}; -use alloy_rpc_types::{BlockNumberOrTag, TransactionRequest}; +use alloy_rpc_types_eth::{BlockNumberOrTag, TransactionRequest}; use alloy_rpc_types_trace::geth::{ GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult, }; diff --git a/crates/provider/src/ext/txpool.rs b/crates/provider/src/ext/txpool.rs index de9d5856677..ba6914b48e1 100644 --- a/crates/provider/src/ext/txpool.rs +++ b/crates/provider/src/ext/txpool.rs @@ -2,7 +2,7 @@ use crate::Provider; use alloy_network::{Ethereum, Network}; use alloy_primitives::Address; -use alloy_rpc_types::txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus}; +use alloy_rpc_types_eth::txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus}; use alloy_transport::{Transport, TransportResult}; /// Txpool namespace rpc interface. diff --git a/crates/provider/src/fillers/chain_id.rs b/crates/provider/src/fillers/chain_id.rs index 0ec027582ef..5184aedc40b 100644 --- a/crates/provider/src/fillers/chain_id.rs +++ b/crates/provider/src/fillers/chain_id.rs @@ -22,7 +22,7 @@ use crate::{ /// /// ``` /// # use alloy_network::{NetworkSigner, EthereumSigner, Ethereum}; -/// # use alloy_rpc_types::TransactionRequest; +/// # use alloy_rpc_types_eth::TransactionRequest; /// # use alloy_provider::{ProviderBuilder, RootProvider, Provider}; /// # async fn test + Clone>(url: url::Url, signer: S) -> Result<(), Box> { /// let provider = ProviderBuilder::new() diff --git a/crates/provider/src/fillers/gas.rs b/crates/provider/src/fillers/gas.rs index 0350cc932a2..53f538fa916 100644 --- a/crates/provider/src/fillers/gas.rs +++ b/crates/provider/src/fillers/gas.rs @@ -8,7 +8,7 @@ use crate::{ }; use alloy_json_rpc::RpcError; use alloy_network::{Network, TransactionBuilder}; -use alloy_rpc_types::BlockNumberOrTag; +use alloy_rpc_types_eth::BlockNumberOrTag; use alloy_transport::{Transport, TransportResult}; use futures::FutureExt; @@ -50,7 +50,7 @@ pub enum GasFillable { /// /// ``` /// # use alloy_network::{NetworkSigner, EthereumSigner, Ethereum}; -/// # use alloy_rpc_types::TransactionRequest; +/// # use alloy_rpc_types_eth::TransactionRequest; /// # use alloy_provider::{ProviderBuilder, RootProvider, Provider}; /// # async fn test + Clone>(url: url::Url, signer: S) -> Result<(), Box> { /// let provider = ProviderBuilder::new() @@ -256,7 +256,7 @@ mod tests { use super::*; use crate::{ProviderBuilder, WalletProvider}; use alloy_primitives::{address, U256}; - use alloy_rpc_types::TransactionRequest; + use alloy_rpc_types_eth::TransactionRequest; #[tokio::test] async fn no_gas_price_or_limit() { diff --git a/crates/provider/src/fillers/join_fill.rs b/crates/provider/src/fillers/join_fill.rs index c4c693b65fd..7aee2419e59 100644 --- a/crates/provider/src/fillers/join_fill.rs +++ b/crates/provider/src/fillers/join_fill.rs @@ -11,7 +11,7 @@ use futures::try_join; /// information by joining two [`TxFiller`]s. This struct is itself a /// [`TxFiller`], and can be nested to compose any number of fill layers. /// -/// [`TransactionRequest`]: alloy_rpc_types::TransactionRequest +/// [`TransactionRequest`]: alloy_rpc_types_eth::TransactionRequest #[derive(Clone, Copy, Debug)] pub struct JoinFill { left: L, diff --git a/crates/provider/src/fillers/nonce.rs b/crates/provider/src/fillers/nonce.rs index 356cb950512..37ea60e6eae 100644 --- a/crates/provider/src/fillers/nonce.rs +++ b/crates/provider/src/fillers/nonce.rs @@ -28,7 +28,7 @@ use tokio::sync::Mutex; /// /// ``` /// # use alloy_network::{NetworkSigner, EthereumSigner, Ethereum}; -/// # use alloy_rpc_types::TransactionRequest; +/// # use alloy_rpc_types_eth::TransactionRequest; /// # use alloy_provider::{ProviderBuilder, RootProvider, Provider}; /// # async fn test + Clone>(url: url::Url, signer: S) -> Result<(), Box> { /// let provider = ProviderBuilder::new() @@ -118,7 +118,7 @@ mod tests { use super::*; use crate::{ProviderBuilder, WalletProvider}; use alloy_primitives::{address, U256}; - use alloy_rpc_types::TransactionRequest; + use alloy_rpc_types_eth::TransactionRequest; #[tokio::test] async fn no_nonce_if_sender_unset() { diff --git a/crates/provider/src/fillers/signer.rs b/crates/provider/src/fillers/signer.rs index dfa03b8abe9..20a232f8912 100644 --- a/crates/provider/src/fillers/signer.rs +++ b/crates/provider/src/fillers/signer.rs @@ -15,7 +15,7 @@ use super::{FillerControlFlow, TxFiller}; /// /// ``` /// # use alloy_network::{NetworkSigner, EthereumSigner, Ethereum}; -/// # use alloy_rpc_types::TransactionRequest; +/// # use alloy_rpc_types_eth::TransactionRequest; /// # use alloy_provider::{ProviderBuilder, RootProvider, Provider}; /// # async fn test + Clone>(url: url::Url, signer: S) -> Result<(), Box> { /// let provider = ProviderBuilder::new() @@ -109,7 +109,7 @@ where mod tests { use crate::{Provider, ProviderBuilder}; use alloy_primitives::{address, b256, U256}; - use alloy_rpc_types::TransactionRequest; + use alloy_rpc_types_eth::TransactionRequest; #[tokio::test] async fn poc() { diff --git a/crates/provider/src/heart.rs b/crates/provider/src/heart.rs index a11ca91368b..346ce00486c 100644 --- a/crates/provider/src/heart.rs +++ b/crates/provider/src/heart.rs @@ -4,7 +4,7 @@ use crate::{Provider, RootProvider}; use alloy_json_rpc::RpcError; use alloy_network::Network; use alloy_primitives::B256; -use alloy_rpc_types::Block; +use alloy_rpc_types_eth::Block; use alloy_transport::{utils::Spawnable, Transport, TransportErrorKind, TransportResult}; use futures::{stream::StreamExt, FutureExt, Stream}; use std::{ @@ -25,7 +25,7 @@ use tokio::{ /// Send and wait for a transaction to be confirmed 2 times, with a timeout of 60 seconds: /// /// ```no_run -/// # async fn example(provider: impl alloy_provider::Provider, tx: alloy_rpc_types::transaction::TransactionRequest) -> Result<(), Box> { +/// # async fn example(provider: impl alloy_provider::Provider, tx: alloy_rpc_types_eth::transaction::TransactionRequest) -> Result<(), Box> { /// // Send a transaction, and configure the pending transaction. /// let builder = provider.send_transaction(tx) /// .await? @@ -41,7 +41,7 @@ use tokio::{ /// /// This can also be more concisely written using `watch`: /// ```no_run -/// # async fn example(provider: impl alloy_provider::Provider, tx: alloy_rpc_types::transaction::TransactionRequest) -> Result<(), Box> { +/// # async fn example(provider: impl alloy_provider::Provider, tx: alloy_rpc_types_eth::transaction::TransactionRequest) -> Result<(), Box> { /// let tx_hash = provider.send_transaction(tx) /// .await? /// .with_required_confirmations(2) diff --git a/crates/provider/src/provider/call.rs b/crates/provider/src/provider/call.rs index 608e636a04a..fffb7009075 100644 --- a/crates/provider/src/provider/call.rs +++ b/crates/provider/src/provider/call.rs @@ -2,7 +2,7 @@ use alloy_eips::BlockId; use alloy_json_rpc::RpcReturn; use alloy_network::Network; use alloy_rpc_client::{RpcCall, WeakClient}; -use alloy_rpc_types::state::StateOverride; +use alloy_rpc_types_eth::state::StateOverride; use alloy_transport::{Transport, TransportErrorKind, TransportResult}; use futures::FutureExt; use serde::ser::SerializeSeq; diff --git a/crates/provider/src/provider/trait.rs b/crates/provider/src/provider/trait.rs index dc3146c7630..7d18ee02ca8 100644 --- a/crates/provider/src/provider/trait.rs +++ b/crates/provider/src/provider/trait.rs @@ -13,7 +13,7 @@ use alloy_primitives::{ U256, U64, }; use alloy_rpc_client::{ClientRef, PollerBuilder, RpcCall, WeakClient}; -use alloy_rpc_types::{ +use alloy_rpc_types_eth::{ AccessListWithGasUsed, Block, BlockId, BlockNumberOrTag, BlockTransactionsKind, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Log, SyncStatus, }; @@ -202,7 +202,7 @@ pub trait Provider: /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { /// use futures::StreamExt; /// use alloy_primitives::keccak256; - /// use alloy_rpc_types::Filter; + /// use alloy_rpc_types_eth::Filter; /// /// let signature = keccak256("Transfer(address,address,uint256)".as_bytes()); /// @@ -344,7 +344,7 @@ pub trait Provider: /// ```no_run /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { /// use alloy_primitives::{address, b256}; - /// use alloy_rpc_types::Filter; + /// use alloy_rpc_types_eth::Filter; /// use futures::StreamExt; /// /// let address = address!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"); @@ -462,7 +462,7 @@ pub trait Provider: /// See [`PendingTransactionBuilder`](crate::PendingTransactionBuilder) for more examples. /// /// ```no_run - /// # async fn example(provider: impl alloy_provider::Provider, tx: alloy_rpc_types::transaction::TransactionRequest) -> Result<(), Box> { + /// # async fn example(provider: impl alloy_provider::Provider, tx: alloy_rpc_types_eth::transaction::TransactionRequest) -> Result<(), Box> { /// let tx_hash = provider.send_transaction(tx) /// .await? /// .with_required_confirmations(2) @@ -710,20 +710,20 @@ pub trait Provider: /// or block ID is provided, the call will be executed on the latest block /// with the current state. /// - /// [`StateOverride`]: alloy_rpc_types::state::StateOverride + /// [`StateOverride`]: alloy_rpc_types_eth::state::StateOverride /// /// ## Example /// /// ``` /// # use alloy_provider::Provider; /// # use alloy_eips::BlockId; - /// # use alloy_rpc_types::state::StateOverride; + /// # use alloy_rpc_types_eth::state::StateOverride; /// # use alloy_transport::BoxTransport; /// # async fn example>( /// # provider: P, /// # my_overrides: StateOverride /// # ) -> Result<(), Box> { - /// # let tx = alloy_rpc_types::transaction::TransactionRequest::default(); + /// # let tx = alloy_rpc_types_eth::transaction::TransactionRequest::default(); /// // Execute a call on the latest block, with no state overrides /// let output = provider.call(&tx).await?; /// // Execute a call with a block ID. @@ -762,7 +762,7 @@ pub trait Provider: /// or block ID is provided, the gas estimate will be computed for the latest block /// with the current state. /// - /// [`StateOverride`]: alloy_rpc_types::state::StateOverride + /// [`StateOverride`]: alloy_rpc_types_eth::state::StateOverride /// /// # Note /// @@ -840,7 +840,7 @@ pub trait Provider: /// /// ```no_run /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { - /// use alloy_rpc_types::BlockNumberOrTag; + /// use alloy_rpc_types_eth::BlockNumberOrTag; /// /// // No parameters: `()` /// let block_number = provider.raw_request("eth_blockNumber".into(), ()).await?; @@ -868,7 +868,7 @@ pub trait Provider: /// /// ```no_run /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { - /// use alloy_rpc_types::BlockNumberOrTag; + /// use alloy_rpc_types_eth::BlockNumberOrTag; /// /// // No parameters: `()` /// let params = serde_json::value::to_raw_value(&())?; @@ -932,7 +932,7 @@ mod tests { use crate::{ProviderBuilder, WalletProvider}; use alloy_node_bindings::Anvil; use alloy_primitives::{address, b256, bytes}; - use alloy_rpc_types::request::TransactionRequest; + use alloy_rpc_types_eth::request::TransactionRequest; fn init_tracing() { let _ = tracing_subscriber::fmt::try_init(); diff --git a/crates/rpc-types-engine/Cargo.toml b/crates/rpc-types-engine/Cargo.toml index 436aa17d175..13b8fb93ec4 100644 --- a/crates/rpc-types-engine/Cargo.toml +++ b/crates/rpc-types-engine/Cargo.toml @@ -19,7 +19,7 @@ workspace = true alloy-rlp = { workspace = true, features = ["arrayvec", "derive"] } alloy-primitives = { workspace = true, features = ["rlp", "serde"] } alloy-consensus = { workspace = true, features = ["std"] } -alloy-rpc-types.workspace = true +alloy-rpc-types-eth.workspace = true alloy-serde.workspace = true alloy-eips = { workspace = true, features = ["serde"] } @@ -43,7 +43,6 @@ ssz = [ "dep:ethereum_ssz", "dep:ethereum_ssz_derive", "alloy-primitives/ssz", - "alloy-rpc-types/ssz", "alloy-eips/ssz", ] kzg = ["alloy-consensus/kzg"] diff --git a/crates/rpc-types-engine/src/payload.rs b/crates/rpc-types-engine/src/payload.rs index 2353c206954..b9f3248f4e5 100644 --- a/crates/rpc-types-engine/src/payload.rs +++ b/crates/rpc-types-engine/src/payload.rs @@ -2,7 +2,7 @@ use alloy_consensus::{Blob, Bytes48}; use alloy_eips::{eip6110::DepositRequest, eip7002::WithdrawalRequest}; use alloy_primitives::{Address, Bloom, Bytes, B256, B64, U256}; -use alloy_rpc_types::{transaction::BlobTransactionSidecar, Withdrawal}; +use alloy_rpc_types_eth::{transaction::BlobTransactionSidecar, Withdrawal}; use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer}; use std::fmt; diff --git a/crates/rpc-types-eth/Cargo.toml b/crates/rpc-types-eth/Cargo.toml new file mode 100644 index 00000000000..93ec0a938f6 --- /dev/null +++ b/crates/rpc-types-eth/Cargo.toml @@ -0,0 +1,65 @@ +[package] +name = "alloy-rpc-types-eth" +description = "Ethereum RPC-related types" + +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 + +[lints] +workspace = true + +[dependencies] +alloy-rlp = { workspace = true, features = ["arrayvec", "derive"] } +alloy-primitives = { workspace = true, features = ["rlp", "serde", "std"] } +alloy-serde.workspace = true +alloy-genesis.workspace = true + +alloy-consensus = { workspace = true, features = ["std", "serde"] } +alloy-eips = { workspace = true, features = ["std", "serde"] } + +itertools.workspace = true +serde = { workspace = true, features = ["derive"] } +serde_json.workspace = true +thiserror.workspace = true + +# arbitrary +arbitrary = { version = "1.3", features = ["derive"], optional = true } +proptest = { version = "1.4", optional = true } +proptest-derive = { version = "0.4", optional = true } + +# jsonrpsee +jsonrpsee-types = { version = "0.22", optional = true } +alloy-sol-types.workspace = true + +[dev-dependencies] +alloy-primitives = { workspace = true, features = [ + "rand", + "rlp", + "serde", + "arbitrary", +] } +alloy-consensus = { workspace = true, features = ["std", "arbitrary"] } + +arbitrary = { workspace = true, features = ["derive"] } +proptest.workspace = true +proptest-derive.workspace = true +rand.workspace = true +similar-asserts.workspace = true + +[features] +arbitrary = [ + "dep:arbitrary", + "dep:proptest-derive", + "dep:proptest", + "alloy-primitives/arbitrary", + "alloy-eips/arbitrary", +] +jsonrpsee-types = ["dep:jsonrpsee-types"] +ssz = ["alloy-primitives/ssz", "alloy-eips/ssz"] +k256 = ["alloy-consensus/k256"] diff --git a/crates/rpc-types-eth/README.md b/crates/rpc-types-eth/README.md new file mode 100644 index 00000000000..8db1340655c --- /dev/null +++ b/crates/rpc-types-eth/README.md @@ -0,0 +1,3 @@ +# alloy-rpc-types-eth + +Ethereum RPC-related types for Alloy. diff --git a/crates/rpc-types/src/eth/account.rs b/crates/rpc-types-eth/src/account.rs similarity index 100% rename from crates/rpc-types/src/eth/account.rs rename to crates/rpc-types-eth/src/account.rs diff --git a/crates/rpc-types/src/eth/admin.rs b/crates/rpc-types-eth/src/admin.rs similarity index 100% rename from crates/rpc-types/src/eth/admin.rs rename to crates/rpc-types-eth/src/admin.rs diff --git a/crates/rpc-types/src/eth/block.rs b/crates/rpc-types-eth/src/block.rs similarity index 100% rename from crates/rpc-types/src/eth/block.rs rename to crates/rpc-types-eth/src/block.rs diff --git a/crates/rpc-types/src/eth/call.rs b/crates/rpc-types-eth/src/call.rs similarity index 100% rename from crates/rpc-types/src/eth/call.rs rename to crates/rpc-types-eth/src/call.rs diff --git a/crates/rpc-types/src/eth/error.rs b/crates/rpc-types-eth/src/error.rs similarity index 100% rename from crates/rpc-types/src/eth/error.rs rename to crates/rpc-types-eth/src/error.rs diff --git a/crates/rpc-types/src/eth/fee.rs b/crates/rpc-types-eth/src/fee.rs similarity index 100% rename from crates/rpc-types/src/eth/fee.rs rename to crates/rpc-types-eth/src/fee.rs diff --git a/crates/rpc-types/src/eth/filter.rs b/crates/rpc-types-eth/src/filter.rs similarity index 99% rename from crates/rpc-types/src/eth/filter.rs rename to crates/rpc-types-eth/src/filter.rs index 37b0a26c877..ac3042c90aa 100644 --- a/crates/rpc-types/src/eth/filter.rs +++ b/crates/rpc-types-eth/src/filter.rs @@ -1,4 +1,4 @@ -use crate::{eth::log::Log as RpcLog, BlockNumberOrTag, Transaction}; +use crate::{BlockNumberOrTag, Log as RpcLog, Transaction}; use alloy_primitives::{keccak256, Address, Bloom, BloomInput, B256, U256, U64}; use itertools::{EitherOrBoth::*, Itertools}; use serde::{ @@ -300,7 +300,7 @@ impl Filter { /// Match only a specific block /// /// ```rust - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new().select(69u64); /// # } @@ -310,8 +310,8 @@ impl Filter { /// Match the latest block only /// /// ```rust - /// # use alloy_rpc_types::BlockNumberOrTag; - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::BlockNumberOrTag; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new().select(BlockNumberOrTag::Latest); /// # } @@ -321,7 +321,7 @@ impl Filter { /// /// ```rust /// # use alloy_primitives::B256; - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new().select(B256::ZERO); /// # } @@ -331,7 +331,7 @@ impl Filter { /// Match a range of blocks /// /// ```rust - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new().select(0u64..100u64); /// # } @@ -340,7 +340,7 @@ impl Filter { /// Match all blocks in range `(1337..BlockNumberOrTag::Latest)` /// /// ```rust - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new().select(1337u64..); /// # } @@ -349,7 +349,7 @@ impl Filter { /// Match all blocks in range `(BlockNumberOrTag::Earliest..1337)` /// /// ```rust - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new().select(..1337u64); /// # } @@ -397,7 +397,7 @@ impl Filter { /// /// ```rust /// # use alloy_primitives::Address; - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let filter = Filter::new() /// .address("0xAc4b3DacB91461209Ae9d41EC517c2B9Cb1B7DAF".parse::
().unwrap()); @@ -409,7 +409,7 @@ impl Filter { /// /// ```rust /// # use alloy_primitives::Address; - /// # use alloy_rpc_types::Filter; + /// # use alloy_rpc_types_eth::Filter; /// # fn main() { /// let addresses = vec![ /// "0xAc4b3DacB91461209Ae9d41EC517c2B9Cb1B7DAF".parse::
().unwrap(), diff --git a/crates/rpc-types/src/eth/index.rs b/crates/rpc-types-eth/src/index.rs similarity index 100% rename from crates/rpc-types/src/eth/index.rs rename to crates/rpc-types-eth/src/index.rs diff --git a/crates/rpc-types/src/eth/mod.rs b/crates/rpc-types-eth/src/lib.rs similarity index 89% rename from crates/rpc-types/src/eth/mod.rs rename to crates/rpc-types-eth/src/lib.rs index 5895c614dfd..24a1f129735 100644 --- a/crates/rpc-types/src/eth/mod.rs +++ b/crates/rpc-types-eth/src/lib.rs @@ -1,33 +1,52 @@ //! Ethereum related types +pub use alloy_eips::eip4895::Withdrawal; + mod account; +pub use account::*; + pub mod admin; +pub use admin::NodeInfo; + mod block; +pub use block::*; + mod call; +pub use call::{Bundle, EthCallResponse, StateContext}; + pub mod error; + mod fee; +pub use fee::{FeeHistory, TxGasAndReward}; + mod filter; +pub use filter::*; + mod index; +pub use index::Index; + mod log; +pub use log::*; + pub mod other; + pub mod pubsub; + pub mod raw_log; +pub use raw_log::{logs_bloom, Log as RawLog}; + pub mod state; + mod syncing; +pub use syncing::*; + pub mod transaction; +pub use transaction::*; + pub mod txpool; -mod work; -pub use account::*; -pub use admin::NodeInfo; -pub use alloy_eips::eip4895::Withdrawal; -pub use block::*; -pub use call::{Bundle, EthCallResponse, StateContext}; -pub use fee::{FeeHistory, TxGasAndReward}; -pub use filter::*; -pub use index::Index; -pub use log::*; -pub use raw_log::{logs_bloom, Log as RawLog}; -pub use syncing::*; -pub use transaction::*; +mod work; pub use work::Work; + +pub mod with_other; +pub use with_other::WithOtherFields; diff --git a/crates/rpc-types/src/eth/log.rs b/crates/rpc-types-eth/src/log.rs similarity index 100% rename from crates/rpc-types/src/eth/log.rs rename to crates/rpc-types-eth/src/log.rs diff --git a/crates/rpc-types/src/eth/other.rs b/crates/rpc-types-eth/src/other.rs similarity index 100% rename from crates/rpc-types/src/eth/other.rs rename to crates/rpc-types-eth/src/other.rs diff --git a/crates/rpc-types/src/eth/pubsub.rs b/crates/rpc-types-eth/src/pubsub.rs similarity index 98% rename from crates/rpc-types/src/eth/pubsub.rs rename to crates/rpc-types-eth/src/pubsub.rs index c1a0ccf699f..da8f41563c5 100644 --- a/crates/rpc-types/src/eth/pubsub.rs +++ b/crates/rpc-types-eth/src/pubsub.rs @@ -1,9 +1,6 @@ //! Ethereum types for pub-sub -use crate::{ - eth::{Filter, Transaction}, - Log, RichHeader, -}; +use crate::{Filter, Log, RichHeader, Transaction}; use alloy_primitives::B256; use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; diff --git a/crates/rpc-types/src/eth/raw_log.rs b/crates/rpc-types-eth/src/raw_log.rs similarity index 100% rename from crates/rpc-types/src/eth/raw_log.rs rename to crates/rpc-types-eth/src/raw_log.rs diff --git a/crates/rpc-types/src/eth/state.rs b/crates/rpc-types-eth/src/state.rs similarity index 100% rename from crates/rpc-types/src/eth/state.rs rename to crates/rpc-types-eth/src/state.rs diff --git a/crates/rpc-types/src/eth/syncing.rs b/crates/rpc-types-eth/src/syncing.rs similarity index 100% rename from crates/rpc-types/src/eth/syncing.rs rename to crates/rpc-types-eth/src/syncing.rs diff --git a/crates/rpc-types/src/eth/transaction/common.rs b/crates/rpc-types-eth/src/transaction/common.rs similarity index 100% rename from crates/rpc-types/src/eth/transaction/common.rs rename to crates/rpc-types-eth/src/transaction/common.rs diff --git a/crates/rpc-types/src/eth/transaction/error.rs b/crates/rpc-types-eth/src/transaction/error.rs similarity index 100% rename from crates/rpc-types/src/eth/transaction/error.rs rename to crates/rpc-types-eth/src/transaction/error.rs diff --git a/crates/rpc-types/src/eth/transaction/mod.rs b/crates/rpc-types-eth/src/transaction/mod.rs similarity index 99% rename from crates/rpc-types/src/eth/transaction/mod.rs rename to crates/rpc-types-eth/src/transaction/mod.rs index f2013c56eef..d5446d99918 100644 --- a/crates/rpc-types/src/eth/transaction/mod.rs +++ b/crates/rpc-types-eth/src/transaction/mod.rs @@ -1,6 +1,6 @@ //! RPC types for transactions -use crate::eth::other::OtherFields; +use crate::other::OtherFields; use alloy_consensus::{ SignableTransaction, Signed, TxEip1559, TxEip2930, TxEip4844, TxEip4844Variant, TxEnvelope, TxLegacy, TxType, diff --git a/crates/rpc-types/src/eth/transaction/optimism.rs b/crates/rpc-types-eth/src/transaction/optimism.rs similarity index 100% rename from crates/rpc-types/src/eth/transaction/optimism.rs rename to crates/rpc-types-eth/src/transaction/optimism.rs diff --git a/crates/rpc-types/src/eth/transaction/receipt.rs b/crates/rpc-types-eth/src/transaction/receipt.rs similarity index 99% rename from crates/rpc-types/src/eth/transaction/receipt.rs rename to crates/rpc-types-eth/src/transaction/receipt.rs index fc29f28e4d7..ab06808ce15 100644 --- a/crates/rpc-types/src/eth/transaction/receipt.rs +++ b/crates/rpc-types-eth/src/transaction/receipt.rs @@ -129,6 +129,7 @@ pub type AnyTransactionReceipt = WithOtherFields use alloy_primitives::{Address, Bloom, Bytes, U256}; -use alloy_rpc_types::{Block, Rich, Transaction, TransactionReceipt}; +use alloy_rpc_types_eth::{Block, Rich, Transaction, TransactionReceipt}; use serde::{Deserialize, Serialize}; /// Operation type enum for `InternalOperation` struct diff --git a/crates/rpc-types-trace/src/tracerequest.rs b/crates/rpc-types-trace/src/tracerequest.rs index 87cdfa91f17..c147c1c66fe 100644 --- a/crates/rpc-types-trace/src/tracerequest.rs +++ b/crates/rpc-types-trace/src/tracerequest.rs @@ -1,7 +1,9 @@ //! Builder style functions for `trace_call` use crate::parity::TraceType; -use alloy_rpc_types::{request::TransactionRequest, state::StateOverride, BlockId, BlockOverrides}; +use alloy_rpc_types_eth::{ + request::TransactionRequest, state::StateOverride, BlockId, BlockOverrides, +}; use serde::{Deserialize, Serialize}; use std::collections::HashSet; diff --git a/crates/rpc-types/Cargo.toml b/crates/rpc-types/Cargo.toml index 80bc7c112d4..bda9009d593 100644 --- a/crates/rpc-types/Cargo.toml +++ b/crates/rpc-types/Cargo.toml @@ -15,53 +15,30 @@ exclude.workspace = true workspace = true [dependencies] -# ethereum -alloy-rlp = { workspace = true, features = ["arrayvec", "derive"] } -alloy-primitives = { workspace = true, features = ["rlp", "serde", "std"] } alloy-serde.workspace = true -alloy-genesis.workspace = true - -alloy-consensus = { workspace = true, features = ["std", "serde"] } -alloy-eips = { workspace = true, features = ["std", "serde"] } - -itertools.workspace = true -serde = { workspace = true, features = ["derive"] } -serde_json.workspace = true -thiserror.workspace = true - - -# arbitrary -arbitrary = { version = "1.3", features = ["derive"], optional = true } -proptest = { version = "1.4", optional = true } -proptest-derive = { version = "0.4", optional = true } - -# jsonrpsee -jsonrpsee-types = { version = "0.22", optional = true } -alloy-sol-types.workspace = true +alloy-rpc-types-beacon = { workspace = true, optional = true } +alloy-rpc-types-engine = { workspace = true, optional = true } +alloy-rpc-types-anvil = { workspace = true, optional = true } +alloy-rpc-types-eth = { workspace = true, optional = true } +alloy-rpc-types-trace = { workspace = true, optional = true } [features] -arbitrary = [ - "dep:arbitrary", - "dep:proptest-derive", - "dep:proptest", - "alloy-primitives/arbitrary", - "alloy-eips/arbitrary", +default = ["eth"] +anvil = ["alloy-rpc-types-anvil"] +beacon = ["alloy-rpc-types-beacon"] +engine = ["alloy-rpc-types-engine"] +eth = ["alloy-rpc-types-eth"] +trace = ["alloy-rpc-types-trace"] + +arbitrary = ["alloy-rpc-types-eth?/arbitrary"] +jsonrpsee-types = [ + "alloy-rpc-types-eth?/jsonrpsee-types", + "alloy-rpc-types-engine?/jsonrpsee-types", ] -jsonrpsee-types = ["dep:jsonrpsee-types"] -ssz = ["alloy-primitives/ssz", "alloy-eips/ssz"] -k256 = ["alloy-consensus/k256"] - -[dev-dependencies] -alloy-primitives = { workspace = true, features = [ - "rand", - "rlp", - "serde", - "arbitrary", -] } -alloy-consensus = { workspace = true, features = ["std", "arbitrary"] } - -arbitrary = { workspace = true, features = ["derive"] } -proptest.workspace = true -proptest-derive.workspace = true -rand.workspace = true -similar-asserts.workspace = true +ssz = [ + "alloy-rpc-types-beacon?/ssz", + "alloy-rpc-types-engine?/ssz", + "alloy-rpc-types-eth?/ssz", +] +k256 = ["alloy-rpc-types-eth?/k256"] +kzg = ["alloy-rpc-types-engine?/kzg"] diff --git a/crates/rpc-types/src/lib.rs b/crates/rpc-types/src/lib.rs index 3d22ba25f90..6232d1ac2db 100644 --- a/crates/rpc-types/src/lib.rs +++ b/crates/rpc-types/src/lib.rs @@ -10,10 +10,19 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -mod eth; - pub use alloy_serde as serde_helpers; -pub use eth::*; -mod with_other; -pub use with_other::WithOtherFields; +#[cfg(feature = "anvil")] +pub use alloy_rpc_types_anvil as anvil; + +#[cfg(feature = "beacon")] +pub use alloy_rpc_types_beacon as beacon; + +#[cfg(feature = "engine")] +pub use alloy_rpc_types_engine as engine; + +#[cfg(feature = "eth")] +pub use alloy_rpc_types_eth::*; + +#[cfg(feature = "trace")] +pub use alloy_rpc_types_trace as trace; diff --git a/crates/signer-trezor/Cargo.toml b/crates/signer-trezor/Cargo.toml index 42c668b80d3..7c67988f5bf 100644 --- a/crates/signer-trezor/Cargo.toml +++ b/crates/signer-trezor/Cargo.toml @@ -30,5 +30,5 @@ thiserror.workspace = true tracing.workspace = true [dev-dependencies] -alloy-rpc-types.workspace = true +alloy-rpc-types-eth.workspace = true tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } diff --git a/crates/signer-trezor/src/signer.rs b/crates/signer-trezor/src/signer.rs index 5c2a5d034b0..e2a01eaff85 100644 --- a/crates/signer-trezor/src/signer.rs +++ b/crates/signer-trezor/src/signer.rs @@ -284,7 +284,7 @@ mod tests { use super::*; use alloy_network::{EthereumSigner, TransactionBuilder}; use alloy_primitives::{address, b256}; - use alloy_rpc_types::{AccessList, AccessListItem, TransactionRequest}; + use alloy_rpc_types_eth::{AccessList, AccessListItem, TransactionRequest}; #[tokio::test] #[ignore]