1- use primitives:: { Pair , Public } ;
1+ use primitives:: { Pair , Public , sr25519 } ;
22use runtime:: {
33 AccountId , AuraConfig , BalancesConfig , GenesisConfig , GrandpaConfig ,
4- SudoConfig , IndicesConfig , SystemConfig , WASM_BINARY ,
4+ SudoConfig , IndicesConfig , SystemConfig , WASM_BINARY , Signature
55} ;
66use aura_primitives:: sr25519:: { AuthorityId as AuraId } ;
77use grandpa_primitives:: { AuthorityId as GrandpaId } ;
88use substrate_service;
9+ use sr_primitives:: traits:: { Verify , IdentifyAccount } ;
910
1011// Note this is the URL for the telemetry server
1112//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
@@ -31,8 +32,17 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu
3132 . public ( )
3233}
3334
35+ type AccountPublic = <Signature as Verify >:: Signer ;
36+
37+ /// Helper function to generate an account ID from seed
38+ pub fn get_account_id_from_seed < TPublic : Public > ( seed : & str ) -> AccountId where
39+ AccountPublic : From < <TPublic :: Pair as Pair >:: Public >
40+ {
41+ AccountPublic :: from ( get_from_seed :: < TPublic > ( seed) ) . into_account ( )
42+ }
43+
3444/// Helper function to generate an authority key for Aura
35- pub fn get_authority_keys_from_seed ( s : & str ) -> ( AuraId , GrandpaId ) {
45+ pub fn get_authority_keys_from_seed ( s : & str ) -> ( AuraId , GrandpaId ) {
3646 (
3747 get_from_seed :: < AuraId > ( s) ,
3848 get_from_seed :: < GrandpaId > ( s) ,
@@ -49,12 +59,12 @@ impl Alternative {
4959 || testnet_genesis ( vec ! [
5060 get_authority_keys_from_seed( "Alice" ) ,
5161 ] ,
52- get_from_seed :: < AccountId > ( "Alice" ) ,
62+ get_account_id_from_seed :: < sr25519 :: Public > ( "Alice" ) ,
5363 vec ! [
54- get_from_seed :: <AccountId >( "Alice" ) ,
55- get_from_seed :: <AccountId >( "Bob" ) ,
56- get_from_seed :: <AccountId >( "Alice//stash" ) ,
57- get_from_seed :: <AccountId >( "Bob//stash" ) ,
64+ get_account_id_from_seed :: <sr25519 :: Public >( "Alice" ) ,
65+ get_account_id_from_seed :: <sr25519 :: Public >( "Bob" ) ,
66+ get_account_id_from_seed :: <sr25519 :: Public >( "Alice//stash" ) ,
67+ get_account_id_from_seed :: <sr25519 :: Public >( "Bob//stash" ) ,
5868 ] ,
5969 true ) ,
6070 vec ! [ ] ,
@@ -69,21 +79,21 @@ impl Alternative {
6979 || testnet_genesis ( vec ! [
7080 get_authority_keys_from_seed( "Alice" ) ,
7181 get_authority_keys_from_seed( "Bob" ) ,
72- ] ,
73- get_from_seed :: < AccountId > ( "Alice" ) ,
82+ ] ,
83+ get_account_id_from_seed :: < sr25519 :: Public > ( "Alice" ) ,
7484 vec ! [
75- get_from_seed :: <AccountId >( "Alice" ) ,
76- get_from_seed :: <AccountId >( "Bob" ) ,
77- get_from_seed :: <AccountId >( "Charlie" ) ,
78- get_from_seed :: <AccountId >( "Dave" ) ,
79- get_from_seed :: <AccountId >( "Eve" ) ,
80- get_from_seed :: <AccountId >( "Ferdie" ) ,
81- get_from_seed :: <AccountId >( "Alice//stash" ) ,
82- get_from_seed :: <AccountId >( "Bob//stash" ) ,
83- get_from_seed :: <AccountId >( "Charlie//stash" ) ,
84- get_from_seed :: <AccountId >( "Dave//stash" ) ,
85- get_from_seed :: <AccountId >( "Eve//stash" ) ,
86- get_from_seed :: <AccountId >( "Ferdie//stash" ) ,
85+ get_account_id_from_seed :: <sr25519 :: Public >( "Alice" ) ,
86+ get_account_id_from_seed :: <sr25519 :: Public >( "Bob" ) ,
87+ get_account_id_from_seed :: <sr25519 :: Public >( "Charlie" ) ,
88+ get_account_id_from_seed :: <sr25519 :: Public >( "Dave" ) ,
89+ get_account_id_from_seed :: <sr25519 :: Public >( "Eve" ) ,
90+ get_account_id_from_seed :: <sr25519 :: Public >( "Ferdie" ) ,
91+ get_account_id_from_seed :: <sr25519 :: Public >( "Alice//stash" ) ,
92+ get_account_id_from_seed :: <sr25519 :: Public >( "Bob//stash" ) ,
93+ get_account_id_from_seed :: <sr25519 :: Public >( "Charlie//stash" ) ,
94+ get_account_id_from_seed :: <sr25519 :: Public >( "Dave//stash" ) ,
95+ get_account_id_from_seed :: <sr25519 :: Public >( "Eve//stash" ) ,
96+ get_account_id_from_seed :: <sr25519 :: Public >( "Ferdie//stash" ) ,
8797 ] ,
8898 true ) ,
8999 vec ! [ ] ,
@@ -105,7 +115,7 @@ impl Alternative {
105115}
106116
107117fn testnet_genesis ( initial_authorities : Vec < ( AuraId , GrandpaId ) > ,
108- root_key : AccountId ,
118+ root_key : AccountId ,
109119 endowed_accounts : Vec < AccountId > ,
110120 _enable_println : bool ) -> GenesisConfig {
111121 GenesisConfig {
0 commit comments