explorer-api: add API resource to show the delegations for each mix node
This commit is contained in:
@@ -6,11 +6,11 @@ use serde::Serialize;
|
||||
use mixnet_contract::{Addr, Coin, Layer, MixNode};
|
||||
|
||||
use crate::mix_node::models::{NodeDescription, NodeStats};
|
||||
use crate::mix_nodes::Location;
|
||||
use crate::mix_nodes::{get_mixnode_delegations, Location};
|
||||
use crate::state::ExplorerApiStateContext;
|
||||
|
||||
pub fn mix_node_make_default_routes() -> Vec<Route> {
|
||||
routes_with_openapi![get_description, get_stats, list]
|
||||
routes_with_openapi![get_delegations, get_description, get_stats, list]
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, JsonSchema)]
|
||||
@@ -51,6 +51,12 @@ pub(crate) async fn list(
|
||||
)
|
||||
}
|
||||
|
||||
#[openapi(tag = "mix_node")]
|
||||
#[get("/<pubkey>/delegations")]
|
||||
pub(crate) async fn get_delegations(pubkey: &str) -> Json<Vec<mixnet_contract::Delegation>> {
|
||||
Json(get_mixnode_delegations(pubkey).await)
|
||||
}
|
||||
|
||||
#[openapi(tag = "mix_node")]
|
||||
#[get("/<pubkey>/description")]
|
||||
pub(crate) async fn get_description(
|
||||
|
||||
Reference in New Issue
Block a user