Skip to content

Commit

Permalink
fix: wallet privatekey import fix
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Apr 25, 2024
1 parent fb65c22 commit 39a92d8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/keyring-controller/src/KeyringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -941,15 +941,19 @@ export class KeyringController extends BaseController<
privateKey = remove0x(prefixed);
break;
case 'json':

Check failure on line 943 in packages/keyring-controller/src/KeyringController.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Delete `⏎·······`
let wallet;
const [input, password] = args;
try {
wallet = importers.fromEtherWallet(input, password);
} catch (e) {
wallet = wallet || (await Wallet.fromV3(input, password, true));
{
const getWallet = async (): Promise<Wallet> => {
const [input, password] = args;
try {
return importers.fromEtherWallet(input, password);
} catch (e) {
return Wallet.fromV3(input, password, true);
}
}

Check failure on line 952 in packages/keyring-controller/src/KeyringController.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (20.x)

Insert `;`
const wallet = await getWallet();
privateKey = bytesToHex(wallet.getPrivateKey());
break;
}
default:
throw new Error(`Unexpected import strategy: '${strategy}'`);
}
Expand Down

0 comments on commit 39a92d8

Please sign in to comment.