//! `eth_` RPC API for filtering. use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_rpc_types::{Filter, FilterChanges, FilterId, Log, PendingTransactionFilterKind}; /// Rpc Interface for poll-based ethereum filter API. #[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))] #[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))] pub trait EthFilterApi { /// Creates anew filter and returns its id. #[method(name = "newFilter")] async fn new_filter(&self, filter: Filter) -> RpcResult; /// Creates a new block filter and returns its id. #[method(name = "newBlockFilter")] async fn new_block_filter(&self) -> RpcResult; /// Creates a pending transaction filter and returns its id. #[method(name = "newPendingTransactionFilter")] async fn new_pending_transaction_filter( &self, kind: Option, ) -> RpcResult; /// Returns all filter changes since last poll. #[method(name = "getFilterChanges")] async fn filter_changes(&self, id: FilterId) -> RpcResult; /// Returns all logs matching given filter (in a range 'from' - 'to'). #[method(name = "getFilterLogs")] async fn filter_logs(&self, id: FilterId) -> RpcResult>; /// Uninstalls filter. #[method(name = "uninstallFilter")] async fn uninstall_filter(&self, id: FilterId) -> RpcResult; /// Returns logs matching given filter object. #[method(name = "getLogs")] async fn logs(&self, filter: Filter) -> RpcResult>; }