diff --git a/pop-api/src/lib.rs b/pop-api/src/lib.rs index f1ffe3f5..a1a88aee 100644 --- a/pop-api/src/lib.rs +++ b/pop-api/src/lib.rs @@ -9,7 +9,7 @@ use primitives::storage_keys::*; use scale; pub use sp_runtime::{BoundedVec, MultiAddress, MultiSignature}; use v0::RuntimeCall; -pub use v0::{balances, nfts, state}; +pub use v0::{balances, nfts, relay_chain_block_number, state}; type AccountId = ::AccountId; type Balance = ::Balance; diff --git a/pop-api/src/v0/mod.rs b/pop-api/src/v0/mod.rs index 7b87dc25..0c20f9e6 100644 --- a/pop-api/src/v0/mod.rs +++ b/pop-api/src/v0/mod.rs @@ -1,7 +1,18 @@ +use crate::{ + primitives::storage_keys::{ParachainSystemKeys, RuntimeStateKeys}, + BlockNumber, PopApiError, +}; + pub mod balances; pub mod nfts; pub mod state; +pub fn relay_chain_block_number() -> Result { + Ok(state::read(RuntimeStateKeys::ParachainSystem( + ParachainSystemKeys::LastRelayChainBlockNumber, + ))?) +} + #[derive(scale::Encode)] pub(crate) enum RuntimeCall { #[codec(index = 10)]