Lines
100 %
Functions
Branches
// Copyright (C) Moondance Labs Ltd.
// This file is part of Tanssi.
// Tanssi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Tanssi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>.
pub use node_common::chain_spec::Extensions;
pub use sp_core::crypto::get_public_from_string_or_panic;
use {dancebox_runtime::AccountId, nimbus_primitives::NimbusId, sp_core::sr25519};
pub mod dancebox;
pub mod flashbox;
/// Generate collator keys from seed.
///
/// This function's return type must always match the session keys of the chain in tuple format.
pub fn get_collator_keys_from_seed(seed: &str) -> NimbusId {
get_public_from_string_or_panic::<NimbusId>(seed)
}
/// Helper function to turn a list of names into a list of `(AccountId, NimbusId)`
pub fn invulnerables_from_seeds<S: AsRef<str>, I: Iterator<Item = S>>(
names: I,
) -> Vec<(AccountId, NimbusId)> {
names
.map(|name| {
let name = name.as_ref();
(
get_public_from_string_or_panic::<sr25519::Public>(name).into(),
get_collator_keys_from_seed(name),
)
})
.collect()
/// Helper function to turn a list of names into a list of `AccountId`
pub fn account_ids(names: &[&str]) -> Vec<AccountId> {
.iter()
.map(|name| get_public_from_string_or_panic::<sr25519::Public>(name).into())