We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 346de6a commit 3736bbaCopy full SHA for 3736bba
packages/keyring-controller/src/KeyringController.ts
@@ -1055,13 +1055,15 @@ export class KeyringController extends BaseController<
1055
privateKey = remove0x(prefixed);
1056
break;
1057
case 'json':
1058
- let wallet;
1059
const [input, password] = args;
1060
- try {
1061
- wallet = importers.fromEtherWallet(input, password);
1062
- } catch (e) {
1063
- wallet = wallet || (await Wallet.fromV3(input, password, true));
1064
- }
+ const getWallet = async () => {
+ try {
+ return await importers.fromEtherWallet(input, password);
+ } catch (e) {
+ return await Wallet.fromV3(input, password, true);
+ }
1065
+ };
1066
+ const wallet: Wallet = await getWallet();
1067
privateKey = bytesToHex(wallet.getPrivateKey());
1068
1069
default:
0 commit comments