42 lines
1.3 KiB
Rust
42 lines
1.3 KiB
Rust
use color_eyre::Result;
|
|
use subxt::{
|
|
utils::H256,
|
|
client::OnlineClient,
|
|
};
|
|
|
|
use crate::{
|
|
casper_network::{
|
|
self,
|
|
runtime_types::ghost_networks::{BridgeAdjustment, NetworkData},
|
|
},
|
|
CasperConfig,
|
|
};
|
|
|
|
pub async fn bridged_imbalance(
|
|
online_client: &OnlineClient<CasperConfig>,
|
|
at_hash: Option<&H256>,
|
|
) -> Result<Option<BridgeAdjustment<u128>>> {
|
|
let storage_key = casper_network::storage().ghost_networks().bridged_imbalance();
|
|
let maybe_bridged_imbalance = super::do_storage_call(online_client, &storage_key, at_hash).await?;
|
|
Ok(maybe_bridged_imbalance)
|
|
}
|
|
|
|
pub async fn accumulated_commission(
|
|
online_client: &OnlineClient<CasperConfig>,
|
|
at_hash: Option<&H256>,
|
|
) -> Result<Option<u128>> {
|
|
let storage_key = casper_network::storage().ghost_networks().accumulated_commission();
|
|
let maybe_accumulated_commission = super::do_storage_call(online_client, &storage_key, at_hash).await?;
|
|
Ok(maybe_accumulated_commission)
|
|
}
|
|
|
|
pub async fn networks(
|
|
online_client: &OnlineClient<CasperConfig>,
|
|
at_hash: Option<&H256>,
|
|
chain_id: u64,
|
|
) -> Result<Option<NetworkData>> {
|
|
let storage_key = casper_network::storage().ghost_networks().networks(chain_id);
|
|
let maybe_network = super::do_storage_call(online_client, &storage_key, at_hash).await?;
|
|
Ok(maybe_network)
|
|
}
|