diff --git a/crates/rpc/rpc/src/eth/filter.rs b/crates/rpc/rpc/src/eth/filter.rs new file mode 100644 index 0000000000..1b57cfd363 --- /dev/null +++ b/crates/rpc/rpc/src/eth/filter.rs @@ -0,0 +1,68 @@ +use async_trait::async_trait; +use jsonrpsee::core::RpcResult; +use reth_primitives::{rpc::Filter, U256}; +use reth_provider::BlockProvider; +use reth_rpc_api::EthFilterApiServer; +use reth_rpc_types::{FilterChanges, Index, Log}; +use reth_transaction_pool::TransactionPool; +use std::sync::Arc; + +/// `Eth` filter RPC implementation. +#[derive(Debug, Clone)] +pub struct EthFilter { + /// All nested fields bundled together. + inner: Arc>, +} + +impl EthFilter { + /// Creates a new, shareable instance. + pub fn new(client: Arc, pool: Pool) -> Self { + let inner = EthFilterInner { client, pool }; + Self { inner: Arc::new(inner) } + } +} + +#[async_trait] +impl EthFilterApiServer for EthFilter +where + Pool: TransactionPool + 'static, + Client: BlockProvider + 'static, +{ + fn new_filter(&self, _filter: Filter) -> RpcResult { + todo!() + } + + fn new_block_filter(&self) -> RpcResult { + todo!() + } + + fn new_pending_transaction_filter(&self) -> RpcResult { + todo!() + } + + async fn filter_changes(&self, _index: Index) -> RpcResult { + todo!() + } + + async fn filter_logs(&self, _index: Index) -> RpcResult> { + todo!() + } + + fn uninstall_filter(&self, _index: Index) -> RpcResult { + todo!() + } + + async fn logs(&self, _filter: Filter) -> RpcResult> { + todo!() + } +} + +/// Container type `EthFilter` +#[derive(Debug)] +struct EthFilterInner { + /// The transaction pool. + pool: Pool, + /// The client that can interact with the chain. + client: Arc, + // TODO needs spawn access +} diff --git a/crates/rpc/rpc/src/eth/mod.rs b/crates/rpc/rpc/src/eth/mod.rs index 29f45cb49f..598e3721a3 100644 --- a/crates/rpc/rpc/src/eth/mod.rs +++ b/crates/rpc/rpc/src/eth/mod.rs @@ -2,8 +2,10 @@ mod api; pub(crate) mod error; +mod filter; mod pubsub; mod signer; pub use api::{EthApi, EthApiSpec}; +pub use filter::EthFilter; pub use pubsub::EthPubSub; diff --git a/crates/rpc/rpc/src/eth/pubsub.rs b/crates/rpc/rpc/src/eth/pubsub.rs index 8ec28507c5..b0c10d5c01 100644 --- a/crates/rpc/rpc/src/eth/pubsub.rs +++ b/crates/rpc/rpc/src/eth/pubsub.rs @@ -52,7 +52,7 @@ async fn handle_accepted( ) { } -/// Container type `EthApi` +/// Container type `EthPubSub` #[derive(Debug)] struct EthPubSubInner { /// The transaction pool. diff --git a/crates/rpc/rpc/src/lib.rs b/crates/rpc/rpc/src/lib.rs index be0c627b71..2281d828e6 100644 --- a/crates/rpc/rpc/src/lib.rs +++ b/crates/rpc/rpc/src/lib.rs @@ -23,7 +23,7 @@ mod web3; pub use admin::AdminApi; pub use debug::DebugApi; pub use engine::EngineApi; -pub use eth::{EthApi, EthApiSpec, EthPubSub}; +pub use eth::{EthApi, EthApiSpec, EthFilter, EthPubSub}; pub use layers::{AuthLayer, AuthValidator, JwtAuthValidator, JwtError, JwtSecret}; pub use net::NetApi; pub use trace::TraceApi;