reth_rpc_eth_api/
filter.rs1use alloy_json_rpc::RpcObject;
4use alloy_rpc_types_eth::{Filter, FilterChanges, FilterId, Log, PendingTransactionFilterKind};
5use jsonrpsee::{core::RpcResult, proc_macros::rpc};
6
7#[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))]
9#[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))]
10pub trait EthFilterApi<T: RpcObject> {
11 #[method(name = "newFilter")]
13 async fn new_filter(&self, filter: Filter) -> RpcResult<FilterId>;
14
15 #[method(name = "newBlockFilter")]
17 async fn new_block_filter(&self) -> RpcResult<FilterId>;
18
19 #[method(name = "newPendingTransactionFilter")]
21 async fn new_pending_transaction_filter(
22 &self,
23 kind: Option<PendingTransactionFilterKind>,
24 ) -> RpcResult<FilterId>;
25
26 #[method(name = "getFilterChanges")]
28 async fn filter_changes(&self, id: FilterId) -> RpcResult<FilterChanges<T>>;
29
30 #[method(name = "getFilterLogs")]
32 async fn filter_logs(&self, id: FilterId) -> RpcResult<Vec<Log>>;
33
34 #[method(name = "uninstallFilter")]
36 async fn uninstall_filter(&self, id: FilterId) -> RpcResult<bool>;
37
38 #[method(name = "getLogs")]
40 async fn logs(&self, filter: Filter) -> RpcResult<Vec<Log>>;
41}