// Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 use crate::contract_cache::ValidatorCache; use mixnet_contract_common::reward_params::EpochRewardParams; use mixnet_contract_common::{GatewayBond, Interval, MixNodeBond}; use rocket::serde::json::Json; use rocket::State; use std::collections::HashSet; #[get("/mixnodes")] pub async fn get_mixnodes(cache: &State) -> Json> { Json(cache.mixnodes().await) } #[get("/gateways")] pub async fn get_gateways(cache: &State) -> Json> { Json(cache.gateways().await) } #[get("/mixnodes/rewarded")] pub async fn get_rewarded_set(cache: &State) -> Json> { Json(cache.rewarded_set().await.value) } #[get("/mixnodes/active")] pub async fn get_active_set(cache: &State) -> Json> { Json(cache.active_set().await.value) } #[get("/mixnodes/blacklisted")] pub async fn get_blacklisted_mixnodes(cache: &State) -> Json> { Json(cache.mixnodes_blacklist().await.value) } #[get("/gateways/blacklisted")] pub async fn get_blacklisted_gateways(cache: &State) -> Json> { Json(cache.gateways_blacklist().await.value) } #[get("/epoch/reward_params")] pub async fn get_epoch_reward_params(cache: &State) -> Json { Json(cache.epoch_reward_params().await.value) } #[get("/epoch/current")] pub async fn get_current_epoch(cache: &State) -> Json> { Json(cache.current_epoch().await.value) }