From 9549bed8bb6ea27159f7d0d305e1397e9ff2fd82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Tue, 18 Apr 2023 16:28:13 +0100 Subject: [PATCH] exposed missing gateway commands in nym-cli --- Cargo.lock | 4 ++-- .../gateway/settings/vesting_update_config.rs | 2 +- .../operators/gateway/vesting_bond_gateway.rs | 4 +++- .../mixnet/operators/gateways/mod.rs | 13 +++++++++++- .../mixnet/operators/gateways/settings/mod.rs | 21 +++++++++++++++++++ 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 tools/nym-cli/src/validator/mixnet/operators/gateways/settings/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 2d0a0556c3..c2feca5643 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4202,7 +4202,7 @@ dependencies = [ [[package]] name = "nym-vesting-contract" -version = "1.3.0" +version = "1.3.1" dependencies = [ "cosmwasm-derive", "cosmwasm-std", @@ -4220,7 +4220,7 @@ dependencies = [ [[package]] name = "nym-vesting-contract-common" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cosmwasm-std", "nym-contracts-common", diff --git a/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs b/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs index 71b661bc80..6d3c480296 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/settings/vesting_update_config.rs @@ -26,7 +26,7 @@ pub struct Args { pub version: Option, } -pub async fn vesting_update_config(client: SigningClient, args: Args) { +pub async fn vesting_update_config(args: Args, client: SigningClient) { info!("Update vesting gateway config!"); let current_details = match client diff --git a/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs b/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs index 2229024a11..d6625a878b 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs @@ -45,7 +45,9 @@ pub struct Args { pub force: bool, } -pub async fn vesting_bond_gateway(client: SigningClient, args: Args, denom: &str) { +pub async fn vesting_bond_gateway(args: Args, client: SigningClient) { + let denom = client.current_chain_details().mix_denom.base.as_str(); + info!("Starting vesting gateway bonding!"); // if we're trying to bond less than 1 token diff --git a/tools/nym-cli/src/validator/mixnet/operators/gateways/mod.rs b/tools/nym-cli/src/validator/mixnet/operators/gateways/mod.rs index e939cc44da..630ebccb00 100644 --- a/tools/nym-cli/src/validator/mixnet/operators/gateways/mod.rs +++ b/tools/nym-cli/src/validator/mixnet/operators/gateways/mod.rs @@ -4,6 +4,8 @@ use nym_cli_commands::context::{create_signing_client, ClientArgs}; use nym_network_defaults::NymNetworkDetails; +pub(crate) mod settings; + pub(crate) async fn execute( global_args: ClientArgs, gateway: nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGateway, @@ -19,7 +21,16 @@ pub(crate) async fn execute( nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::CreateGatewayBondingSignPayload(args) => { nym_cli_commands::validator::mixnet::operators::gateway::gateway_bonding_sign_payload::create_payload(args,create_signing_client(global_args, network_details)?).await } - _ => unreachable!(), + nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::Settings(settings) => { + settings::execute(global_args, settings, network_details).await? + } + nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::VestingBond(args) => { + nym_cli_commands::validator::mixnet::operators::gateway::vesting_bond_gateway::vesting_bond_gateway(args, create_signing_client(global_args, network_details)?).await + } + nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::VestingUnbond(_args) => { + nym_cli_commands::validator::mixnet::operators::gateway::vesting_unbond_gateway::vesting_unbond_gateway(create_signing_client(global_args, network_details)?).await + + } } Ok(()) } diff --git a/tools/nym-cli/src/validator/mixnet/operators/gateways/settings/mod.rs b/tools/nym-cli/src/validator/mixnet/operators/gateways/settings/mod.rs new file mode 100644 index 0000000000..b909063125 --- /dev/null +++ b/tools/nym-cli/src/validator/mixnet/operators/gateways/settings/mod.rs @@ -0,0 +1,21 @@ +// Copyright 2023 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use nym_cli_commands::context::{create_signing_client, ClientArgs}; +use nym_network_defaults::NymNetworkDetails; + +pub(crate) async fn execute( + global_args: ClientArgs, + settings: nym_cli_commands::validator::mixnet::operators::gateway::settings::MixnetOperatorsGatewaySettings, + network_details: &NymNetworkDetails, +) -> anyhow::Result<()> { + match settings.command { + nym_cli_commands::validator::mixnet::operators::gateway::settings::MixnetOperatorsGatewaySettingsCommands::UpdateConfig(args) => { + nym_cli_commands::validator::mixnet::operators::gateway::settings::update_config::update_config(args, create_signing_client(global_args, network_details)?).await + } + nym_cli_commands::validator::mixnet::operators::gateway::settings::MixnetOperatorsGatewaySettingsCommands::VestingUpdateConfig(args) => { + nym_cli_commands::validator::mixnet::operators::gateway::settings::vesting_update_config::vesting_update_config(args, create_signing_client(global_args, network_details)?).await + } + } + Ok(()) +}