@@ -71,8 +71,7 @@ describe("fromSeedPhrase", () => {
7171} ) ;
7272
7373describe ( "fromSeedPhrase — uses SLIP10 for all-hardened paths" , ( ) => {
74- const toAddress = ( kp : KeyPair ) =>
75- getBase58Decoder ( ) . decode ( kp . publicKey ) ;
74+ const toAddress = ( kp : KeyPair ) => getBase58Decoder ( ) . decode ( kp . publicKey ) ;
7675
7776 test ( "derives correct addresses for m/44'/501'/x'/0'" , async ( ) => {
7877 for ( const { index, address } of [
@@ -103,42 +102,27 @@ describe("fromSeedPhrase — uses SLIP10 for all-hardened paths", () => {
103102 } ) ;
104103
105104 test ( "different account indices derive different keypairs" , async ( ) => {
106- const a = await KeyPair . fromSeedPhrase (
107- TEST_MNEMONIC ,
108- "m/44'/501'/0'/0'"
109- ) ;
110- const b = await KeyPair . fromSeedPhrase (
111- TEST_MNEMONIC ,
112- "m/44'/501'/1'/0'"
113- ) ;
105+ const a = await KeyPair . fromSeedPhrase ( TEST_MNEMONIC , "m/44'/501'/0'/0'" ) ;
106+ const b = await KeyPair . fromSeedPhrase ( TEST_MNEMONIC , "m/44'/501'/1'/0'" ) ;
114107 expect ( a . publicKey ) . not . toEqual ( b . publicKey ) ;
115108 expect ( a . privateKey ) . not . toEqual ( b . privateKey ) ;
116109 } ) ;
117110} ) ;
118111
119112describe ( "fromSeedPhrase — uses BIP32 for non-hardened paths" , ( ) => {
120- const toAddress = ( kp : KeyPair ) =>
121- getBase58Decoder ( ) . decode ( kp . publicKey ) ;
113+ const toAddress = ( kp : KeyPair ) => getBase58Decoder ( ) . decode ( kp . publicKey ) ;
122114
123115 test ( "derives correct address for m/44'/501'/0'/0/0" , async ( ) => {
124116 const kp = await KeyPair . fromSeedPhrase (
125117 "flee artwork post brown april bulk wash limb melody zoo rib law" ,
126118 "m/44'/501'/0'/0/0"
127119 ) ;
128- expect ( toAddress ( kp ) ) . toBe (
129- "F8oiKU5wmZs8jZQng1zyzbcHPkvECSwHitFJvuc5rQGP"
130- ) ;
120+ expect ( toAddress ( kp ) ) . toBe ( "F8oiKU5wmZs8jZQng1zyzbcHPkvECSwHitFJvuc5rQGP" ) ;
131121 } ) ;
132122
133123 test ( "same non-hardened path is deterministic" , async ( ) => {
134- const a = await KeyPair . fromSeedPhrase (
135- TEST_MNEMONIC ,
136- "m/44'/501'/0'/0"
137- ) ;
138- const b = await KeyPair . fromSeedPhrase (
139- TEST_MNEMONIC ,
140- "m/44'/501'/0'/0"
141- ) ;
124+ const a = await KeyPair . fromSeedPhrase ( TEST_MNEMONIC , "m/44'/501'/0'/0" ) ;
125+ const b = await KeyPair . fromSeedPhrase ( TEST_MNEMONIC , "m/44'/501'/0'/0" ) ;
142126 expect ( a . privateKey ) . toEqual ( b . privateKey ) ;
143127 expect ( a . publicKey ) . toEqual ( b . publicKey ) ;
144128 } ) ;
0 commit comments