File tree 1 file changed +10
-6
lines changed
packages/keyring-controller/src
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -941,15 +941,19 @@ export class KeyringController extends BaseController<
941
941
privateKey = remove0x ( prefixed ) ;
942
942
break ;
943
943
case 'json' :
944
- let wallet ;
945
- const [ input , password ] = args ;
946
- try {
947
- wallet = importers . fromEtherWallet ( input , password ) ;
948
- } catch ( e ) {
949
- wallet = wallet || ( await Wallet . fromV3 ( input , password , true ) ) ;
944
+ {
945
+ const getWallet = async ( ) : Promise < Wallet > => {
946
+ const [ input , password ] = args ;
947
+ try {
948
+ return importers . fromEtherWallet ( input , password ) ;
949
+ } catch ( e ) {
950
+ return Wallet . fromV3 ( input , password , true ) ;
951
+ }
950
952
}
953
+ const wallet = await getWallet ( ) ;
951
954
privateKey = bytesToHex ( wallet . getPrivateKey ( ) ) ;
952
955
break ;
956
+ }
953
957
default :
954
958
throw new Error ( `Unexpected import strategy: '${ strategy } '` ) ;
955
959
}
You can’t perform that action at this time.
0 commit comments