@toruslabs/ethereum-controllers 5.5.1 → 5.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2561,7 +2561,6 @@ const eth_sig_util_namespaceObject = require("@metamask/eth-sig-util");
2561
2561
 
2562
2562
 
2563
2563
 
2564
-
2565
2564
  class KeyringController extends base_controllers_namespaceObject.BaseKeyringController {
2566
2565
  constructor(_ref) {
2567
2566
  let {
@@ -2589,17 +2588,15 @@ class KeyringController extends base_controllers_namespaceObject.BaseKeyringCont
2589
2588
  return this.state.wallets.map(w => w.publicKey);
2590
2589
  }
2591
2590
  importAccount(accountPrivateKey) {
2592
- const hexPrivateKey = (0,util_namespaceObject.addHexPrefix)(accountPrivateKey);
2593
- const signingKey = new external_ethers_namespaceObject.SigningKey(hexPrivateKey);
2594
- const wallet = new external_ethers_namespaceObject.Wallet(signingKey.privateKey);
2595
- const {
2596
- address
2597
- } = wallet;
2591
+ const hexPrivateKey = accountPrivateKey.padStart(64, "0");
2592
+ const bufferPrivKey = Buffer.from(hexPrivateKey, "hex");
2593
+ const publicKey = (0,util_namespaceObject.bytesToHex)((0,util_namespaceObject.privateToPublic)(bufferPrivKey));
2594
+ const address = (0,util_namespaceObject.bytesToHex)((0,util_namespaceObject.privateToAddress)(bufferPrivKey));
2598
2595
  const existingWallet = this.state.wallets.find(w => w.address === address);
2599
2596
  if (existingWallet) return existingWallet.address;
2600
2597
  this.update({
2601
2598
  wallets: [...this.state.wallets, {
2602
- publicKey: signingKey.publicKey,
2599
+ publicKey,
2603
2600
  privateKey: accountPrivateKey,
2604
2601
  address
2605
2602
  }]