From 31dfc38a38e112cca6f1adf8c29eeb23c0feb48f Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 21 Sep 2024 14:58:51 +0200 Subject: [PATCH] feat: add eth_simulateV1 (#1323) --- crates/provider/src/provider/trait.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/provider/src/provider/trait.rs b/crates/provider/src/provider/trait.rs index dc1d01a9edc..003569c9164 100644 --- a/crates/provider/src/provider/trait.rs +++ b/crates/provider/src/provider/trait.rs @@ -20,6 +20,7 @@ use alloy_primitives::{ }; use alloy_rpc_client::{ClientRef, NoParams, PollerBuilder, WeakClient}; use alloy_rpc_types_eth::{ + simulate::{SimulatePayload, SimulatedBlock}, AccessListResult, BlockId, BlockNumberOrTag, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Log, SyncStatus, }; @@ -155,6 +156,17 @@ pub trait Provider: EthCall::new(self.weak_client(), tx) } + /// Executes an arbitrary number of transactions on top of the requested state. + /// + /// The transactions are packed into individual blocks. Overrides can be provided. + #[doc(alias = "eth_simulateV1")] + fn simulate<'req>( + &self, + payload: &'req SimulatePayload, + ) -> RpcWithBlock>> { + self.client().request("eth_simulateV1", payload).into() + } + /// Gets the chain ID. fn get_chain_id(&self) -> ProviderCall { self.client()