reth_rpc_api/
otterscan.rsuse alloy_eips::BlockId;
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, Bytes, TxHash, B256};
use alloy_rpc_types_trace::otterscan::{
BlockDetails, ContractCreator, InternalOperation, OtsBlockTransactions, TraceEntry,
TransactionsWithReceipts,
};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "ots"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "ots"))]
pub trait Otterscan<T: RpcObject, H: RpcObject> {
#[method(name = "getHeaderByNumber", aliases = ["erigon_getHeaderByNumber"])]
async fn get_header_by_number(&self, block_number: u64) -> RpcResult<Option<H>>;
#[method(name = "hasCode")]
async fn has_code(&self, address: Address, block_id: Option<BlockId>) -> RpcResult<bool>;
#[method(name = "getApiLevel")]
async fn get_api_level(&self) -> RpcResult<u64>;
#[method(name = "getInternalOperations")]
async fn get_internal_operations(&self, tx_hash: TxHash) -> RpcResult<Vec<InternalOperation>>;
#[method(name = "getTransactionError")]
async fn get_transaction_error(&self, tx_hash: TxHash) -> RpcResult<Option<Bytes>>;
#[method(name = "traceTransaction")]
async fn trace_transaction(&self, tx_hash: TxHash) -> RpcResult<Option<Vec<TraceEntry>>>;
#[method(name = "getBlockDetails")]
async fn get_block_details(&self, block_number: u64) -> RpcResult<BlockDetails<H>>;
#[method(name = "getBlockDetailsByHash")]
async fn get_block_details_by_hash(&self, block_hash: B256) -> RpcResult<BlockDetails<H>>;
#[method(name = "getBlockTransactions")]
async fn get_block_transactions(
&self,
block_number: u64,
page_number: usize,
page_size: usize,
) -> RpcResult<OtsBlockTransactions<T, H>>;
#[method(name = "searchTransactionsBefore")]
async fn search_transactions_before(
&self,
address: Address,
block_number: u64,
page_size: usize,
) -> RpcResult<TransactionsWithReceipts>;
#[method(name = "searchTransactionsAfter")]
async fn search_transactions_after(
&self,
address: Address,
block_number: u64,
page_size: usize,
) -> RpcResult<TransactionsWithReceipts>;
#[method(name = "getTransactionBySenderAndNonce")]
async fn get_transaction_by_sender_and_nonce(
&self,
sender: Address,
nonce: u64,
) -> RpcResult<Option<TxHash>>;
#[method(name = "getContractCreator")]
async fn get_contract_creator(&self, address: Address) -> RpcResult<Option<ContractCreator>>;
}