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 f263f44
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions client_cli/src/main.rs
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

0 comments on commit f263f44

Please sign in to comment.