partner_chains_cli/
runtime_bindings.rs1use pallet_session_validator_management::Config as CommitteePaletConfig;
2use serde::Serialize;
3use sp_core::{ecdsa, ed25519, sr25519};
4
5pub trait RuntimeTypeWrapper {
6 type Runtime;
7}
8
9pub trait PartnerChainRuntime {
10 type AuthorityId: Send + Sync + 'static + From<ecdsa::Public>;
11 type AuthorityKeys: Send + Sync + 'static + From<(sr25519::Public, ed25519::Public)> + Serialize;
12 type CommitteeMember: Serialize;
13}
14
15pub trait PartnerChainRuntimeBindings: PartnerChainRuntime {
16 fn initial_member(id: Self::AuthorityId, keys: Self::AuthorityKeys) -> Self::CommitteeMember;
17}
18
19impl<T: RuntimeTypeWrapper<Runtime = R>, R> PartnerChainRuntime for T
20where
21 R: CommitteePaletConfig,
22 <R as CommitteePaletConfig>::AuthorityId: From<ecdsa::Public>,
23 <R as CommitteePaletConfig>::AuthorityKeys: From<(sr25519::Public, ed25519::Public)>,
24 <R as CommitteePaletConfig>::CommitteeMember: Serialize,
25{
26 type AuthorityId = <R as CommitteePaletConfig>::AuthorityId;
27 type AuthorityKeys = <R as CommitteePaletConfig>::AuthorityKeys;
28 type CommitteeMember = <R as CommitteePaletConfig>::CommitteeMember;
29}