Skip to content

Commit

Permalink
feat: trace_call and trace_callMany
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Mar 12, 2024
1 parent 05d0d0e commit 7129ac0
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion crates/providers/src/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use alloy_primitives::{
use alloy_rpc_client::{ClientRef, RpcClient, WeakClient};
use alloy_rpc_trace_types::{
geth::{GethDebugTracingOptions, GethTrace},
parity::LocalizedTransactionTrace,
parity::{LocalizedTransactionTrace, TraceResults, TraceType},
};
use alloy_rpc_types::{
state::StateOverride, AccessListWithGasUsed, Block, BlockId, BlockNumberOrTag,
Expand Down Expand Up @@ -392,6 +392,35 @@ pub trait Provider<N: Network, T: Transport + Clone = BoxTransport>: Send + Sync
self.client().prepare("eth_createAccessList", (request, block.unwrap_or_default())).await
}

/// Executes the given transaction and returns a number of possible traces.
///
/// # Note
///
/// Not all nodes support this call.
async fn trace_call(
&self,
request: &N::TransactionRequest,
trace_type: Vec<TraceType>,
block: Option<BlockId>,
) -> TransportResult<TraceResults> {
self.client().prepare("trace_call", (request, trace_type, block)).await
}

/// Traces multiple transactions on top of the same block, i.e. transaction `n` will be executed on top of the given block with all `n - 1` transaction applied first.
///
/// Allows tracing dependent transactions.
///
/// # Note
///
/// Not all nodes support this call.
async fn trace_call_many(
&self,
request: &[(N::TransactionRequest, Vec<TraceType>)],
block: Option<BlockId>,
) -> TransportResult<TraceResults> {
self.client().prepare("trace_callMany", (request, block)).await
}

// todo: move to extension trait
/// Parity trace transaction.
async fn trace_transaction(
Expand Down

0 comments on commit 7129ac0

Please sign in to comment.