Skip to content

Add missing map helper functions for OpAddons #16519

@mattsse

Description

@mattsse

Describe the feature

ideally we have the same fns:

/// Maps the [`EngineApiBuilder`] builder type.
pub fn with_engine_api<T>(self, engine_api_builder: T) -> RpcAddOns<Node, EthB, EV, T> {
let Self { hooks, eth_api_builder, engine_validator_builder, .. } = self;
RpcAddOns { hooks, eth_api_builder, engine_validator_builder, engine_api_builder }
}
/// Maps the [`EngineValidatorBuilder`] builder type.
pub fn with_engine_validator<T>(
self,
engine_validator_builder: T,
) -> RpcAddOns<Node, EthB, T, EB> {
let Self { hooks, eth_api_builder, engine_api_builder, .. } = self;
RpcAddOns { hooks, eth_api_builder, engine_validator_builder, engine_api_builder }
}
/// Sets the hook that is run once the rpc server is started.
pub fn on_rpc_started<F>(mut self, hook: F) -> Self
where
F: FnOnce(RpcContext<'_, Node, EthB::EthApi>, RethRpcServerHandles) -> eyre::Result<()>
+ Send
+ 'static,
{
self.hooks.set_on_rpc_started(hook);
self
}
/// Sets the hook that is run to configure the rpc modules.
pub fn extend_rpc_modules<F>(mut self, hook: F) -> Self
where
F: FnOnce(RpcContext<'_, Node, EthB::EthApi>) -> eyre::Result<()> + Send + 'static,
{
self.hooks.set_extend_rpc_modules(hook);
self
}

so that we can use this directly on OpAddons, instead of:

OpAddOns::default().rpc_add_ons.with_engine_api(...)

ref #16248

Additional context

No response

Metadata

Metadata

Assignees

Labels

C-enhancementNew feature or requestD-good-first-issueNice and easy! A great choice to get started

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions