Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a0d43b9888 |
Generated
+5
-3
@@ -603,6 +603,7 @@ dependencies = [
|
|||||||
"pemstore",
|
"pemstore",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"sled",
|
"sled",
|
||||||
"tap",
|
"tap",
|
||||||
"task",
|
"task",
|
||||||
@@ -3372,6 +3373,7 @@ dependencies = [
|
|||||||
"proxy-helpers",
|
"proxy-helpers",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"snafu 0.6.10",
|
"snafu 0.6.10",
|
||||||
"socks5-requests",
|
"socks5-requests",
|
||||||
"tap",
|
"tap",
|
||||||
@@ -5005,9 +5007,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.83"
|
version = "1.0.89"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
|
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.1",
|
"itoa 1.0.1",
|
||||||
"ryu",
|
"ryu",
|
||||||
@@ -6537,7 +6539,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vesting-contract"
|
name = "vesting-contract"
|
||||||
version = "1.1.0"
|
version = "1.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"contracts-common",
|
"contracts-common",
|
||||||
"cosmwasm-std",
|
"cosmwasm-std",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ pemstore = { path = "../../common/pemstore" }
|
|||||||
topology = { path = "../../common/topology" }
|
topology = { path = "../../common/topology" }
|
||||||
validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
|
validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
|
||||||
task = { path = "../../common/task" }
|
task = { path = "../../common/task" }
|
||||||
|
serde_json = "1.0.89"
|
||||||
|
|
||||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-stream]
|
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-stream]
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ use config::NymConfig;
|
|||||||
use crypto::asymmetric::{encryption, identity};
|
use crypto::asymmetric::{encryption, identity};
|
||||||
use gateway_client::GatewayClient;
|
use gateway_client::GatewayClient;
|
||||||
use gateway_requests::registration::handshake::SharedKeys;
|
use gateway_requests::registration::handshake::SharedKeys;
|
||||||
use nymsphinx::addressing::clients::Recipient;
|
use nymsphinx::addressing::clients::{ClientIdentity, Recipient};
|
||||||
use nymsphinx::addressing::nodes::NodeIdentity;
|
use nymsphinx::addressing::nodes::NodeIdentity;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
|
use serde::Serialize;
|
||||||
use tap::TapFallible;
|
use tap::TapFallible;
|
||||||
use topology::{filter::VersionFilterable, gateway};
|
use topology::{filter::VersionFilterable, gateway};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
@@ -24,6 +25,32 @@ use crate::{
|
|||||||
error::ClientCoreError,
|
error::ClientCoreError,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct InitResults {
|
||||||
|
version: String,
|
||||||
|
id: String,
|
||||||
|
identity_key: String,
|
||||||
|
sphinx_key: String,
|
||||||
|
gateway_id: String,
|
||||||
|
gateway_listener: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InitResults {
|
||||||
|
pub fn new<T>(config: &Config<T>, address: &Recipient) -> Self
|
||||||
|
where
|
||||||
|
T: NymConfig,
|
||||||
|
{
|
||||||
|
Self {
|
||||||
|
version: config.get_version().to_string(),
|
||||||
|
id: config.get_id(),
|
||||||
|
identity_key: address.identity().to_base58_string(),
|
||||||
|
sphinx_key: address.encryption_key().to_base58_string(),
|
||||||
|
gateway_id: config.get_gateway_id(),
|
||||||
|
gateway_listener: config.get_gateway_listener(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn query_gateway_details(
|
pub async fn query_gateway_details(
|
||||||
validator_servers: Vec<Url>,
|
validator_servers: Vec<Url>,
|
||||||
chosen_gateway_id: Option<&str>,
|
chosen_gateway_id: Option<&str>,
|
||||||
@@ -102,7 +129,7 @@ async fn register_with_gateway(
|
|||||||
Ok(shared_keys)
|
Ok(shared_keys)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_address<T>(config: &Config<T>) -> Result<(), ClientCoreError>
|
pub fn get_client_address<T>(config: &Config<T>) -> Result<Recipient, ClientCoreError>
|
||||||
where
|
where
|
||||||
T: config::NymConfig,
|
T: config::NymConfig,
|
||||||
{
|
{
|
||||||
@@ -143,5 +170,6 @@ where
|
|||||||
);
|
);
|
||||||
|
|
||||||
println!("\nThe address of this client is: {}", client_recipient);
|
println!("\nThe address of this client is: {}", client_recipient);
|
||||||
Ok(())
|
|
||||||
|
Ok(client_recipient)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ pub(crate) async fn execute(args: &Init) {
|
|||||||
);
|
);
|
||||||
println!("Client configuration completed.");
|
println!("Client configuration completed.");
|
||||||
|
|
||||||
client_core::init::show_address(config.get_base()).unwrap_or_else(|err| {
|
client_core::init::get_client_address(config.get_base()).unwrap_or_else(|err| {
|
||||||
eprintln!("Failed to show address\nError: {err}");
|
eprintln!("Failed to show address\nError: {err}");
|
||||||
std::process::exit(1)
|
std::process::exit(1)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ topology = { path = "../../common/topology" }
|
|||||||
validator-client = { path = "../../common/client-libs/validator-client", features = ["nymd-client"] }
|
validator-client = { path = "../../common/client-libs/validator-client", features = ["nymd-client"] }
|
||||||
version-checker = { path = "../../common/version-checker" }
|
version-checker = { path = "../../common/version-checker" }
|
||||||
tap = "1.0.1"
|
tap = "1.0.1"
|
||||||
|
serde_json = "1.0.89"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
coconut = ["coconut-interface", "credentials", "gateway-requests/coconut", "gateway-client/coconut", "credentials/coconut", "client-core/coconut"]
|
coconut = ["coconut-interface", "credentials", "gateway-requests/coconut", "gateway-client/coconut", "credentials/coconut", "client-core/coconut"]
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
use clap::Args;
|
use clap::Args;
|
||||||
use client_core::{config::GatewayEndpointConfig, error::ClientCoreError};
|
use client_core::{config::GatewayEndpointConfig, error::ClientCoreError};
|
||||||
use config::NymConfig;
|
use config::NymConfig;
|
||||||
|
use nymsphinx::addressing::clients::Recipient;
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
client::config::Config,
|
client::config::Config,
|
||||||
commands::{override_config, OverrideConfig},
|
commands::{override_config, OverrideConfig},
|
||||||
|
error::Socks5ClientError,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Args, Clone)]
|
#[derive(Args, Clone)]
|
||||||
@@ -71,6 +74,22 @@ impl From<Init> for OverrideConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct InitResults {
|
||||||
|
#[serde(flatten)]
|
||||||
|
client_core: client_core::init::InitResults,
|
||||||
|
socks5_listening_port: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InitResults {
|
||||||
|
pub fn new(config: &Config, address: &Recipient) -> Self {
|
||||||
|
Self {
|
||||||
|
client_core: client_core::init::InitResults::new(config.get_base(), address),
|
||||||
|
socks5_listening_port: config.get_listening_port().to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn execute(args: &Init) {
|
pub(crate) async fn execute(args: &Init) {
|
||||||
println!("Initialising client...");
|
println!("Initialising client...");
|
||||||
|
|
||||||
@@ -125,10 +144,16 @@ pub(crate) async fn execute(args: &Init) {
|
|||||||
);
|
);
|
||||||
println!("Client configuration completed.");
|
println!("Client configuration completed.");
|
||||||
|
|
||||||
client_core::init::show_address(config.get_base()).unwrap_or_else(|err| {
|
let address = client_core::init::get_client_address(config.get_base()).unwrap_or_else(|err| {
|
||||||
eprintln!("Failed to show address\nError: {err}");
|
eprintln!("Failed to show address\nError: {err}");
|
||||||
std::process::exit(1)
|
std::process::exit(1)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let init_results = InitResults::new(&config, &address);
|
||||||
|
let init_results_json = serde_json::to_string_pretty(&init_results);
|
||||||
|
if let Ok(init_results) = init_results_json {
|
||||||
|
println!("{}", init_results);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn setup_gateway(
|
async fn setup_gateway(
|
||||||
|
|||||||
Reference in New Issue
Block a user