fix imports in NS API
This commit is contained in:
@@ -333,15 +333,17 @@ pub(crate) const GATEWAYS_HISTORICAL_COUNT: &str = "gateways.historical.count";
|
|||||||
use crate::node_scraper::models::BridgeInformation;
|
use crate::node_scraper::models::BridgeInformation;
|
||||||
use gateway::GatewaySummary;
|
use gateway::GatewaySummary;
|
||||||
use mixnode::MixnodeSummary;
|
use mixnode::MixnodeSummary;
|
||||||
|
use nym_api_requests::models::described::type_translation::{
|
||||||
|
LewesProtocolDetailsV1, SphinxKeyV1, WebSocketsV1,
|
||||||
|
};
|
||||||
|
use nym_api_requests::models::described::v2::{
|
||||||
|
AuthenticatorDetailsV2, DeclaredRolesV2, DescribedNodeTypeV2, HostInformationV2, HostKeysV2,
|
||||||
|
IpPacketRouterDetailsV2, NetworkRequesterDetailsV2, NymNodeAuxiliaryDetailsV2, NymNodeDataV2,
|
||||||
|
NymNodeDescriptionV2, WireguardDetailsV2,
|
||||||
|
};
|
||||||
use nym_bin_common::build_information::BinaryBuildInformationOwned;
|
use nym_bin_common::build_information::BinaryBuildInformationOwned;
|
||||||
use nym_mixnet_contract_common::NodeId;
|
use nym_mixnet_contract_common::NodeId;
|
||||||
use nym_validator_client::models::{
|
use nym_validator_client::models::{OffsetDateTimeJsonSchemaWrapper, VersionedNoiseKeyV1};
|
||||||
AuthenticatorDetailsV2, DeclaredRolesV2, DescribedNodeTypeV2, HostInformationV2, HostKeysV2,
|
|
||||||
IpPacketRouterDetailsV2, LewesProtocolDetailsV1, NetworkRequesterDetailsV2,
|
|
||||||
NymNodeAuxiliaryDetailsV2, NymNodeDataV2, NymNodeDescriptionV2,
|
|
||||||
OffsetDateTimeJsonSchemaWrapper, SphinxKeyV1, VersionedNoiseKeyV1, WebSocketsV1,
|
|
||||||
WireguardDetailsV2,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
|
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
|
||||||
pub(crate) struct NetworkSummary {
|
pub(crate) struct NetworkSummary {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ use crate::{
|
|||||||
node_scraper::helpers::NodeDescriptionResponse,
|
node_scraper::helpers::NodeDescriptionResponse,
|
||||||
};
|
};
|
||||||
use futures_util::TryStreamExt;
|
use futures_util::TryStreamExt;
|
||||||
|
use nym_api_requests::models::described::v2::NymNodeDescriptionV2;
|
||||||
use nym_node_requests::api::v1::node::models::NodeDescription;
|
use nym_node_requests::api::v1::node::models::NodeDescription;
|
||||||
use nym_validator_client::client::{NodeId, NymNodeDetails};
|
use nym_validator_client::client::{NodeId, NymNodeDetails};
|
||||||
use nym_validator_client::models::NymNodeDescriptionV2;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{error, instrument, warn};
|
use tracing::{error, instrument, warn};
|
||||||
|
|
||||||
|
|||||||
@@ -225,12 +225,14 @@ mod db_tests {
|
|||||||
node_role: serde_json::json!(nym_validator_client::nym_nodes::NodeRole::Mixnode {
|
node_role: serde_json::json!(nym_validator_client::nym_nodes::NodeRole::Mixnode {
|
||||||
layer: 1
|
layer: 1
|
||||||
}),
|
}),
|
||||||
supported_roles: serde_json::json!(nym_validator_client::models::DeclaredRolesV1 {
|
supported_roles: serde_json::json!(
|
||||||
entry: false,
|
nym_api_requests::models::described::type_translation::DeclaredRolesV1 {
|
||||||
mixnode: true,
|
entry: false,
|
||||||
exit_nr: false,
|
mixnode: true,
|
||||||
exit_ipr: false,
|
exit_nr: false,
|
||||||
}),
|
exit_ipr: false,
|
||||||
|
}
|
||||||
|
),
|
||||||
entry: None,
|
entry: None,
|
||||||
performance: "1.0".to_string(),
|
performance: "1.0".to_string(),
|
||||||
self_described: None,
|
self_described: None,
|
||||||
@@ -278,7 +280,7 @@ fn test_nym_node_insert_record_new() {
|
|||||||
mix_port: 1789,
|
mix_port: 1789,
|
||||||
x25519_sphinx_pubkey: x25519_pk,
|
x25519_sphinx_pubkey: x25519_pk,
|
||||||
role: nym_validator_client::nym_nodes::NodeRole::Mixnode { layer: 1 },
|
role: nym_validator_client::nym_nodes::NodeRole::Mixnode { layer: 1 },
|
||||||
supported_roles: nym_validator_client::models::DeclaredRolesV1 {
|
supported_roles: nym_api_requests::models::described::type_translation::DeclaredRolesV1 {
|
||||||
entry: false,
|
entry: false,
|
||||||
mixnode: true,
|
mixnode: true,
|
||||||
exit_nr: false,
|
exit_nr: false,
|
||||||
@@ -305,12 +307,14 @@ fn test_nym_node_insert_record_new() {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
record.supported_roles,
|
record.supported_roles,
|
||||||
serde_json::json!(nym_validator_client::models::DeclaredRolesV1 {
|
serde_json::json!(
|
||||||
entry: false,
|
nym_api_requests::models::described::type_translation::DeclaredRolesV1 {
|
||||||
mixnode: true,
|
entry: false,
|
||||||
exit_nr: false,
|
mixnode: true,
|
||||||
exit_ipr: false,
|
exit_nr: false,
|
||||||
})
|
exit_ipr: false,
|
||||||
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(record.performance, "1");
|
assert_eq!(record.performance, "1");
|
||||||
assert!(record.entry.is_none());
|
assert!(record.entry.is_none());
|
||||||
@@ -330,7 +334,7 @@ fn test_nym_node_insert_record_with_entry() {
|
|||||||
mix_port: 1789,
|
mix_port: 1789,
|
||||||
x25519_sphinx_pubkey: x25519_pk,
|
x25519_sphinx_pubkey: x25519_pk,
|
||||||
role: nym_validator_client::nym_nodes::NodeRole::EntryGateway,
|
role: nym_validator_client::nym_nodes::NodeRole::EntryGateway,
|
||||||
supported_roles: nym_validator_client::models::DeclaredRolesV1 {
|
supported_roles: nym_api_requests::models::described::type_translation::DeclaredRolesV1 {
|
||||||
entry: true,
|
entry: true,
|
||||||
mixnode: false,
|
mixnode: false,
|
||||||
exit_nr: true,
|
exit_nr: true,
|
||||||
@@ -524,12 +528,14 @@ fn test_nym_node_dto_with_invalid_keys() {
|
|||||||
node_role: serde_json::json!(nym_validator_client::nym_nodes::NodeRole::Mixnode {
|
node_role: serde_json::json!(nym_validator_client::nym_nodes::NodeRole::Mixnode {
|
||||||
layer: 1
|
layer: 1
|
||||||
}),
|
}),
|
||||||
supported_roles: serde_json::json!(nym_validator_client::models::DeclaredRolesV1 {
|
supported_roles: serde_json::json!(
|
||||||
entry: false,
|
nym_api_requests::models::described::type_translation::DeclaredRolesV1 {
|
||||||
mixnode: true,
|
entry: false,
|
||||||
exit_nr: false,
|
mixnode: true,
|
||||||
exit_ipr: false,
|
exit_nr: false,
|
||||||
}),
|
exit_ipr: false,
|
||||||
|
}
|
||||||
|
),
|
||||||
entry: None,
|
entry: None,
|
||||||
performance: "1.0".to_string(),
|
performance: "1.0".to_string(),
|
||||||
self_described: None,
|
self_described: None,
|
||||||
@@ -562,12 +568,14 @@ fn test_nym_node_dto_with_invalid_performance() {
|
|||||||
node_role: serde_json::json!(nym_validator_client::nym_nodes::NodeRole::Mixnode {
|
node_role: serde_json::json!(nym_validator_client::nym_nodes::NodeRole::Mixnode {
|
||||||
layer: 1
|
layer: 1
|
||||||
}),
|
}),
|
||||||
supported_roles: serde_json::json!(nym_validator_client::models::DeclaredRolesV1 {
|
supported_roles: serde_json::json!(
|
||||||
entry: false,
|
nym_api_requests::models::described::type_translation::DeclaredRolesV1 {
|
||||||
mixnode: true,
|
entry: false,
|
||||||
exit_nr: false,
|
mixnode: true,
|
||||||
exit_ipr: false,
|
exit_nr: false,
|
||||||
}),
|
exit_ipr: false,
|
||||||
|
}
|
||||||
|
),
|
||||||
entry: None,
|
entry: None,
|
||||||
performance: "invalid_percent".to_string(),
|
performance: "invalid_percent".to_string(),
|
||||||
self_described: None,
|
self_described: None,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
|
use crate::db::models::NymNodeDataDeHelper;
|
||||||
|
use crate::monitor::geodata;
|
||||||
|
use crate::node_scraper::models::BridgeInformation;
|
||||||
use crate::{
|
use crate::{
|
||||||
http::models::gw_probe::{
|
http::models::gw_probe::{
|
||||||
DvpnGwProbe, DvpnProbeOutcome, LastProbeResult, ScoreValue, calc_gateway_visual_score,
|
DvpnGwProbe, DvpnProbeOutcome, LastProbeResult, ScoreValue, calc_gateway_visual_score,
|
||||||
@@ -9,15 +12,19 @@ use crate::{
|
|||||||
monitor::ExplorerPrettyBond,
|
monitor::ExplorerPrettyBond,
|
||||||
};
|
};
|
||||||
use cosmwasm_std::{Addr, Coin, Decimal};
|
use cosmwasm_std::{Addr, Coin, Decimal};
|
||||||
|
use nym_api_requests::models::described::type_translation::{
|
||||||
|
AuthenticatorDetailsV1, IpPacketRouterDetailsV1,
|
||||||
|
LewesProtocolDetailsDataV1 as LewesProtocolDetailsDataV1Validator,
|
||||||
|
LewesProtocolDetailsV1 as LewesProtocolDetailsV1Validator,
|
||||||
|
};
|
||||||
|
use nym_api_requests::models::described::v1::DescribedNodeTypeV1;
|
||||||
|
use nym_api_requests::models::described::v2::NymNodeDataV2;
|
||||||
use nym_mixnet_contract_common::{CoinSchema, NodeRewarding};
|
use nym_mixnet_contract_common::{CoinSchema, NodeRewarding};
|
||||||
use nym_node_requests::api::v1::node::models::NodeDescription;
|
use nym_node_requests::api::v1::node::models::NodeDescription;
|
||||||
|
pub(crate) use nym_node_status_client::models::TestrunAssignment;
|
||||||
use nym_validator_client::{
|
use nym_validator_client::{
|
||||||
client::NodeId,
|
client::NodeId,
|
||||||
models::{
|
models::BinaryBuildInformationOwned,
|
||||||
AuthenticatorDetailsV1, BinaryBuildInformationOwned, IpPacketRouterDetailsV1,
|
|
||||||
LewesProtocolDetailsDataV1 as LewesProtocolDetailsDataV1Validator,
|
|
||||||
LewesProtocolDetailsV1 as LewesProtocolDetailsV1Validator,
|
|
||||||
},
|
|
||||||
nym_api::SkimmedNodeV1,
|
nym_api::SkimmedNodeV1,
|
||||||
nym_nodes::{BasicEntryInformation, NodeRole},
|
nym_nodes::{BasicEntryInformation, NodeRole},
|
||||||
};
|
};
|
||||||
@@ -26,12 +33,6 @@ use strum_macros::EnumString;
|
|||||||
use tracing::{error, instrument};
|
use tracing::{error, instrument};
|
||||||
use utoipa::ToSchema;
|
use utoipa::ToSchema;
|
||||||
|
|
||||||
use crate::db::models::NymNodeDataDeHelper;
|
|
||||||
use crate::node_scraper::models::BridgeInformation;
|
|
||||||
|
|
||||||
use crate::monitor::geodata;
|
|
||||||
pub(crate) use nym_node_status_client::models::TestrunAssignment;
|
|
||||||
|
|
||||||
pub(crate) mod gw_probe;
|
pub(crate) mod gw_probe;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||||
@@ -774,11 +775,11 @@ pub(crate) struct ExtendedNymNode {
|
|||||||
pub(crate) original_pledge: u128,
|
pub(crate) original_pledge: u128,
|
||||||
pub(crate) bonding_address: Option<String>,
|
pub(crate) bonding_address: Option<String>,
|
||||||
pub(crate) bonded: bool,
|
pub(crate) bonded: bool,
|
||||||
pub(crate) node_type: nym_validator_client::models::DescribedNodeTypeV1,
|
pub(crate) node_type: DescribedNodeTypeV1,
|
||||||
pub(crate) ip_address: String,
|
pub(crate) ip_address: String,
|
||||||
pub(crate) accepted_tnc: bool,
|
pub(crate) accepted_tnc: bool,
|
||||||
pub(crate) self_description: nym_validator_client::models::NymNodeDataV2,
|
pub(crate) self_description: NymNodeDataV2,
|
||||||
pub(crate) rewarding_details: Option<nym_mixnet_contract_common::NodeRewarding>,
|
pub(crate) rewarding_details: Option<NodeRewarding>,
|
||||||
pub(crate) description: NodeDescription,
|
pub(crate) description: NodeDescription,
|
||||||
pub(crate) geoip: Option<NodeGeoData>,
|
pub(crate) geoip: Option<NodeGeoData>,
|
||||||
pub family_data: Option<NodeFamilyInformation>,
|
pub family_data: Option<NodeFamilyInformation>,
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
use crate::db::{DbPool, models::GatewaySessionsRecord, queries};
|
use crate::db::{DbPool, models::GatewaySessionsRecord, queries};
|
||||||
use nym_network_defaults::NymNetworkDetails;
|
use nym_network_defaults::NymNetworkDetails;
|
||||||
use nym_node_requests::api::{client::NymNodeApiClientExt, v1::metrics::models::SessionStats};
|
use nym_node_requests::api::{client::NymNodeApiClientExt, v1::metrics::models::SessionStats};
|
||||||
use nym_validator_client::{
|
use nym_validator_client::client::{NodeId, NymNodeDetails};
|
||||||
client::{NodeId, NymNodeDetails},
|
|
||||||
models::{DescribedNodeTypeV1, NymNodeDescriptionV1},
|
|
||||||
};
|
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
|
|
||||||
|
use nym_api_requests::models::described::v1::{DescribedNodeTypeV1, NymNodeDescriptionV1};
|
||||||
use nym_bin_common::bin_info;
|
use nym_bin_common::bin_info;
|
||||||
use nym_node_requests::try_get_valid_nym_node_api_client;
|
use nym_node_requests::try_get_valid_nym_node_api_client;
|
||||||
use nym_statistics_common::types::SessionType;
|
use nym_statistics_common::types::SessionType;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use crate::utils::{LogError, NumericalCheckedCast};
|
|||||||
use moka::future::Cache;
|
use moka::future::Cache;
|
||||||
use nym_network_defaults::NymNetworkDetails;
|
use nym_network_defaults::NymNetworkDetails;
|
||||||
use nym_validator_client::client::{NodeId, NymApiClientExt, NymNodeDetails};
|
use nym_validator_client::client::{NodeId, NymApiClientExt, NymNodeDetails};
|
||||||
use nym_validator_client::models::NymNodeDescriptionV2;
|
|
||||||
use nym_validator_client::{
|
use nym_validator_client::{
|
||||||
QueryHttpRpcNyxdClient,
|
QueryHttpRpcNyxdClient,
|
||||||
nym_nodes::{NodeRole, SkimmedNodeV1},
|
nym_nodes::{NodeRole, SkimmedNodeV1},
|
||||||
@@ -23,6 +22,7 @@ use tracing::instrument;
|
|||||||
|
|
||||||
pub(crate) use geodata::{ExplorerPrettyBond, IpInfoClient, Location};
|
pub(crate) use geodata::{ExplorerPrettyBond, IpInfoClient, Location};
|
||||||
pub(crate) use node_delegations::DelegationsCache;
|
pub(crate) use node_delegations::DelegationsCache;
|
||||||
|
use nym_api_requests::models::described::v2::NymNodeDescriptionV2;
|
||||||
|
|
||||||
pub(crate) mod geodata;
|
pub(crate) mod geodata;
|
||||||
mod node_delegations;
|
mod node_delegations;
|
||||||
|
|||||||
Reference in New Issue
Block a user