Skip to content

Commit 7dfefdc

Browse files
mdben1247tomusdrw
andauthored
trace_callMany (#494)
* Added trace_callMany support. * trace_callMany use BlockId * cargo fmt --all Co-authored-by: mdben1247 <[email protected]> Co-authored-by: Tomasz Drwięga <[email protected]>
1 parent b5bcaa2 commit 7dfefdc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/api/traces.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
api::Namespace,
33
helpers::{self, CallFuture},
4-
types::{BlockNumber, BlockTrace, Bytes, CallRequest, Index, Trace, TraceFilter, TraceType, H256},
4+
types::{BlockId, BlockNumber, BlockTrace, Bytes, CallRequest, Index, Trace, TraceFilter, TraceType, H256},
55
Transport,
66
};
77

@@ -38,6 +38,20 @@ impl<T: Transport> Traces<T> {
3838
CallFuture::new(self.transport.execute("trace_call", vec![req, trace_type, block]))
3939
}
4040

41+
/// Performs multiple call traces on top of the same block. Allows to trace dependent transactions.
42+
pub fn call_many(
43+
&self,
44+
reqs_with_trace_types: Vec<(CallRequest, Vec<TraceType>)>,
45+
block: Option<BlockId>,
46+
) -> CallFuture<Vec<BlockTrace>, T::Out> {
47+
let reqs_with_trace_types = helpers::serialize(&reqs_with_trace_types);
48+
let block = helpers::serialize(&block.unwrap_or_else(|| BlockNumber::Latest.into()));
49+
CallFuture::new(
50+
self.transport
51+
.execute("trace_callMany", vec![reqs_with_trace_types, block]),
52+
)
53+
}
54+
4155
/// Traces a call to `eth_sendRawTransaction` without making the call, returning the traces
4256
pub fn raw_transaction(&self, data: Bytes, trace_type: Vec<TraceType>) -> CallFuture<BlockTrace, T::Out> {
4357
let data = helpers::serialize(&data);

0 commit comments

Comments
 (0)