cfx_rpc_cfx_api/
trace.rs

1// Copyright 2020 Conflux Foundation. All rights reserved.
2// Conflux is free software and distributed under GNU General Public License.
3// See http://www.gnu.org/licenses/
4
5use cfx_rpc_cfx_types::{
6    EpochNumber, LocalizedBlockTrace, LocalizedTrace, TraceFilter,
7};
8use cfx_rpc_eth_types::trace::EpochTrace;
9use cfx_types::H256;
10use jsonrpsee::{core::RpcResult, proc_macros::rpc};
11
12/// Trace specific rpc interface.
13#[rpc(server, namespace = "trace")]
14pub trait Trace {
15    /// Returns all traces produced at the given block.
16    #[method(name = "block")]
17    fn block_traces(
18        &self, block_hash: H256,
19    ) -> RpcResult<Option<LocalizedBlockTrace>>;
20
21    /// Returns all traces matching the provided filter.
22    #[method(name = "filter")]
23    fn filter_traces(
24        &self, filter: TraceFilter,
25    ) -> RpcResult<Option<Vec<LocalizedTrace>>>;
26
27    /// Returns all traces produced at the given transaction.
28    #[method(name = "transaction")]
29    fn transaction_traces(
30        &self, tx_hash: H256,
31    ) -> RpcResult<Option<Vec<LocalizedTrace>>>;
32
33    /// Return all traces of both spaces in an epoch.
34    #[method(name = "epoch")]
35    fn epoch_traces(&self, epoch: EpochNumber)
36        -> RpcResult<Option<EpochTrace>>;
37}