diff --git a/Cargo.lock b/Cargo.lock index e2de42eb3f..dc3e64471f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4832,6 +4832,7 @@ dependencies = [ "ecdsa", "getset", "nym-compact-ecash", + "nym-config", "nym-contracts-common", "nym-credentials-interface", "nym-crypto", diff --git a/common/client-libs/validator-client/src/nym_api/mod.rs b/common/client-libs/validator-client/src/nym_api/mod.rs index d790deda70..3103f60870 100644 --- a/common/client-libs/validator-client/src/nym_api/mod.rs +++ b/common/client-libs/validator-client/src/nym_api/mod.rs @@ -31,6 +31,7 @@ pub use nym_api_requests::{ StakeSaturationResponse, UptimeResponse, }, nym_nodes::{CachedNodesResponse, SkimmedNode}, + NymNetworkDetailsResponse }; pub use nym_coconut_dkg_common::types::EpochId; use nym_contracts_common::IdentityKey; @@ -1027,6 +1028,21 @@ pub trait NymApiClientExt: ApiClient { ) .await } + + #[instrument(level = "debug", skip(self))] + async fn get_network_details( + &self, + ) -> Result { + self.get_json( + &[ + routes::API_VERSION, + routes::NETWORK, + routes::DETAILS, + ], + NO_PARAMS, + ) + .await + } } #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] diff --git a/common/client-libs/validator-client/src/nym_api/routes.rs b/common/client-libs/validator-client/src/nym_api/routes.rs index ec14678279..dfb4a64b7b 100644 --- a/common/client-libs/validator-client/src/nym_api/routes.rs +++ b/common/client-libs/validator-client/src/nym_api/routes.rs @@ -67,6 +67,9 @@ pub const STAKE_SATURATION: &str = "stake-saturation"; pub const INCLUSION_CHANCE: &str = "inclusion-probability"; pub const SUBMIT_GATEWAY: &str = "submit-gateway-monitoring-results"; pub const SUBMIT_NODE: &str = "submit-node-monitoring-results"; -pub const PERFORMANCE: &str = "performance"; + pub const SERVICE_PROVIDERS: &str = "services"; + +pub const DETAILS: &str = "details"; +pub const NETWORK: &str = "network"; \ No newline at end of file diff --git a/nym-api/nym-api-requests/Cargo.toml b/nym-api/nym-api-requests/Cargo.toml index a67960e1e3..3d66ad2bb9 100644 --- a/nym-api/nym-api-requests/Cargo.toml +++ b/nym-api/nym-api-requests/Cargo.toml @@ -28,6 +28,7 @@ nym-serde-helpers = { path = "../../common/serde-helpers", features = ["bs58", " nym-credentials-interface = { path = "../../common/credentials-interface" } nym-crypto = { path = "../../common/crypto", features = ["serde", "asymmetric"] } +nym-config = { path = "../../common/config" } nym-ecash-time = { path = "../../common/ecash-time" } nym-compact-ecash = { path = "../../common/nym_offline_compact_ecash" } nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common", features = ["naive_float"] } diff --git a/nym-api/nym-api-requests/src/lib.rs b/nym-api/nym-api-requests/src/lib.rs index 664eb59fff..681f1c6b0f 100644 --- a/nym-api/nym-api-requests/src/lib.rs +++ b/nym-api/nym-api-requests/src/lib.rs @@ -12,6 +12,12 @@ pub mod models; pub mod nym_nodes; pub mod pagination; +// The response type we fetch from the network details endpoint. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct NymNetworkDetailsResponse { + pub network: nym_config::defaults::NymNetworkDetails, +} + pub trait Deprecatable { fn deprecate(self) -> Deprecated where