pallet_encointer_ceremonies_rpc_runtime_api/lib.rs
1// Copyright (c) 2019 Alain Brenzikofer
2// This file is part of Encointer
3//
4// Encointer 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// Encointer 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 Encointer. If not, see <http://www.gnu.org/licenses/>.
16
17//! Runtime API definition required by Ceremonies RPC extensions.
18
19#![cfg_attr(not(feature = "std"), no_std)]
20
21#[cfg(not(feature = "std"))]
22use sp_std::vec::Vec;
23
24use encointer_primitives::{
25 ceremonies::{AggregatedAccountData, CeremonyIndexType, CeremonyInfo, CommunityReputation},
26 communities::CommunityIdentifier,
27};
28use parity_scale_codec::{Decode, Encode};
29
30sp_api::decl_runtime_apis! {
31 pub trait CeremoniesApi<AccountId, Moment>
32 where AccountId: Encode + Decode,
33 encointer_primitives::ceremonies::AggregatedAccountData<AccountId, Moment>: Decode
34
35 {
36 fn get_reputations(account: &AccountId) -> Vec<(CeremonyIndexType, CommunityReputation)>;
37 fn get_aggregated_account_data(cid:CommunityIdentifier, account: &AccountId) -> AggregatedAccountData<AccountId, Moment>;
38 fn get_ceremony_info() -> CeremonyInfo;
39 }
40}