|
1 | 1 | use crate::{ |
2 | 2 | api::Namespace, |
3 | 3 | 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}, |
5 | 5 | Transport, |
6 | 6 | }; |
7 | 7 |
|
@@ -38,6 +38,20 @@ impl<T: Transport> Traces<T> { |
38 | 38 | CallFuture::new(self.transport.execute("trace_call", vec![req, trace_type, block])) |
39 | 39 | } |
40 | 40 |
|
| 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 | + |
41 | 55 | /// Traces a call to `eth_sendRawTransaction` without making the call, returning the traces |
42 | 56 | pub fn raw_transaction(&self, data: Bytes, trace_type: Vec<TraceType>) -> CallFuture<BlockTrace, T::Out> { |
43 | 57 | let data = helpers::serialize(&data); |
|
0 commit comments