feat: add helpers to obtain the engine API client (#7413)

This commit is contained in:
Matthias Seitz
2024-04-01 19:25:49 +02:00
committed by GitHub
parent 2de0bc4976
commit 9e55ba6d13
2 changed files with 36 additions and 21 deletions

View File

@ -9,7 +9,10 @@ pub use reth_node_api::NodeTypes;
use reth_node_core::{
dirs::{ChainPath, DataDirPath},
node_config::NodeConfig,
rpc::builder::{auth::AuthServerHandle, RpcServerHandle},
rpc::{
api::EngineApiClient,
builder::{auth::AuthServerHandle, RpcServerHandle},
},
};
use reth_payload_builder::PayloadBuilderHandle;
use reth_primitives::ChainSpec;
@ -124,6 +127,20 @@ impl<Node: FullNodeComponents> FullNode<Node> {
pub fn auth_server_handle(&self) -> &AuthServerHandle {
&self.rpc_server_handles.auth
}
/// Returns the [EngineApiClient] interface for the authenticated engine API.
///
/// This will send authenticated http requests to the node's auth server.
pub fn engine_http_client(&self) -> impl EngineApiClient<Node::Engine> {
self.auth_server_handle().http_client()
}
/// Returns the [EngineApiClient] interface for the authenticated engine API.
///
/// This will send authenticated ws requests to the node's auth server.
pub async fn engine_ws_client(&self) -> impl EngineApiClient<Node::Engine> {
self.auth_server_handle().ws_client().await
}
}
impl<Node: FullNodeComponents> Clone for FullNode<Node> {