git.delta.rocks / unique-network / refs/commits / 8f7419bc1620

difftreelog

source

runtime/common/tests/mod.rs1.5 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::BuildStorage;18use sp_core::{Public, Pair};19use sp_std::vec;20use up_common::types::AuraId;21use crate::{GenesisConfig, ParachainInfoConfig, AuraConfig};2223pub mod xcm;2425fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {26	TPublic::Pair::from_string(&format!("//{}", seed), None)27		.expect("static values are valid; qed")28		.public()29}3031fn new_test_ext(para_id: u32) -> sp_io::TestExternalities {32	let cfg = GenesisConfig {33		aura: AuraConfig {34			authorities: vec![35				get_from_seed::<AuraId>("Alice"),36				get_from_seed::<AuraId>("Bob"),37			],38		},39		parachain_info: ParachainInfoConfig {40			parachain_id: para_id.into(),41		},42		..GenesisConfig::default()43	};4445	cfg.build_storage().unwrap().into()46}