use crate::*; /// 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(()) } /// get account info pub async fn get_account_info( client: &Client, account_id: &AccountId, ) -> Result<Option<AccountInfo>, subxt::Error> { client .storage() .fetch(&runtime::storage().system().account(account_id), None) .await }