Feature/validator api client endpoints (#1024)
* Moved mixnode status route to node status api module * Introduced validator-api endpoint for estimating mixnode's reward * Stake saturation endpoint * kebab-cased coconut routes * Created separate crate for validator API models * Additional routes in validator API client * Introduced support for new queries in the wallet * Typescript type derivation * Fixed up date in license notice
This commit is contained in:
committed by
GitHub
parent
835d4f46f6
commit
e2e06df4e6
@@ -0,0 +1,4 @@
|
||||
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
pub mod models;
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum MixnodeStatus {
|
||||
Active, // in both the active set and the rewarded set
|
||||
Standby, // only in the rewarded set
|
||||
Inactive, // in neither the rewarded set nor the active set, but is bonded
|
||||
NotFound, // doesn't even exist in the bonded set
|
||||
}
|
||||
|
||||
impl MixnodeStatus {
|
||||
pub fn is_active(&self) -> bool {
|
||||
*self == MixnodeStatus::Active
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
pub struct CoreNodeStatusResponse {
|
||||
pub identity: String,
|
||||
pub count: i32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
pub struct MixnodeStatusResponse {
|
||||
pub status: MixnodeStatus,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
pub struct RewardEstimationResponse {
|
||||
pub estimated_total_node_reward: u128,
|
||||
pub estimated_operator_reward: u128,
|
||||
pub estimated_delegators_reward: u128,
|
||||
|
||||
pub current_epoch_start: i64,
|
||||
pub current_epoch_end: i64,
|
||||
pub current_epoch_uptime: u8,
|
||||
pub as_at: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
pub struct StakeSaturationResponse {
|
||||
pub saturation: f32,
|
||||
pub as_at: i64,
|
||||
}
|
||||
Reference in New Issue
Block a user