1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>
16

            
17
//! Runtime API for CollatorAssignment pallet. Can be used by collators to check
18
//! which parachain will they be collating, as well as the current assignment of
19
//! collators to parachains and parachains to collators.
20

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

            
23
use scale_info::prelude::vec::Vec;
24

            
25
sp_api::decl_runtime_apis! {
26
    #[api_version(2)]
27
    pub trait CollatorAssignmentApi<AccountId, ParaId> where
28
        AccountId: parity_scale_codec::Codec,
29
        ParaId: parity_scale_codec::Codec,
30
    {
31
        /// Returns the list of `ParaId` of registered chains with at least some
32
        /// collators. This filters out parachains with no assigned collators.
33
        #[api_version(2)]
34
        fn parachains_with_some_collators() -> Vec<ParaId>;
35
    }
36
}