Skip to content

Commit

Permalink
trace_callMany (#494)
Browse files Browse the repository at this point in the history
* Added trace_callMany support.

* trace_callMany use BlockId

* cargo fmt --all

Co-authored-by: mdben1247 <mdben1247@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
  • Loading branch information
3 people committed May 19, 2021
1 parent b5bcaa2 commit 7dfefdc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/api/traces.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
api::Namespace,
helpers::{self, CallFuture},
types::{BlockNumber, BlockTrace, Bytes, CallRequest, Index, Trace, TraceFilter, TraceType, H256},
types::{BlockId, BlockNumber, BlockTrace, Bytes, CallRequest, Index, Trace, TraceFilter, TraceType, H256},
Transport,
};

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

/// Performs multiple call traces on top of the same block. Allows to trace dependent transactions.
pub fn call_many(
&self,
reqs_with_trace_types: Vec<(CallRequest, Vec<TraceType>)>,
block: Option<BlockId>,
) -> CallFuture<Vec<BlockTrace>, T::Out> {
let reqs_with_trace_types = helpers::serialize(&reqs_with_trace_types);
let block = helpers::serialize(&block.unwrap_or_else(|| BlockNumber::Latest.into()));
CallFuture::new(
self.transport
.execute("trace_callMany", vec![reqs_with_trace_types, block]),
)
}

/// Traces a call to `eth_sendRawTransaction` without making the call, returning the traces
pub fn raw_transaction(&self, data: Bytes, trace_type: Vec<TraceType>) -> CallFuture<BlockTrace, T::Out> {
let data = helpers::serialize(&data);
Expand Down

0 comments on commit 7dfefdc

Please sign in to comment.