use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::NodeRecord; use reth_rpc_types::NodeInfo; /// Admin namespace rpc interface that gives access to several non-standard RPC methods. #[cfg_attr(not(feature = "client"), rpc(server))] #[cfg_attr(feature = "client", rpc(server, client))] #[async_trait::async_trait] pub trait AdminApi { /// Adds the given node record to the peerset. #[method(name = "admin_addPeer")] fn add_peer(&self, record: NodeRecord) -> RpcResult; /// Disconnects from a remote node if the connection exists. /// /// Returns true if the peer was successfully removed. #[method(name = "admin_removePeer")] fn remove_peer(&self, record: NodeRecord) -> RpcResult; /// Adds the given node record to the trusted peerset. #[method(name = "admin_addTrustedPeer")] fn add_trusted_peer(&self, record: NodeRecord) -> RpcResult; /// Removes a remote node from the trusted peer set, but it does not disconnect it /// automatically. /// /// Returns true if the peer was successfully removed. #[method(name = "admin_removeTrustedPeer")] fn remove_trusted_peer(&self, record: NodeRecord) -> RpcResult; /// Creates an RPC subscription which serves events received from the network. #[subscription( name = "admin_peerEvents", unsubscribe = "admin_peerEvents_unsubscribe", item = String )] fn subscribe_peer_events(&self); /// Returns the ENR of the node. #[method(name = "admin_nodeInfo")] async fn node_info(&self) -> RpcResult; }