reth_rpc_eth_api/
types.rsuse std::{
error::Error,
fmt::{self},
};
use alloy_network::Network;
use alloy_rpc_types_eth::Block;
use reth_provider::{ProviderTx, ReceiptProvider, TransactionsProvider};
use reth_rpc_types_compat::TransactionCompat;
use reth_transaction_pool::{PoolTransaction, TransactionPool};
use crate::{AsEthApiError, FromEthApiError, FromEvmError, RpcNodeCore};
pub trait EthApiTypes: Send + Sync + Clone {
type Error: Into<jsonrpsee_types::error::ErrorObject<'static>>
+ FromEthApiError
+ AsEthApiError
+ FromEvmError
+ Error
+ Send
+ Sync;
type NetworkTypes: Network;
type TransactionCompat: Send + Sync + Clone + fmt::Debug;
fn tx_resp_builder(&self) -> &Self::TransactionCompat;
}
pub type RpcTransaction<T> = <T as Network>::TransactionResponse;
pub type RpcBlock<T> = Block<RpcTransaction<T>, <T as Network>::HeaderResponse>;
pub type RpcReceipt<T> = <T as Network>::ReceiptResponse;
pub type RpcHeader<T> = <T as Network>::HeaderResponse;
pub type RpcError<T> = <T as EthApiTypes>::Error;
pub trait FullEthApiTypes
where
Self: RpcNodeCore<
Provider: TransactionsProvider + ReceiptProvider,
Pool: TransactionPool<
Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>,
>,
> + EthApiTypes<
TransactionCompat: TransactionCompat<
<Self::Provider as TransactionsProvider>::Transaction,
Transaction = RpcTransaction<Self::NetworkTypes>,
Error = RpcError<Self>,
>,
>,
{
}
impl<T> FullEthApiTypes for T where
T: RpcNodeCore<
Provider: TransactionsProvider + ReceiptProvider,
Pool: TransactionPool<
Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>,
>,
> + EthApiTypes<
TransactionCompat: TransactionCompat<
<Self::Provider as TransactionsProvider>::Transaction,
Transaction = RpcTransaction<T::NetworkTypes>,
Error = RpcError<T>,
>,
>
{
}