chore: add missing getters (#13444)

This commit is contained in:
Matthias Seitz
2024-12-19 12:33:26 +01:00
committed by GitHub
parent 2eecf75c35
commit 726d064afb

View File

@ -79,6 +79,16 @@ where
+ 'static, + 'static,
>, >,
{ {
/// Returns a reference to the [`EthApiNodeBackend`].
pub fn eth_api(&self) -> &EthApiNodeBackend<N> {
self.inner.eth_api()
}
/// Returns the configured sequencer client, if any.
pub fn sequencer_client(&self) -> Option<&SequencerClient> {
self.inner.sequencer_client()
}
/// Build a [`OpEthApi`] using [`OpEthApiBuilder`]. /// Build a [`OpEthApi`] using [`OpEthApiBuilder`].
pub const fn builder() -> OpEthApiBuilder { pub const fn builder() -> OpEthApiBuilder {
OpEthApiBuilder::new() OpEthApiBuilder::new()
@ -273,6 +283,18 @@ struct OpEthApiInner<N: OpNodeCore> {
sequencer_client: Option<SequencerClient>, sequencer_client: Option<SequencerClient>,
} }
impl<N: OpNodeCore> OpEthApiInner<N> {
/// Returns a reference to the [`EthApiNodeBackend`].
const fn eth_api(&self) -> &EthApiNodeBackend<N> {
&self.eth_api
}
/// Returns the configured sequencer client, if any.
const fn sequencer_client(&self) -> Option<&SequencerClient> {
self.sequencer_client.as_ref()
}
}
/// A type that knows how to build a [`OpEthApi`]. /// A type that knows how to build a [`OpEthApi`].
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct OpEthApiBuilder { pub struct OpEthApiBuilder {