reth_rpc_api/
otterscan.rs
1use alloy_eips::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(&self, block_number: u64) -> RpcResult<Option<H>>;
23
24 #[method(name = "hasCode")]
26 async fn has_code(&self, address: Address, block_id: Option<BlockId>) -> RpcResult<bool>;
27
28 #[method(name = "getApiLevel")]
32 async fn get_api_level(&self) -> RpcResult<u64>;
33
34 #[method(name = "getInternalOperations")]
36 async fn get_internal_operations(&self, tx_hash: TxHash) -> RpcResult<Vec<InternalOperation>>;
37
38 #[method(name = "getTransactionError")]
40 async fn get_transaction_error(&self, tx_hash: TxHash) -> RpcResult<Option<Bytes>>;
41
42 #[method(name = "traceTransaction")]
45 async fn trace_transaction(&self, tx_hash: TxHash) -> RpcResult<Option<Vec<TraceEntry>>>;
46
47 #[method(name = "getBlockDetails")]
50 async fn get_block_details(&self, block_number: u64) -> RpcResult<BlockDetails<H>>;
51
52 #[method(name = "getBlockDetailsByHash")]
54 async fn get_block_details_by_hash(&self, block_hash: B256) -> RpcResult<BlockDetails<H>>;
55
56 #[method(name = "getBlockTransactions")]
58 async fn get_block_transactions(
59 &self,
60 block_number: u64,
61 page_number: usize,
62 page_size: usize,
63 ) -> RpcResult<OtsBlockTransactions<T, H>>;
64
65 #[method(name = "searchTransactionsBefore")]
67 async fn search_transactions_before(
68 &self,
69 address: Address,
70 block_number: u64,
71 page_size: usize,
72 ) -> RpcResult<TransactionsWithReceipts>;
73
74 #[method(name = "searchTransactionsAfter")]
76 async fn search_transactions_after(
77 &self,
78 address: Address,
79 block_number: u64,
80 page_size: usize,
81 ) -> RpcResult<TransactionsWithReceipts>;
82
83 #[method(name = "getTransactionBySenderAndNonce")]
85 async fn get_transaction_by_sender_and_nonce(
86 &self,
87 sender: Address,
88 nonce: u64,
89 ) -> RpcResult<Option<TxHash>>;
90
91 #[method(name = "getContractCreator")]
93 async fn get_contract_creator(&self, address: Address) -> RpcResult<Option<ContractCreator>>;
94}