chore(rpc): expose ethapi in node builder for op customisation (#9444)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Emilia Hane
2024-07-16 15:53:03 +02:00
committed by GitHub
parent fcc6307ada
commit 2aa94e9aee
53 changed files with 1117 additions and 664 deletions

View File

@ -19,6 +19,7 @@ use reth::{
providers::{BlockchainProvider, StaticFileProvider},
ProviderFactory,
},
rpc::eth::EthApi,
utils::open_db_read_only,
};
use reth_chainspec::ChainSpecBuilder;
@ -27,7 +28,7 @@ use reth_db_api::models::ClientVersion;
// Bringing up the RPC
use reth::rpc::builder::{
EthApiBuild, RethRpcModule, RpcModuleBuilder, RpcServerConfig, TransportRpcModuleConfig,
RethRpcModule, RpcModuleBuilder, RpcServerConfig, TransportRpcModuleConfig,
};
// Configuring the network parts, ideally also wouldn't need to think about this.
use myrpc_ext::{MyRpcExt, MyRpcExtApiServer};
@ -70,7 +71,7 @@ async fn main() -> eyre::Result<()> {
// Pick which namespaces to expose.
let config = TransportRpcModuleConfig::default().with_http([RethRpcModule::Eth]);
let mut server = rpc_builder.build(config, EthApiBuild::build);
let mut server = rpc_builder.build(config, Box::new(EthApi::with_spawner));
// Add a custom rpc namespace
let custom_rpc = MyRpcExt { provider };