reth_rpc_eth_api/
types.rs1use crate::{AsEthApiError, FromEthApiError, RpcNodeCore};
4use alloy_rpc_types_eth::Block;
5use reth_chain_state::CanonStateSubscriptions;
6use reth_rpc_convert::RpcConvert;
7pub use reth_rpc_convert::{RpcTransaction, RpcTxReq, RpcTypes};
8use reth_storage_api::{ProviderTx, ReceiptProvider, TransactionsProvider};
9use reth_transaction_pool::{PoolTransaction, TransactionPool};
10use std::{
11 error::Error,
12 fmt::{self},
13};
14
15pub trait EthApiTypes: Send + Sync + Clone {
24 type Error: Into<jsonrpsee_types::error::ErrorObject<'static>>
26 + FromEthApiError
27 + AsEthApiError
28 + Error
29 + Send
30 + Sync;
31 type NetworkTypes: RpcTypes;
33 type RpcConvert: Send + Sync + Clone + fmt::Debug;
35
36 fn tx_resp_builder(&self) -> &Self::RpcConvert;
38}
39
40pub type RpcBlock<T> = Block<RpcTransaction<T>, RpcHeader<T>>;
42
43pub type RpcReceipt<T> = <T as RpcTypes>::Receipt;
45
46pub type RpcHeader<T> = <T as RpcTypes>::Header;
48
49pub type RpcError<T> = <T as EthApiTypes>::Error;
51
52pub trait FullEthApiTypes
54where
55 Self: RpcNodeCore<
56 Provider: TransactionsProvider + ReceiptProvider + CanonStateSubscriptions,
57 Pool: TransactionPool<
58 Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>,
59 >,
60 > + EthApiTypes<
61 RpcConvert: RpcConvert<
62 Primitives = Self::Primitives,
63 Network = Self::NetworkTypes,
64 Error = RpcError<Self>,
65 >,
66 >,
67{
68}
69
70impl<T> FullEthApiTypes for T where
71 T: RpcNodeCore<
72 Provider: TransactionsProvider + ReceiptProvider + CanonStateSubscriptions,
73 Pool: TransactionPool<
74 Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>,
75 >,
76 > + EthApiTypes<
77 RpcConvert: RpcConvert<
78 Primitives = <Self as RpcNodeCore>::Primitives,
79 Network = Self::NetworkTypes,
80 Error = RpcError<T>,
81 >,
82 >
83{
84}