mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(op): implement Call for OpEthApi (#9502)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
32
crates/optimism/rpc/src/eth/call.rs
Normal file
32
crates/optimism/rpc/src/eth/call.rs
Normal file
@ -0,0 +1,32 @@
|
||||
use reth_evm::ConfigureEvm;
|
||||
use reth_primitives::{
|
||||
revm_primitives::{BlockEnv, OptimismFields, TxEnv},
|
||||
Bytes,
|
||||
};
|
||||
use reth_rpc_eth_api::helpers::Call;
|
||||
use reth_rpc_eth_types::EthResult;
|
||||
use reth_rpc_types::TransactionRequest;
|
||||
|
||||
use crate::OpEthApi;
|
||||
|
||||
impl<Eth: Call> Call for OpEthApi<Eth> {
|
||||
fn call_gas_limit(&self) -> u64 {
|
||||
self.inner.call_gas_limit()
|
||||
}
|
||||
|
||||
fn evm_config(&self) -> &impl ConfigureEvm {
|
||||
self.inner.evm_config()
|
||||
}
|
||||
|
||||
fn create_txn_env(
|
||||
&self,
|
||||
block_env: &BlockEnv,
|
||||
request: TransactionRequest,
|
||||
) -> EthResult<TxEnv> {
|
||||
let mut env = Eth::create_txn_env(&self.inner, block_env, request)?;
|
||||
|
||||
env.optimism = OptimismFields { enveloped_tx: Some(Bytes::new()), ..Default::default() };
|
||||
|
||||
Ok(env)
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ pub mod receipt;
|
||||
pub mod transaction;
|
||||
|
||||
mod block;
|
||||
mod call;
|
||||
mod pending_block;
|
||||
|
||||
use std::{future::Future, sync::Arc};
|
||||
@ -17,7 +18,7 @@ use reth_provider::{BlockReaderIdExt, ChainSpecProvider, HeaderProvider, StatePr
|
||||
use reth_rpc::eth::DevSigner;
|
||||
use reth_rpc_eth_api::{
|
||||
helpers::{
|
||||
AddDevSigners, Call, EthApiSpec, EthCall, EthFees, EthSigner, EthState, LoadFee, LoadState,
|
||||
AddDevSigners, EthApiSpec, EthCall, EthFees, EthSigner, EthState, LoadFee, LoadState,
|
||||
SpawnBlocking, Trace, UpdateRawTxForwarder,
|
||||
},
|
||||
RawTransactionForwarder,
|
||||
@ -121,16 +122,6 @@ impl<Eth: LoadFee> LoadFee for OpEthApi<Eth> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<Eth: Call> Call for OpEthApi<Eth> {
|
||||
fn call_gas_limit(&self) -> u64 {
|
||||
self.inner.call_gas_limit()
|
||||
}
|
||||
|
||||
fn evm_config(&self) -> &impl ConfigureEvm {
|
||||
self.inner.evm_config()
|
||||
}
|
||||
}
|
||||
|
||||
impl<Eth: LoadState> LoadState for OpEthApi<Eth> {
|
||||
fn provider(&self) -> impl StateProviderFactory + ChainSpecProvider {
|
||||
LoadState::provider(&self.inner)
|
||||
|
||||
Reference in New Issue
Block a user