Merge pull request #3173 from nymtech/feature/nym-cli-tweak
Feature/nym cli tweak
This commit is contained in:
@@ -6,9 +6,11 @@ use clap::{Args, Subcommand};
|
||||
pub mod rewards;
|
||||
|
||||
pub mod delegate_to_mixnode;
|
||||
pub mod pledge_more;
|
||||
pub mod query_for_delegations;
|
||||
pub mod undelegate_from_mixnode;
|
||||
pub mod vesting_delegate_to_mixnode;
|
||||
pub mod vesting_pledge_more;
|
||||
pub mod vesting_undelegate_from_mixnode;
|
||||
|
||||
#[derive(Debug, Args)]
|
||||
@@ -32,4 +34,8 @@ pub enum MixnetDelegatorsCommands {
|
||||
DelegateVesting(vesting_delegate_to_mixnode::Args),
|
||||
/// Undelegate from a mixnode (when originally using locked tokens)
|
||||
UndelegateVesting(vesting_undelegate_from_mixnode::Args),
|
||||
/// Pledge more
|
||||
PledgeMore(pledge_more::Args),
|
||||
/// Pledge more with locked tokens
|
||||
PledgeMoreVesting(vesting_pledge_more::Args),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::context::SigningClient;
|
||||
use clap::Parser;
|
||||
use log::info;
|
||||
use nym_mixnet_contract_common::Coin;
|
||||
use validator_client::nyxd::traits::MixnetSigningClient;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct Args {
|
||||
#[clap(long)]
|
||||
pub amount: u128,
|
||||
}
|
||||
|
||||
pub async fn pledge_more(args: Args, client: SigningClient) {
|
||||
let denom = client.current_chain_details().mix_denom.base.as_str();
|
||||
|
||||
info!("Starting to pledge more");
|
||||
|
||||
let coin = Coin::new(args.amount, denom);
|
||||
|
||||
let res = client
|
||||
.pledge_more(coin.into(), None)
|
||||
.await
|
||||
.expect("failed to pledge more!");
|
||||
|
||||
info!("pledging more: {:?}", res);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use clap::Parser;
|
||||
use log::info;
|
||||
use nym_mixnet_contract_common::Coin;
|
||||
use validator_client::nyxd::VestingSigningClient;
|
||||
|
||||
use crate::context::SigningClient;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct Args {
|
||||
#[clap(long)]
|
||||
pub amount: u128,
|
||||
}
|
||||
|
||||
pub async fn vesting_pledge_more(args: Args, client: SigningClient) {
|
||||
let denom = client.current_chain_details().mix_denom.base.as_str();
|
||||
|
||||
info!("Starting vesting pledge more");
|
||||
|
||||
let coin = Coin::new(args.amount, denom);
|
||||
|
||||
let res = client
|
||||
.vesting_pledge_more(coin.into(), None)
|
||||
.await
|
||||
.expect("failed to pledge more!");
|
||||
|
||||
info!("vesting pledge more: {:?}", res);
|
||||
}
|
||||
@@ -20,12 +20,12 @@ pub struct MixnetOperatorsGateway {
|
||||
pub enum MixnetOperatorsGatewayCommands {
|
||||
/// Bond to a gateway
|
||||
Bond(bond_gateway::Args),
|
||||
/// Unbound from a gateway
|
||||
Unbound(unbond_gateway::Args),
|
||||
/// Unbond from a gateway
|
||||
Unbond(unbond_gateway::Args),
|
||||
/// Bond to a gateway with locked tokens
|
||||
VestingBond(vesting_bond_gateway::Args),
|
||||
/// Unbound from a gateway (when originally using locked tokens)
|
||||
VestingUnbound(vesting_unbond_gateway::Args),
|
||||
/// Unbond from a gateway (when originally using locked tokens)
|
||||
VestingUnbond(vesting_unbond_gateway::Args),
|
||||
/// Create base58-encoded payload required for producing valid bonding signature.
|
||||
CreateGatewayBondingSignPayload(gateway_bonding_sign_payload::Args),
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ pub enum MixnetOperatorsMixnodeCommands {
|
||||
Settings(settings::MixnetOperatorsMixnodeSettings),
|
||||
/// Bond to a mixnode
|
||||
Bond(bond_mixnode::Args),
|
||||
/// Unbound from a mixnode
|
||||
Unbound(unbond_mixnode::Args),
|
||||
/// Unbond from a mixnode
|
||||
Unbond(unbond_mixnode::Args),
|
||||
/// Bond to a mixnode with locked tokens
|
||||
BondVesting(vesting_bond_mixnode::Args),
|
||||
/// Unbound from a mixnode (when originally using locked tokens)
|
||||
UnboundVesting(vesting_unbond_mixnode::Args),
|
||||
/// Unbond from a mixnode (when originally using locked tokens)
|
||||
UnbondVesting(vesting_unbond_mixnode::Args),
|
||||
/// Create base58-encoded payload required for producing valid bonding signature.
|
||||
CreateMixnodeBondingSignPayload(mixnode_bonding_sign_payload::Args),
|
||||
}
|
||||
|
||||
@@ -20,9 +20,21 @@ pub(crate) async fn execute(
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::Delegate(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::delegate_to_mixnode::delegate_to_mixnode(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::DelegateVesting(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::vesting_delegate_to_mixnode::vesting_delegate_to_mixnode(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::PledgeMore(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::pledge_more::pledge_more(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::PledgeMoreVesting(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::vesting_pledge_more::vesting_pledge_more(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::Undelegate(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::undelegate_from_mixnode::undelegate_from_mixnode(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::UndelegateVesting(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::vesting_undelegate_from_mixnode::vesting_undelegate_from_mixnode(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::delegators::MixnetDelegatorsCommands::List(args) => {
|
||||
nym_cli_commands::validator::mixnet::delegators::query_for_delegations::execute(args, create_signing_client_with_nym_api(global_args, network_details)?).await
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ pub(crate) async fn execute(
|
||||
nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::Bond(args) => {
|
||||
nym_cli_commands::validator::mixnet::operators::gateway::bond_gateway::bond_gateway(args, create_signing_client(global_args, network_details)?).await
|
||||
},
|
||||
nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::Unbound(_args) => {
|
||||
nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::Unbond(_args) => {
|
||||
nym_cli_commands::validator::mixnet::operators::gateway::unbond_gateway::unbond_gateway(create_signing_client(global_args, network_details)?).await
|
||||
},
|
||||
nym_cli_commands::validator::mixnet::operators::gateway::MixnetOperatorsGatewayCommands::CreateGatewayBondingSignPayload(args) => {
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) async fn execute(
|
||||
nym_cli_commands::validator::mixnet::operators::mixnode::MixnetOperatorsMixnodeCommands::Bond(args) => {
|
||||
nym_cli_commands::validator::mixnet::operators::mixnode::bond_mixnode::bond_mixnode(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::operators::mixnode::MixnetOperatorsMixnodeCommands::Unbound(args) => {
|
||||
nym_cli_commands::validator::mixnet::operators::mixnode::MixnetOperatorsMixnodeCommands::Unbond(args) => {
|
||||
nym_cli_commands::validator::mixnet::operators::mixnode::unbond_mixnode::unbond_mixnode(args, create_signing_client(global_args, network_details)?).await
|
||||
}
|
||||
nym_cli_commands::validator::mixnet::operators::mixnode::MixnetOperatorsMixnodeCommands::CreateMixnodeBondingSignPayload(args) => {
|
||||
|
||||
@@ -3803,8 +3803,8 @@ const completion: Fig.Spec = {
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "unbound",
|
||||
description: "Unbound from a mixnode",
|
||||
name: "unbond",
|
||||
description: "Unbond from a mixnode",
|
||||
options: [
|
||||
{
|
||||
name: "--mnemonic",
|
||||
@@ -3994,8 +3994,8 @@ const completion: Fig.Spec = {
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "unbound-vesting",
|
||||
description: "Unbound from a mixnode (when originally using locked tokens)",
|
||||
name: "unbond-vesting",
|
||||
description: "Unbond from a mixnode (when originally using locked tokens)",
|
||||
options: [
|
||||
{
|
||||
name: "--gas",
|
||||
@@ -4296,8 +4296,8 @@ const completion: Fig.Spec = {
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "unbound",
|
||||
description: "Unbound from a gateway",
|
||||
name: "unbond",
|
||||
description: "Unbond from a gateway",
|
||||
options: [
|
||||
{
|
||||
name: "--mnemonic",
|
||||
@@ -4473,8 +4473,8 @@ const completion: Fig.Spec = {
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "vesting-unbound",
|
||||
description: "Unbound from a gateway (when originally using locked tokens)",
|
||||
name: "vesting-unbond",
|
||||
description: "Unbond from a gateway (when originally using locked tokens)",
|
||||
options: [
|
||||
{
|
||||
name: "--mnemonic",
|
||||
|
||||
Reference in New Issue
Block a user