use sc_service::ChainType; use sp_runtime::traits::Verify; use sp_core::{sr25519, Pair, Public}; use sp_runtime::traits::IdentifyAccount; use serai_runtime::{ WASM_BINARY, AccountId, Signature, GenesisConfig, SystemConfig, BalancesConfig }; pub type ChainSpec = sc_service::GenericChainSpec; type AccountPublic = ::Signer; fn get_from_seed(seed: &'static str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None).unwrap().public() } fn get_account_id_from_seed(seed: &'static str) -> AccountId where AccountPublic: From<::Public> { AccountPublic::from(get_from_seed::(seed)).into_account() } fn testnet_genesis( wasm_binary: &[u8], endowed_accounts: Vec ) -> GenesisConfig { GenesisConfig { system: SystemConfig { code: wasm_binary.to_vec(), }, balances: BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, transaction_payment: Default::default() } } pub fn development_config() -> Result { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available")?; Ok( ChainSpec::from_genesis( // Name "Development Network", // ID "dev", ChainType::Development, || { testnet_genesis( wasm_binary, vec![ get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Alice//stash"), get_account_id_from_seed::("Bob//stash"), ] ) }, // Bootnodes vec![], // Telemetry None, // Protocol ID Some("serai"), // Fork ID None, // Properties None, // Extensions None ) ) }