@@ -269,7 +269,7 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
269269 }
270270
271271 public async getAccounts ( ) : Promise < readonly AccountData [ ] > {
272- const accountsWithPrivkeys = await this . getAccountsWithPrivkeys ( ) ;
272+ const accountsWithPrivkeys = this . getAccountsWithPrivkeys ( ) ;
273273 return accountsWithPrivkeys . map ( ( { algo, pubkey, address } ) => ( {
274274 algo : algo ,
275275 pubkey : pubkey ,
@@ -278,14 +278,14 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
278278 }
279279
280280 public async signAmino ( signerAddress : string , signDoc : StdSignDoc ) : Promise < AminoSignResponse > {
281- const accounts = await this . getAccountsWithPrivkeys ( ) ;
281+ const accounts = this . getAccountsWithPrivkeys ( ) ;
282282 const account = accounts . find ( ( { address } ) => address === signerAddress ) ;
283283 if ( account === undefined ) {
284284 throw new Error ( `Address ${ signerAddress } not found in wallet` ) ;
285285 }
286286 const { privkey, pubkey } = account ;
287287 const message = sha256 ( serializeSignDoc ( signDoc ) ) ;
288- const signature = await Secp256k1 . createSignature ( message , privkey ) ;
288+ const signature = Secp256k1 . createSignature ( message , privkey ) ;
289289 const signatureBytes = new Uint8Array ( [ ...signature . r ( 32 ) , ...signature . s ( 32 ) ] ) ;
290290 return {
291291 signed : signDoc ,
@@ -347,27 +347,25 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
347347 return JSON . stringify ( out ) ;
348348 }
349349
350- private async getKeyPair ( hdPath : HdPath ) : Promise < Secp256k1Keypair > {
350+ private getKeyPair ( hdPath : HdPath ) : Secp256k1Keypair {
351351 const { privkey } = Slip10 . derivePath ( Slip10Curve . Secp256k1 , this . seed , hdPath ) ;
352- const { pubkey } = await Secp256k1 . makeKeypair ( privkey ) ;
352+ const { pubkey } = Secp256k1 . makeKeypair ( privkey ) ;
353353 return {
354354 privkey : privkey ,
355355 pubkey : Secp256k1 . compressPubkey ( pubkey ) ,
356356 } ;
357357 }
358358
359- private async getAccountsWithPrivkeys ( ) : Promise < readonly AccountDataWithPrivkey [ ] > {
360- return Promise . all (
361- this . accounts . map ( async ( { hdPath, prefix } ) => {
362- const { privkey, pubkey } = await this . getKeyPair ( hdPath ) ;
363- const address = toBech32 ( prefix , rawSecp256k1PubkeyToRawAddress ( pubkey ) ) ;
364- return {
365- algo : "secp256k1" as const ,
366- privkey : privkey ,
367- pubkey : pubkey ,
368- address : address ,
369- } ;
370- } ) ,
371- ) ;
359+ private getAccountsWithPrivkeys ( ) : readonly AccountDataWithPrivkey [ ] {
360+ return this . accounts . map ( ( { hdPath, prefix } ) => {
361+ const { privkey, pubkey } = this . getKeyPair ( hdPath ) ;
362+ const address = toBech32 ( prefix , rawSecp256k1PubkeyToRawAddress ( pubkey ) ) ;
363+ return {
364+ algo : "secp256k1" as const ,
365+ privkey : privkey ,
366+ pubkey : pubkey ,
367+ address : address ,
368+ } ;
369+ } ) ;
372370 }
373371}
0 commit comments