Skip to content

Commit

Permalink
Update ethereumjs-wallet from v0.6.5 to v1.0.1 (#347)
Browse files Browse the repository at this point in the history
`ethereumjs-wallet` was migrated to TypeScript in v1, so this update
brings types with it. There were various API changes as well [1], which
have all been accounted for.

[1]: https://github.com/ethereumjs/ethereumjs-wallet/releases/tag/v1.0.0
  • Loading branch information
Gudahtt authored and MajorLift committed Oct 11, 2023
1 parent d3ab44c commit c604889
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"eth-rpc-errors": "^4.0.0",
"eth-sig-util": "^3.0.0",
"ethereumjs-util": "^6.1.0",
"ethereumjs-wallet": "^0.6.4",
"ethereumjs-wallet": "^1.0.1",
"human-standard-collectible-abi": "^1.0.2",
"human-standard-token-abi": "^2.0.0",
"isomorphic-fetch": "^3.0.0",
Expand Down
5 changes: 2 additions & 3 deletions src/keyring/KeyringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
signTypedData_v4,
signTypedDataLegacy,
} from 'eth-sig-util';
import Wallet, { thirdparty as importers } from 'ethereumjs-wallet';
import BaseController, { BaseConfig, BaseState, Listener } from '../BaseController';
import PreferencesController from '../user/PreferencesController';
import { Transaction } from '../transaction/TransactionController';
Expand All @@ -13,9 +14,7 @@ import { TypedMessageParams } from '../message-manager/TypedMessageManager';

const Keyring = require('eth-keyring-controller');
const { Mutex } = require('async-mutex');
const Wallet = require('ethereumjs-wallet');
const ethUtil = require('ethereumjs-util');
const importers = require('ethereumjs-wallet/thirdparty');

const privates = new WeakMap();

Expand Down Expand Up @@ -288,7 +287,7 @@ export class KeyringController extends BaseController<KeyringConfig, KeyringStat
try {
wallet = importers.fromEtherWallet(input, password);
} catch (e) {
wallet = wallet || Wallet.fromV3(input, password, true);
wallet = wallet || await Wallet.fromV3(input, password, true);
}
privateKey = ethUtil.bufferToHex(wallet.getPrivateKey());
break;
Expand Down
49 changes: 47 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,13 @@
dependencies:
"@types/node" "*"

"@types/bn.js@^4.11.3":
version "4.11.6"
resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c"
integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==
dependencies:
"@types/node" "*"

"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
Expand Down Expand Up @@ -1475,6 +1482,11 @@ bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==

bn.js@^5.1.2:
version "5.1.3"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b"
integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==

brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
Expand Down Expand Up @@ -2780,6 +2792,18 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0:
safe-buffer "^5.1.1"
secp256k1 "^3.0.1"

ethereumjs-util@^7.0.2:
version "7.0.8"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.0.8.tgz#5258762b7b17e3d828e41834948363ff0a703ffd"
integrity sha512-JJt7tDpCAmDPw/sGoFYeq0guOVqT3pTE9xlEbBmc/nlCij3JRCoS2c96SQ6kXVHOT3xWUNLDm5QCJLQaUnVAtQ==
dependencies:
"@types/bn.js" "^4.11.3"
bn.js "^5.1.2"
create-hash "^1.1.2"
ethereum-cryptography "^0.1.3"
ethjs-util "0.1.6"
rlp "^2.2.4"

ethereumjs-vm@^2.3.4:
version "2.6.0"
resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-2.6.0.tgz#76243ed8de031b408793ac33907fb3407fe400c6"
Expand All @@ -2797,7 +2821,7 @@ ethereumjs-vm@^2.3.4:
rustbn.js "~0.2.0"
safe-buffer "^5.1.1"

ethereumjs-wallet@^0.6.0, ethereumjs-wallet@^0.6.4:
ethereumjs-wallet@^0.6.0:
version "0.6.5"
resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.5.tgz#685e9091645cee230ad125c007658833991ed474"
integrity sha512-MDwjwB9VQVnpp/Dc1XzA6J1a3wgHQ4hSvA1uWNatdpOrtCbPVuQSKSyRnjLvS0a+KKMw2pvQ9Ybqpb3+eW8oNA==
Expand All @@ -2812,6 +2836,20 @@ ethereumjs-wallet@^0.6.0, ethereumjs-wallet@^0.6.4:
utf8 "^3.0.0"
uuid "^3.3.2"

ethereumjs-wallet@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-1.0.1.tgz#664a4bcacfc1291ca2703de066df1178938dba1c"
integrity sha512-3Z5g1hG1das0JWU6cQ9HWWTY2nt9nXCcwj7eXVNAHKbo00XAZO8+NHlwdgXDWrL0SXVQMvTWN8Q/82DRH/JhPw==
dependencies:
aes-js "^3.1.1"
bs58check "^2.1.2"
ethereum-cryptography "^0.1.3"
ethereumjs-util "^7.0.2"
randombytes "^2.0.6"
scrypt-js "^3.0.1"
utf8 "^3.0.0"
uuid "^3.3.2"

ethjs-abi@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/ethjs-abi/-/ethjs-abi-0.2.0.tgz#d3e2c221011520fc499b71682036c14fcc2f5b25"
Expand Down Expand Up @@ -6168,6 +6206,13 @@ rlp@^2.0.0:
bn.js "^4.11.1"
safe-buffer "^5.1.1"

rlp@^2.2.4:
version "2.2.6"
resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.6.tgz#c80ba6266ac7a483ef1e69e8e2f056656de2fb2c"
integrity sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg==
dependencies:
bn.js "^4.11.1"

rsvp@^4.8.4:
version "4.8.5"
resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734"
Expand Down Expand Up @@ -6248,7 +6293,7 @@ saxes@^5.0.0:
dependencies:
xmlchars "^2.2.0"

scrypt-js@^3.0.0:
scrypt-js@^3.0.0, scrypt-js@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312"
integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==
Expand Down

0 comments on commit c604889

Please sign in to comment.