@toruslabs/ethereum-controllers 5.5.0 → 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.
- package/dist/ethereumControllers.cjs.js +6 -9
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +8 -10
- package/dist/ethereumControllers.esm.js.map +1 -1
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.LICENSE.txt +0 -2
- package/dist/ethereumControllers.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/Block/PollingBlockTracker.ts +1 -1
- package/src/Keyring/KeyringController.ts +6 -7
- package/src/Message/AddChainController.ts +1 -1
|
@@ -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
|
|
2593
|
-
const
|
|
2594
|
-
const
|
|
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
|
|
2599
|
+
publicKey,
|
|
2603
2600
|
privateKey: accountPrivateKey,
|
|
2604
2601
|
address
|
|
2605
2602
|
}]
|
|
@@ -2943,7 +2940,7 @@ class AddChainController extends AbstractMessageController {
|
|
|
2943
2940
|
try {
|
|
2944
2941
|
const msgObject = this.getMessage(messageId);
|
|
2945
2942
|
await this.approveMessage(messageId, msgObject.messageParams);
|
|
2946
|
-
this.addChain(msgObject.messageParams);
|
|
2943
|
+
await this.addChain(msgObject.messageParams);
|
|
2947
2944
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
2948
2945
|
rawSig: JSON.stringify(msgObject.messageParams)
|
|
2949
2946
|
}));
|