diff --git a/common/client-libs/validator-client/src/client.rs b/common/client-libs/validator-client/src/client.rs index eee67ba5093..fc68ae748c6 100644 --- a/common/client-libs/validator-client/src/client.rs +++ b/common/client-libs/validator-client/src/client.rs @@ -17,7 +17,6 @@ use nym_api_requests::ecash::{ BlindSignRequestBody, BlindedSignatureResponse, PartialCoinIndicesSignatureResponse, PartialExpirationDateSignatureResponse, VerificationKeyResponse, }; -use nym_api_requests::legacy::LegacyGatewayBondWithId; use nym_api_requests::models::{ GatewayCoreStatusResponse, MixnodeCoreStatusResponse, MixnodeStatusResponse, RewardEstimationResponse, StakeSaturationResponse, @@ -240,9 +239,7 @@ impl Client { Ok(self.nym_api.get_active_mixnodes_detailed().await?) } - pub async fn get_cached_gateways( - &self, - ) -> Result, ValidatorClientError> { + pub async fn get_cached_gateways(&self) -> Result, ValidatorClientError> { Ok(self.nym_api.get_gateways().await?) } @@ -324,9 +321,7 @@ impl NymApiClient { Ok(self.nym_api.get_mixnodes().await?) } - pub async fn get_cached_gateways( - &self, - ) -> Result, ValidatorClientError> { + pub async fn get_cached_gateways(&self) -> Result, ValidatorClientError> { Ok(self.nym_api.get_gateways().await?) } 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 2ecadd76416..a664a503abc 100644 --- a/common/client-libs/validator-client/src/nym_api/mod.rs +++ b/common/client-libs/validator-client/src/nym_api/mod.rs @@ -10,7 +10,6 @@ use nym_api_requests::ecash::models::{ VerifyEcashTicketBody, }; use nym_api_requests::ecash::VerificationKeyResponse; -use nym_api_requests::legacy::LegacyGatewayBondWithId; use nym_api_requests::models::{ AnnotationResponse, LegacyDescribedMixNode, NodePerformanceResponse, }; @@ -38,7 +37,7 @@ use nym_contracts_common::IdentityKey; pub use nym_http_api_client::Client; use nym_http_api_client::{ApiClient, NO_PARAMS}; use nym_mixnet_contract_common::mixnode::MixNodeDetails; -use nym_mixnet_contract_common::{IdentityKeyRef, NodeId}; +use nym_mixnet_contract_common::{GatewayBond, IdentityKeyRef, NodeId}; use time::format_description::BorrowedFormatItem; use time::Date; @@ -98,7 +97,7 @@ pub trait NymApiClientExt: ApiClient { .await } - async fn get_gateways(&self) -> Result, NymAPIError> { + async fn get_gateways(&self) -> Result, NymAPIError> { self.get_json(&[routes::API_VERSION, routes::GATEWAYS], NO_PARAMS) .await } diff --git a/explorer-api/src/gateways/models.rs b/explorer-api/src/gateways/models.rs index c3a2cd90628..a3ed4060672 100644 --- a/explorer-api/src/gateways/models.rs +++ b/explorer-api/src/gateways/models.rs @@ -3,8 +3,7 @@ use crate::{cache::Cache, location::LocationCacheItem}; use nym_explorer_api_requests::{Location, PrettyDetailedGatewayBond}; -use nym_mixnet_contract_common::IdentityKey; -use nym_validator_client::legacy::LegacyGatewayBondWithId; +use nym_mixnet_contract_common::{GatewayBond, IdentityKey}; use serde::Serialize; use std::{sync::Arc, time::SystemTime}; use tokio::sync::RwLock; @@ -12,7 +11,7 @@ use tokio::sync::RwLock; use super::location::GatewayLocationCache; pub(crate) struct GatewayCache { - pub(crate) gateways: Cache, + pub(crate) gateways: Cache, } #[derive(Clone, Debug, Serialize, JsonSchema)] @@ -38,20 +37,20 @@ impl ThreadsafeGatewayCache { fn create_detailed_gateway( &self, - bond: LegacyGatewayBondWithId, + bond: GatewayBond, location: Option<&LocationCacheItem>, ) -> PrettyDetailedGatewayBond { PrettyDetailedGatewayBond { - pledge_amount: bond.bond.pledge_amount, - owner: bond.bond.owner, - block_height: bond.bond.block_height, - gateway: bond.bond.gateway, - proxy: bond.bond.proxy, + pledge_amount: bond.pledge_amount, + owner: bond.owner, + block_height: bond.block_height, + gateway: bond.gateway, + proxy: bond.proxy, location: location.and_then(|l| l.location.clone()), } } - pub(crate) async fn get_gateways(&self) -> Vec { + pub(crate) async fn get_gateways(&self) -> Vec { self.gateways.read().await.gateways.get_all() } @@ -107,7 +106,7 @@ impl ThreadsafeGatewayCache { .insert(identy_key, LocationCacheItem::new_from_location(location)); } - pub(crate) async fn update_cache(&self, gateways: Vec) { + pub(crate) async fn update_cache(&self, gateways: Vec) { let mut guard = self.gateways.write().await; for gateway in gateways { diff --git a/explorer-api/src/tasks.rs b/explorer-api/src/tasks.rs index 52c01925386..f14408f1c88 100644 --- a/explorer-api/src/tasks.rs +++ b/explorer-api/src/tasks.rs @@ -1,8 +1,8 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use nym_mixnet_contract_common::GatewayBond; use nym_task::TaskClient; -use nym_validator_client::legacy::LegacyGatewayBondWithId; use nym_validator_client::models::MixNodeBondAnnotated; use nym_validator_client::nyxd::error::NyxdError; use nym_validator_client::nyxd::{Paging, TendermintRpcClient, ValidatorResponse}; @@ -47,9 +47,7 @@ impl ExplorerApiTasks { .await } - async fn retrieve_all_gateways( - &self, - ) -> Result, ValidatorClientError> { + async fn retrieve_all_gateways(&self) -> Result, ValidatorClientError> { info!("About to retrieve all gateways..."); self.state .inner