ghost-eye/src/network/raw_calls/system.rs
Uncle Stinky 2e0205a581
sketch for the validators page
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-01-19 18:04:02 +03:00

25 lines
695 B
Rust

use color_eyre::Result;
use subxt::{
utils::H256,
client::OnlineClient,
};
use crate::{
casper_network::{
self,
runtime_types::{frame_system::AccountInfo, pallet_balances::types::AccountData},
},
CasperConfig,
};
pub async fn balance(
online_client: &OnlineClient<CasperConfig>,
at_hash: Option<&H256>,
account: &[u8; 32],
) -> Result<Option<AccountInfo<u32, AccountData<u128>>>> {
let account_id = super::convert_array_to_account_id(account);
let storage_key = casper_network::storage().system().account(account_id);
let maybe_balance = super::do_storage_call(online_client, &storage_key, at_hash).await?;
Ok(maybe_balance)
}