mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: Feat/add on rpc server started hook (#4947)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -6,7 +6,9 @@ use reth_provider::{
|
||||
AccountReader, BlockReaderIdExt, CanonStateSubscriptions, ChainSpecProvider, ChangeSetReader,
|
||||
EvmEnvProvider, StateProviderFactory,
|
||||
};
|
||||
use reth_rpc_builder::{RethModuleRegistry, TransportRpcModules};
|
||||
use reth_rpc_builder::{
|
||||
auth::AuthServerHandle, RethModuleRegistry, RpcServerHandle, TransportRpcModules,
|
||||
};
|
||||
use reth_tasks::TaskSpawner;
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
use std::sync::Arc;
|
||||
@ -143,3 +145,25 @@ where
|
||||
self.events.clone()
|
||||
}
|
||||
}
|
||||
|
||||
/// Contains the handles to the spawned RPC servers.
|
||||
///
|
||||
/// This can be used to access the endpoints of the servers.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use reth::cli::components::RethRpcServerHandles;
|
||||
/// use reth::rpc::api::EthApiClient;
|
||||
/// # async fn t(handles: RethRpcServerHandles) {
|
||||
/// let client = handles.rpc.http_client().expect("http server not started");
|
||||
/// let block_number = client.block_number().await.unwrap();
|
||||
/// # }
|
||||
/// ```
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RethRpcServerHandles {
|
||||
/// The regular RPC server handle.
|
||||
pub rpc: RpcServerHandle,
|
||||
/// The handle to the auth server (engine API)
|
||||
pub auth: AuthServerHandle,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user