reth_rpc_api/
otterscan.rs1use alloy_eips::{eip1898::LenientBlockNumberOrTag, BlockId};
2use alloy_json_rpc::RpcObject;
3use alloy_primitives::{Address, Bytes, TxHash, B256};
4use alloy_rpc_types_trace::otterscan::{
5 BlockDetails, ContractCreator, InternalOperation, OtsBlockTransactions, TraceEntry,
6 TransactionsWithReceipts,
7};
8use jsonrpsee::{core::RpcResult, proc_macros::rpc};
9
10#[cfg_attr(not(feature = "client"), rpc(server, namespace = "ots"))]
12#[cfg_attr(feature = "client", rpc(server, client, namespace = "ots"))]
13pub trait Otterscan<T: RpcObject, H: RpcObject> {
14 #[method(name = "getHeaderByNumber", aliases = ["erigon_getHeaderByNumber"])]
22 async fn get_header_by_number(
23 &self,
24 block_number: LenientBlockNumberOrTag,
25 ) -> RpcResult<Option<H>>;
26
27 #[method(name = "hasCode")]
29 async fn has_code(&self, address: Address, block_id: Option<BlockId>) -> RpcResult<bool>;
30
31 #[method(name = "getApiLevel")]
35 async fn get_api_level(&self) -> RpcResult<u64>;
36
37 #[method(name = "getInternalOperations")]
39 async fn get_internal_operations(&self, tx_hash: TxHash) -> RpcResult<Vec<InternalOperation>>;
40
41 #[method(name = "getTransactionError")]
43 async fn get_transaction_error(&self, tx_hash: TxHash) -> RpcResult<Option<Bytes>>;
44
45 #[method(name = "traceTransaction")]
48 async fn trace_transaction(&self, tx_hash: TxHash) -> RpcResult<Option<Vec<TraceEntry>>>;
49
50 #[method(name = "getBlockDetails")]
53 async fn get_block_details(
54 &self,
55 block_number: LenientBlockNumberOrTag,
56 ) -> RpcResult<BlockDetails<H>>;
57
58 #[method(name = "getBlockDetailsByHash")]
61 async fn get_block_details_by_hash(&self, block_hash: B256) -> RpcResult<BlockDetails<H>>;
62
63 #[method(name = "getBlockTransactions")]
65 async fn get_block_transactions(
66 &self,
67 block_number: LenientBlockNumberOrTag,
68 page_number: usize,
69 page_size: usize,
70 ) -> RpcResult<OtsBlockTransactions<T, H>>;
71
72 #[method(name = "searchTransactionsBefore")]
74 async fn search_transactions_before(
75 &self,
76 address: Address,
77 block_number: LenientBlockNumberOrTag,
78 page_size: usize,
79 ) -> RpcResult<TransactionsWithReceipts>;
80
81 #[method(name = "searchTransactionsAfter")]
83 async fn search_transactions_after(
84 &self,
85 address: Address,
86 block_number: LenientBlockNumberOrTag,
87 page_size: usize,
88 ) -> RpcResult<TransactionsWithReceipts>;
89
90 #[method(name = "getTransactionBySenderAndNonce")]
92 async fn get_transaction_by_sender_and_nonce(
93 &self,
94 sender: Address,
95 nonce: u64,
96 ) -> RpcResult<Option<TxHash>>;
97
98 #[method(name = "getContractCreator")]
100 async fn get_contract_creator(&self, address: Address) -> RpcResult<Option<ContractCreator>>;
101}