1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! # ethrex RPC
//!
//! This crate implements the Ethereum JSON-RPC API for the ethrex node.
//!
//! ## Overview
//!
//! The RPC server provides three interfaces:
//! - **HTTP API**: Public JSON-RPC endpoint for client requests (`eth_*`, `debug_*`, `net_*`, etc.)
//! - **WebSocket API**: Optional WebSocket endpoint for subscriptions and real-time updates
//! - **Auth RPC API**: Authenticated endpoint for consensus client communication (`engine_*` methods)
//!
//! ## Supported Namespaces
//!
//! - `eth`: Standard Ethereum methods (blocks, transactions, accounts, gas estimation)
//! - `engine`: Consensus layer methods for block building and fork choice
//! - `debug`: Debugging methods (raw blocks, execution witnesses, tracing)
//! - `net`: Network information methods
//! - `admin`: Node administration methods
//! - `web3`: Web3 utility methods
//! - `txpool`: Transaction pool inspection methods
//!
//! ## Usage
//!
//! ```ignore
//! use ethrex_rpc::{start_api, RpcApiContext};
//!
//! // Start the RPC server
//! start_api(
//! http_addr,
//! ws_addr,
//! authrpc_addr,
//! storage,
//! blockchain,
//! jwt_secret,
//! // ... other parameters
//! ).await?;
//! ```
//!
//! ## Implementing Custom RPC Handlers
//!
//! Implement the [`RpcHandler`] trait to create custom RPC endpoints:
//!
//! ```ignore
//! use ethrex_rpc::{RpcHandler, RpcApiContext, RpcErr};
//!
//! struct MyHandler { /* fields */ }
//!
//! impl RpcHandler for MyHandler {
//! fn parse(params: &Option<Vec<Value>>) -> Result<Self, RpcErr> {
//! // Parse JSON-RPC parameters
//! }
//!
//! async fn handle(&self, context: RpcApiContext) -> Result<Value, RpcErr> {
//! // Handle the request
//! }
//! }
//! ```
// This is added because otherwise some tests would fail due to reaching the recursion limit
pub use ;
pub use ;
// TODO: These exports are needed by ethrex-l2-rpc, but we do not want to
// export them in the public API of this crate.
pub use ;
pub use ;
pub use ;
pub use ;
/// Default namespaces enabled on the public HTTP/WS RPC endpoint.
///
/// Operators who need `admin`, `debug` or `txpool` must enable them explicitly
/// via `--http.api`.
pub const DEFAULT_HTTP_API: & =
&;