Skip to content

Commit

Permalink
[feature] #4110: Add account add-signatory command to `iroha_client…
Browse files Browse the repository at this point in the history
…_cli`

Signed-off-by: Nurzhan Sakén <nurzhan.sakenov@gmail.com>
  • Loading branch information
nxsaken committed Apr 4, 2024
1 parent 5e9ab2d commit b46fb6b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion client_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -527,6 +529,7 @@ mod account {
Args::List,
Args::Grant,
Args::ListPermissions,
Args::AddSignatory,
})
}
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit b46fb6b

Please sign in to comment.