From b46fb6bad0f5b6f7ccbdd9bdf3d510112f337f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nurzhan=20Sak=C3=A9n?= Date: Thu, 4 Apr 2024 11:11:28 +0400 Subject: [PATCH] [feature] #4110: Add `account add-signatory` command to `iroha_client_cli` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nurzhan Sakén --- client_cli/src/main.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/client_cli/src/main.rs b/client_cli/src/main.rs index 13bd3ec2903..45591196f75 100644 --- a/client_cli/src/main.rs +++ b/client_cli/src/main.rs @@ -517,6 +517,8 @@ mod account { Grant(Grant), /// List all account permissions ListPermissions(ListPermissions), + /// Add new signatory to the account + AddSignatory(AddSignatory), } impl RunArgs for Args { @@ -527,6 +529,7 @@ mod account { Args::List, Args::Grant, Args::ListPermissions, + Args::AddSignatory, }) } } @@ -695,6 +698,26 @@ mod account { Ok(()) } } + + /// Add new signatory to account + #[derive(clap::Args, Debug)] + pub struct AddSignatory { + /// Account id in the format `name@domain_name' + #[arg(short, long)] + pub id: AccountId, + /// Public key of the signatory + #[arg(short, long)] + pub key: PublicKey, + } + + impl RunArgs for AddSignatory { + fn run(self, context: &mut dyn RunContext) -> Result<()> { + let mint_public_key = + iroha_client::data_model::isi::Mint::account_public_key(self.key, self.id); + submit([mint_public_key], UnlimitedMetadata::new(), context) + .wrap_err("Failed to add the signatory to the account") + } + } } mod asset { @@ -1124,7 +1147,7 @@ mod key { #[derive(clap::Args, Debug)] pub struct Burn { /// Account from which to burn the public key (in the format `name@domain_name') - #[arg(long)] + #[arg(short, long)] pub account: AccountId, /// Public key to be burned #[arg(short, long)]