tempo_node/rpc/eth_ext/mod.rs
1use crate::rpc::eth_ext::transactions::TransactionsResponse;
2use jsonrpsee::{core::RpcResult, proc_macros::rpc};
3use reth_node_core::rpc::result::internal_rpc_err;
4use reth_rpc_eth_api::RpcNodeCore;
5use tempo_alloy::rpc::pagination::PaginationParams;
6
7pub mod transactions;
8pub use transactions::TransactionsFilter;
9
10#[rpc(server, namespace = "eth")]
11pub trait TempoEthExtApi {
12 /// Gets paginated transactions on Tempo with flexible filtering and sorting.
13 ///
14 /// Uses cursor-based pagination for stable iteration through transactions.
15 #[method(name = "getTransactions")]
16 async fn transactions(
17 &self,
18 params: PaginationParams<TransactionsFilter>,
19 ) -> RpcResult<TransactionsResponse>;
20}
21
22/// The JSON-RPC handlers for the `dex_` namespace.
23#[derive(Debug, Clone, Default)]
24pub struct TempoEthExt<EthApi> {
25 eth_api: EthApi,
26}
27
28impl<EthApi> TempoEthExt<EthApi> {
29 pub fn new(eth_api: EthApi) -> Self {
30 Self { eth_api }
31 }
32}
33
34#[async_trait::async_trait]
35impl<EthApi: RpcNodeCore> TempoEthExtApiServer for TempoEthExt<EthApi> {
36 async fn transactions(
37 &self,
38 _params: PaginationParams<TransactionsFilter>,
39 ) -> RpcResult<TransactionsResponse> {
40 Err(internal_rpc_err("unimplemented"))
41 }
42}
43
44impl<EthApi: RpcNodeCore> TempoEthExt<EthApi> {
45 /// Access the underlying provider.
46 pub fn provider(&self) -> &EthApi::Provider {
47 self.eth_api.provider()
48 }
49}