1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Runtime API definition required by Portal RPC extensions.
//!
//! This API should be imported and implemented by the runtime,
//! of a node that wants to use the custom RPC extension
//! adding XDNS access methods.

#![cfg_attr(not(feature = "std"), no_std)]

use codec::Codec;

use sp_std::prelude::*;

pub use t3rn_primitives::ChainId;
use t3rn_types::sfx::SideEffect;

sp_api::decl_runtime_apis! {
    /// The API to interact with pallet XDNS
    pub trait PortalRuntimeApi<AccountId, Balance, Hash> where
        AccountId: Codec,
        Balance: Codec,
        Hash: Codec,
    {
        /// Returns the current head height of the given chain
        fn fetch_head_height(chain_id: ChainId) -> Option<u128>;
        fn fetch_all_active_xtx(for_executor: AccountId) -> Vec<(
            Hash,                              // xtx_id
            Vec<SideEffect<AccountId, Balance>>, // side_effects
            Vec<Hash>,                         // sfx_ids
        )>;
    }
}