diff --git a/crates/rpc-jsonrpsee/Cargo.toml b/crates/rpc-jsonrpsee/Cargo.toml index d38c18598..721ab0510 100644 --- a/crates/rpc-jsonrpsee/Cargo.toml +++ b/crates/rpc-jsonrpsee/Cargo.toml @@ -17,6 +17,7 @@ workspace = true [dependencies] # Alloy op-alloy-rpc-types.workspace = true +op-alloy-rpc-types-engine = { workspace = true, features = ["serde"] } alloy-eips.workspace = true alloy-primitives.workspace = true diff --git a/crates/rpc-jsonrpsee/src/traits.rs b/crates/rpc-jsonrpsee/src/traits.rs index 2b42a91bc..9bf7bf5ea 100644 --- a/crates/rpc-jsonrpsee/src/traits.rs +++ b/crates/rpc-jsonrpsee/src/traits.rs @@ -12,6 +12,7 @@ use op_alloy_rpc_types::{ safe_head::SafeHeadResponse, sync::SyncStatus, }; +use op_alloy_rpc_types_engine::{ProtocolVersion, SuperchainSignal}; use std::net::IpAddr; /// Optimism specified rpc interface. @@ -120,3 +121,21 @@ pub trait OpAdminApi { #[method(name = "sequencerActive")] async fn admin_sequencer_active(&self) -> RpcResult; } + +/// Engine API extension for Optimism superchain signaling +#[cfg_attr(not(feature = "client"), rpc(server, namespace = "engine"))] +#[cfg_attr(feature = "client", rpc(server, client, namespace = "engine"))] +pub trait EngineApiExt { + /// Signal superchain v1 message + /// + /// The execution engine SHOULD warn when the recommended version is newer than the current + /// version. The execution engine SHOULD take safety precautions if it does not meet + /// the required version. + /// + /// # Returns + /// The latest supported OP-Stack protocol version of the execution engine. + /// + /// See: + #[method(name = "signalSuperchainV1")] + async fn signal_superchain_v1(&self, signal: SuperchainSignal) -> RpcResult; +}