Newer
Older
/// get balance
pub async fn get_balance(data: Data) -> Result<(), anyhow::Error> {
let account_id = data.address();
let account_info = get_account_info(data.client(), &account_id).await?;
if let Some(account_info) = account_info {
println!(
"{account_id} has {}",
data.format_balance(account_info.data.free)
);
} else {
println!("account {account_id} does not exist")
}
Ok(())
}
) -> Result<Option<AccountInfo>, subxt::Error> {
client
.storage()
.fetch(&runtime::storage().system().account(account_id), None)