use crate::{ evm::CustomTxEnv, primitives::{CustomHeader, CustomTransaction}, }; use alloy_consensus::error::ValueError; use alloy_evm::EvmEnv; use alloy_network::TxSigner; use op_alloy_consensus::OpTxEnvelope; use op_alloy_rpc_types::{OpTransactionReceipt, OpTransactionRequest}; use reth_op::rpc::RpcTypes; use reth_rpc_api::eth::{ EthTxEnvError, SignTxRequestError, SignableTxRequest, TryIntoSimTx, TryIntoTxEnv, }; use revm::context::BlockEnv; #[derive(Debug, Clone, Copy, Default)] #[non_exhaustive] pub struct CustomRpcTypes; impl RpcTypes for CustomRpcTypes { type Header = alloy_rpc_types_eth::Header; type Receipt = OpTransactionReceipt; type TransactionRequest = OpTransactionRequest; type TransactionResponse = op_alloy_rpc_types::Transaction; } impl TryIntoSimTx for OpTransactionRequest { fn try_into_sim_tx(self) -> Result> { Ok(CustomTransaction::Op(self.try_into_sim_tx()?)) } } impl TryIntoTxEnv for OpTransactionRequest { type Err = EthTxEnvError; fn try_into_tx_env( self, evm_env: &EvmEnv, ) -> Result { Ok(CustomTxEnv::Op(self.try_into_tx_env(evm_env)?)) } } impl SignableTxRequest for OpTransactionRequest { async fn try_build_and_sign( self, signer: impl TxSigner + Send, ) -> Result { Ok(CustomTransaction::Op( SignableTxRequest::::try_build_and_sign(self, signer).await?, )) } }