subspace_test_primitives/
lib.rs1#![cfg_attr(not(feature = "std"), no_std)]
2use pallet_domains::staking::StakingSummary;
5use parity_scale_codec::{Decode, Encode};
6use sp_core::H256;
7use sp_domains::{DomainId, OperatorId};
8use sp_messenger::messages::{ChainId, ChannelId};
9use sp_runtime::traits::NumberFor;
10use sp_subspace_mmr::{ConsensusChainMmrLeafProof, MmrLeaf};
11
12sp_api::decl_runtime_apis! {
13 pub trait OnchainStateApi<AccountId, Balance>
15 where
16 AccountId: Encode + Decode,
17 Balance: Encode + Decode
18 {
19 fn free_balance(account_id: AccountId) -> Balance;
21
22 fn get_open_channel_for_chain(dst_chain_id: ChainId) -> Option<ChannelId>;
24
25 fn verify_proof_and_extract_leaf(proof: ConsensusChainMmrLeafProof<NumberFor<Block>, Block::Hash, H256>) -> Option<MmrLeaf<NumberFor<Block>, Block::Hash>>;
27
28 fn domain_balance(domain_id: DomainId) -> Balance;
30
31 fn domain_stake_summary(domain_id: DomainId) -> Option<StakingSummary<OperatorId, Balance>>;
33 }
34}