feat: add EthereumEthApiTypes (#12618)

This commit is contained in:
Matthias Seitz
2024-11-18 12:52:36 +01:00
committed by GitHub
parent 8aaac6d7c2
commit 4daec16272
2 changed files with 21 additions and 2 deletions

View File

@ -4,11 +4,27 @@ use alloy_consensus::{Signed, Transaction as _, TxEip4844Variant, TxEnvelope};
use alloy_network::{Ethereum, Network};
use alloy_rpc_types_eth::{Transaction, TransactionInfo};
use reth_primitives::{TransactionSigned, TransactionSignedEcRecovered};
use reth_rpc_eth_api::EthApiTypes;
use reth_rpc_eth_types::EthApiError;
use reth_rpc_types_compat::TransactionCompat;
/// A standalone [`EthApiTypes`] implementation for Ethereum.
#[derive(Debug, Clone, Copy, Default)]
pub struct EthereumEthApiTypes(EthTxBuilder);
impl EthApiTypes for EthereumEthApiTypes {
type Error = EthApiError;
type NetworkTypes = Ethereum;
type TransactionCompat = EthTxBuilder;
fn tx_resp_builder(&self) -> &Self::TransactionCompat {
&self.0
}
}
/// Builds RPC transaction response for l1.
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Default)]
#[non_exhaustive]
pub struct EthTxBuilder;
impl TransactionCompat for EthTxBuilder

View File

@ -13,6 +13,9 @@ pub use core::EthApi;
pub use filter::EthFilter;
pub use pubsub::EthPubSub;
pub use helpers::{signer::DevSigner, types::EthTxBuilder};
pub use helpers::{
signer::DevSigner,
types::{EthTxBuilder, EthereumEthApiTypes},
};
pub use reth_rpc_eth_api::{EthApiServer, EthApiTypes, FullEthApiServer, RpcNodeCore};