@@ -7,7 +7,8 @@ use alloy::network::{BlockResponse, ReceiptResponse, TransactionResponse};
77use alloy:: primitives:: { Address , Bytes , B256 , U256 , U64 } ;
88use alloy:: rpc:: json_rpc:: RpcObject ;
99use alloy:: rpc:: types:: {
10- AccessListResult , EIP1186AccountProofResponse , Filter , FilterChanges , Log , SyncStatus ,
10+ state:: StateOverride , AccessListResult , EIP1186AccountProofResponse , Filter , FilterChanges ,
11+ Log , SyncStatus ,
1112} ;
1213use eyre:: { eyre, Result } ;
1314use jsonrpsee:: {
@@ -84,14 +85,25 @@ trait EthRpc<
8485 #[ method( name = "getCode" ) ]
8586 async fn get_code ( & self , address : Address , block : BlockId ) -> Result < Bytes , ErrorObjectOwned > ;
8687 #[ method( name = "call" ) ]
87- async fn call ( & self , tx : TXR , block : BlockId ) -> Result < Bytes , ErrorObjectOwned > ;
88+ async fn call (
89+ & self ,
90+ tx : TXR ,
91+ block : BlockId ,
92+ state_overrides : Option < StateOverride > ,
93+ ) -> Result < Bytes , ErrorObjectOwned > ;
8894 #[ method( name = "estimateGas" ) ]
89- async fn estimate_gas ( & self , tx : TXR , block : BlockId ) -> Result < U64 , ErrorObjectOwned > ;
95+ async fn estimate_gas (
96+ & self ,
97+ tx : TXR ,
98+ block : BlockId ,
99+ state_overrides : Option < StateOverride > ,
100+ ) -> Result < U64 , ErrorObjectOwned > ;
90101 #[ method( name = "createAccessList" ) ]
91102 async fn create_access_list (
92103 & self ,
93104 tx : TXR ,
94105 block : BlockId ,
106+ state_overrides : Option < StateOverride > ,
95107 ) -> Result < AccessListResult , ErrorObjectOwned > ;
96108 #[ method( name = "chainId" ) ]
97109 async fn chain_id ( & self ) -> Result < U64 , ErrorObjectOwned > ;
@@ -238,16 +250,22 @@ impl<N: NetworkSpec>
238250 & self ,
239251 tx : N :: TransactionRequest ,
240252 block : BlockId ,
253+ state_overrides : Option < StateOverride > ,
241254 ) -> Result < Bytes , ErrorObjectOwned > {
242- convert_err ( self . client . call ( & tx, block) . await )
255+ convert_err ( self . client . call ( & tx, block, state_overrides ) . await )
243256 }
244257
245258 async fn estimate_gas (
246259 & self ,
247260 tx : N :: TransactionRequest ,
248261 block : BlockId ,
262+ state_overrides : Option < StateOverride > ,
249263 ) -> Result < U64 , ErrorObjectOwned > {
250- let res = self . client . estimate_gas ( & tx, block) . await . map ( U64 :: from) ;
264+ let res = self
265+ . client
266+ . estimate_gas ( & tx, block, state_overrides)
267+ . await
268+ . map ( U64 :: from) ;
251269
252270 convert_err ( res)
253271 }
@@ -256,8 +274,9 @@ impl<N: NetworkSpec>
256274 & self ,
257275 tx : N :: TransactionRequest ,
258276 block : BlockId ,
277+ state_overrides : Option < StateOverride > ,
259278 ) -> Result < AccessListResult , ErrorObjectOwned > {
260- convert_err ( self . client . create_access_list ( & tx, block) . await )
279+ convert_err ( self . client . create_access_list ( & tx, block, state_overrides ) . await )
261280 }
262281
263282 async fn chain_id ( & self ) -> Result < U64 , ErrorObjectOwned > {
0 commit comments