tempo_node/rpc/admin.rs
1use alloy_primitives::B256;
2use jsonrpsee::{core::RpcResult, proc_macros::rpc};
3
4#[rpc(server, namespace = "admin")]
5pub trait TempoAdminApi {
6 /// Returns the validator public key if configured.
7 ///
8 /// This method exposes the ed25519 public key used by this node
9 /// for validator operations in the consensus layer.
10 ///
11 /// Returns `null` if the node is not configured as a validator.
12 #[method(name = "validatorKey")]
13 async fn validator_key(&self) -> RpcResult<Option<B256>>;
14}
15
16/// Tempo-specific `admin_` namespace extensions.
17#[derive(Debug, Clone)]
18pub struct TempoAdminApi {
19 validator_key: Option<B256>,
20}
21
22impl TempoAdminApi {
23 /// Create a new admin API handler.
24 pub fn new(validator_key: Option<B256>) -> Self {
25 Self { validator_key }
26 }
27}
28
29#[async_trait::async_trait]
30impl TempoAdminApiServer for TempoAdminApi {
31 async fn validator_key(&self) -> RpcResult<Option<B256>> {
32 Ok(self.validator_key)
33 }
34}