cfx_rpc_eth_api/
trace.rs

1use alloy_primitives::map::HashSet;
2use cfx_rpc_eth_types::{
3    BlockId, BlockOverrides, Index, LocalizedSetAuthTrace, LocalizedTrace,
4    RpcStateOverride, TraceFilter, TraceResults, TraceType, TransactionRequest,
5};
6use cfx_types::H256;
7use jsonrpsee::{core::RpcResult, proc_macros::rpc};
8
9#[rpc(server, namespace = "trace")]
10pub trait TraceApi {
11    /// Returns all traces produced at the given block.
12    #[method(name = "block")]
13    async fn block_traces(
14        &self, block_number: BlockId,
15    ) -> RpcResult<Option<Vec<LocalizedTrace>>>;
16
17    /// Returns all set auth traces produced at the given block.
18    #[method(name = "blockSetAuth")]
19    async fn block_set_auth_traces(
20        &self, block_number: BlockId,
21    ) -> RpcResult<Option<Vec<LocalizedSetAuthTrace>>>;
22
23    /// Returns all traces matching the provided filter.
24    #[method(name = "filter")]
25    async fn filter_traces(
26        &self, filter: TraceFilter,
27    ) -> RpcResult<Vec<LocalizedTrace>>;
28
29    #[method(name = "get")]
30    async fn trace_get(
31        &self, hash: H256, indices: Vec<Index>,
32    ) -> RpcResult<Option<LocalizedTrace>>;
33
34    /// Returns all traces produced at the given transaction.
35    #[method(name = "transaction")]
36    async fn transaction_traces(
37        &self, tx_hash: H256,
38    ) -> RpcResult<Option<Vec<LocalizedTrace>>>;
39
40    #[method(name = "call")]
41    async fn trace_call(
42        &self, call: TransactionRequest, trace_types: HashSet<TraceType>,
43        block_id: Option<BlockId>, state_overrides: Option<RpcStateOverride>,
44        block_overrides: Option<Box<BlockOverrides>>,
45    ) -> RpcResult<TraceResults>;
46}