Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace_callMany #494

Merged
merged 4 commits into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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