subspace_test_primitives/
lib.rs1#![cfg_attr(not(feature = "std"), no_std)]
2use parity_scale_codec::{Decode, Encode};
5use sp_core::H256;
6use sp_domains::DomainId;
7use sp_messenger::messages::{ChainId, ChannelId};
8use sp_runtime::traits::NumberFor;
9use sp_subspace_mmr::{ConsensusChainMmrLeafProof, MmrLeaf};
10
11pub const DOMAINS_BLOCK_PRUNING_DEPTH: u32 = 10;
13
14sp_api::decl_runtime_apis! {
15 pub trait OnchainStateApi<AccountId, Balance>
17 where
18 AccountId: Encode + Decode,
19 Balance: Encode + Decode
20 {
21 fn free_balance(account_id: AccountId) -> Balance;
23
24 fn get_open_channel_for_chain(dst_chain_id: ChainId) -> Option<ChannelId>;
26
27 fn verify_proof_and_extract_leaf(proof: ConsensusChainMmrLeafProof<NumberFor<Block>, Block::Hash, H256>) -> Option<MmrLeaf<NumberFor<Block>, Block::Hash>>;
29
30 fn domain_balance(domain_id: DomainId) -> Balance;
32 }
33}