1
// Copyright 2019-2025 PureStake Inc.
2
// This file is part of Moonbeam.
3

            
4
// Moonbeam is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Moonbeam is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Moonbeam.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
use ethereum_types::H160;
18
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
19
use moonbeam_client_evm_tracing::types::block::TransactionTrace;
20
use moonbeam_rpc_core_types::RequestBlockId;
21
use serde::Deserialize;
22

            
23
#[rpc(server)]
24
#[jsonrpsee::core::async_trait]
25
pub trait Trace {
26
	#[method(name = "trace_filter")]
27
	async fn filter(&self, filter: FilterRequest) -> RpcResult<Vec<TransactionTrace>>;
28
}
29

            
30
#[derive(Clone, Eq, PartialEq, Debug, Deserialize)]
31
#[serde(rename_all = "camelCase")]
32
pub struct FilterRequest {
33
	/// (optional?) From this block.
34
	pub from_block: Option<RequestBlockId>,
35

            
36
	/// (optional?) To this block.
37
	pub to_block: Option<RequestBlockId>,
38

            
39
	/// (optional) Sent from these addresses.
40
	pub from_address: Option<Vec<H160>>,
41

            
42
	/// (optional) Sent to these addresses.
43
	pub to_address: Option<Vec<H160>>,
44

            
45
	/// (optional) The offset trace number
46
	pub after: Option<u32>,
47

            
48
	/// (optional) Integer number of traces to display in a batch.
49
	pub count: Option<u32>,
50
}