reth_rpc_eth_api/helpers/
mod.rs

1//! Behaviour needed to serve `eth_` RPC requests, divided into general database reads and
2//! specific database access.
3//!
4//! Traits with `Load` prefix, read atomic data from database, e.g. a block or transaction. Any
5//! database read done in more than one default `Eth` trait implementation, is defined in a `Load`
6//! trait.
7//!
8//! Traits with `Eth` prefix, compose specific data needed to serve RPC requests in the `eth`
9//! namespace. They use `Load` traits as building blocks. [`EthTransactions`] also writes data
10//! (submits transactions). Based on the `eth_` request method semantics, request methods are
11//! divided into: [`EthTransactions`], [`EthBlocks`], [`EthFees`], [`EthState`] and [`EthCall`].
12//! Default implementation of the `Eth` traits, is done w.r.t. L1.
13//!
14//! [`EthApiServer`](crate::EthApiServer), is implemented for any type that implements
15//! all the `Eth` traits, e.g. `reth_rpc::EthApi`.
16
17pub mod block;
18pub mod blocking_task;
19pub mod call;
20pub mod estimate;
21pub mod fee;
22pub mod pending_block;
23pub mod receipt;
24pub mod signer;
25pub mod spec;
26pub mod state;
27pub mod trace;
28pub mod transaction;
29
30pub use block::{EthBlocks, LoadBlock};
31pub use blocking_task::SpawnBlocking;
32pub use call::{Call, EthCall};
33pub use fee::{EthFees, LoadFee};
34pub use pending_block::LoadPendingBlock;
35pub use receipt::LoadReceipt;
36pub use signer::{AddDevSigners, EthSigner};
37pub use spec::EthApiSpec;
38pub use state::{EthState, LoadState};
39pub use trace::Trace;
40pub use transaction::{EthTransactions, LoadTransaction};
41
42use crate::FullEthApiTypes;
43
44/// Extension trait that bundles traits needed for tracing transactions.
45pub trait TraceExt: LoadTransaction + LoadBlock + SpawnBlocking + Trace + Call {}
46
47impl<T> TraceExt for T where T: LoadTransaction + LoadBlock + Trace + Call {}
48
49/// Helper trait to unify all `eth` rpc server building block traits, for simplicity.
50///
51/// This trait is automatically implemented for any type that implements all the `Eth` traits.
52pub trait FullEthApi:
53    FullEthApiTypes
54    + EthApiSpec
55    + EthTransactions
56    + EthBlocks
57    + EthState
58    + EthCall
59    + EthFees
60    + Trace
61    + LoadReceipt
62{
63}
64
65impl<T> FullEthApi for T where
66    T: FullEthApiTypes
67        + EthApiSpec
68        + EthTransactions
69        + EthBlocks
70        + EthState
71        + EthCall
72        + EthFees
73        + Trace
74        + LoadReceipt
75{
76}