reth_rpc_eth_api/
types.rs1use crate::{AsEthApiError, FromEthApiError, RpcNodeCore};
4use alloy_rpc_types_eth::Block;
5use reth_rpc_convert::{RpcConvert, SignableTxRequest};
6pub use reth_rpc_convert::{RpcTransaction, RpcTxReq, RpcTypes};
7use reth_storage_api::ProviderTx;
8use std::{
9 error::Error,
10 fmt::{self},
11};
12
13pub trait EthApiTypes: Send + Sync + Clone {
22 type Error: Into<jsonrpsee_types::error::ErrorObject<'static>>
24 + FromEthApiError
25 + AsEthApiError
26 + Error
27 + Send
28 + Sync;
29 type NetworkTypes: RpcTypes;
31 type RpcConvert: Send + Sync + fmt::Debug;
33
34 fn tx_resp_builder(&self) -> &Self::RpcConvert;
36}
37
38pub type RpcBlock<T> = Block<RpcTransaction<T>, RpcHeader<T>>;
40
41pub type RpcReceipt<T> = <T as RpcTypes>::Receipt;
43
44pub type RpcHeader<T> = <T as RpcTypes>::Header;
46
47pub type RpcError<T> = <T as EthApiTypes>::Error;
49
50pub trait FullEthApiTypes
52where
53 Self: RpcNodeCore
54 + EthApiTypes<
55 NetworkTypes: RpcTypes<
56 TransactionRequest: SignableTxRequest<ProviderTx<Self::Provider>>,
57 >,
58 RpcConvert: RpcConvert<
59 Primitives = Self::Primitives,
60 Network = Self::NetworkTypes,
61 Error = RpcError<Self>,
62 >,
63 >,
64{
65}
66
67impl<T> FullEthApiTypes for T where
68 T: RpcNodeCore
69 + EthApiTypes<
70 NetworkTypes: RpcTypes<
71 TransactionRequest: SignableTxRequest<ProviderTx<Self::Provider>>,
72 >,
73 RpcConvert: RpcConvert<
74 Primitives = <Self as RpcNodeCore>::Primitives,
75 Network = Self::NetworkTypes,
76 Error = RpcError<T>,
77 >,
78 >
79{
80}