Skip to content

Commit

Permalink
Merge pull request #5401 from nymtech/jmwample/nym-api-route
Browse files Browse the repository at this point in the history
Relocate a validator api function
  • Loading branch information
jmwample authored Jan 30, 2025
2 parents d62bc0a + 882003c commit 5dcc1ed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions common/client-libs/validator-client/src/nym_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1027,6 +1028,15 @@ pub trait NymApiClientExt: ApiClient {
)
.await
}

#[instrument(level = "debug", skip(self))]
async fn get_network_details(&self) -> Result<NymNetworkDetailsResponse, NymAPIError> {
self.get_json(
&[routes::API_VERSION, routes::NETWORK, routes::DETAILS],
NO_PARAMS,
)
.await
}
}

#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
Expand Down
4 changes: 3 additions & 1 deletion common/client-libs/validator-client/src/nym_api/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ 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";
1 change: 1 addition & 0 deletions nym-api/nym-api-requests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
6 changes: 6 additions & 0 deletions nym-api/nym-api-requests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self>
where
Expand Down

0 comments on commit 5dcc1ed

Please sign in to comment.