use crate::types::discv5::{Enr, NodeId, NodeInfo, RoutingTableInfo};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
#[cfg(any(feature = "client", feature = "server"))]
#[cfg_attr(feature = "client", rpc(client, namespace = "discv5"))]
#[cfg_attr(feature = "server", rpc(server, namespace = "discv5"))]
pub trait Discv5Api {
#[method(name = "nodeInfo")]
async fn node_info(&self) -> RpcResult<NodeInfo>;
#[method(name = "updateNodeInfo")]
async fn update_node_info(
&self,
socket_addr: String,
is_tcp: Option<bool>,
) -> RpcResult<NodeInfo>;
#[method(name = "routingTableInfo")]
async fn routing_table_info(&self) -> RpcResult<RoutingTableInfo>;
#[method(name = "addEnr")]
async fn add_enr(&self, enr: Enr) -> RpcResult<bool>;
#[method(name = "getEnr")]
async fn get_enr(&self, node_id: NodeId) -> RpcResult<Enr>;
#[method(name = "deleteEnr")]
async fn delete_enr(&self, node_id: NodeId) -> RpcResult<bool>;
#[method(name = "lookupEnr")]
async fn lookup_enr(&self, node_id: NodeId, enr_seq: Option<u32>) -> RpcResult<Enr>;
}