Skip to content
Snippets Groups Projects

refac call submission and event watch

Merged Hugo Trentesaux requested to merge hugo-dev into master
5 files
+ 64
6
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 14
0
@@ -27,6 +27,8 @@ pub enum Subcommand {
/// List of target addresses
dests: Vec<AccountId>,
},
/// Unlink the account from the linked identity
Unlink,
}
/// handle account commands
@@ -48,6 +50,9 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<(
Subcommand::TransferMultiple { amount, dests } => {
commands::transfer::transfer_multiple(&data, amount, dests).await?;
}
Subcommand::Unlink => {
unlink_account(&data).await?;
}
};
Ok(())
@@ -78,3 +83,12 @@ pub async fn get_account_info(
.fetch(&runtime::storage().system().account(account_id), None)
.await
}
/// unlink account
pub async fn unlink_account(data: &Data) -> Result<(), subxt::Error> {
submit_call_and_look_event::<
runtime::account::events::AccountUnlinked,
StaticTxPayload<runtime::account::calls::UnlinkIdentity>,
>(data, &runtime::tx().account().unlink_identity())
.await
}
Loading