use color_eyre::Result; use subxt::{ utils::H256, client::OnlineClient, }; use crate::{casper_network::{self, runtime_types::sp_consensus_slots}, CasperConfig}; pub async fn current_slot( online_client: &OnlineClient, at_hash: Option<&H256>, ) -> Result> { let storage_key = casper_network::storage().babe().current_slot(); let maybe_current_slot = super::do_storage_call(online_client, &storage_key, at_hash).await?; Ok(maybe_current_slot) } pub async fn epoch_index( online_client: &OnlineClient, at_hash: Option<&H256>, ) -> Result> { let storage_key = casper_network::storage().babe().epoch_index(); let maybe_epoch_index = super::do_storage_call(online_client, &storage_key, at_hash).await?; Ok(maybe_epoch_index) } pub async fn genesis_slot( online_client: &OnlineClient, at_hash: Option<&H256>, ) -> Result> { let storage_key = casper_network::storage().babe().genesis_slot(); let maybe_genesis_slot = super::do_storage_call(online_client, &storage_key, at_hash).await?; Ok(maybe_genesis_slot) } pub fn epoch_duration( online_client: &OnlineClient, ) -> Result { let constant_query = casper_network::constants().babe().epoch_duration(); let epoch_duration = super::do_constant_call(online_client, &constant_query)?; Ok(epoch_duration) }