Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Use @ethereumjs/tx (newer version of lib) instead of ethereumjs-tx
Browse files Browse the repository at this point in the history
  • Loading branch information
eggplantzzz committed Mar 18, 2021
1 parent a3dcd66 commit 6ae17bc
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 13 deletions.
3 changes: 1 addition & 2 deletions packages/hdwallet-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@
},
"types": "dist/index.d.ts",
"dependencies": {
"@ethereumjs/tx": "^3.0.2",
"@trufflesuite/web3-provider-engine": "15.0.13-1",
"any-promise": "^1.3.0",
"bindings": "^1.5.0",
"ethereum-cryptography": "^0.1.3",
"ethereum-protocol": "^1.0.1",
"ethereumjs-tx": "^1.0.0",
"ethereumjs-util": "^6.1.0",
"ethereumjs-wallet": "^1.0.1",
"source-map-support": "^0.5.19"
},
"devDependencies": {
"@types/bip39": "^2.4.2",
"@types/ethereum-protocol": "^1.0.0",
"@types/ethereumjs-tx": "^1.0.1",
"@types/ethereumjs-util": "^5.2.0",
"@types/mocha": "^5.2.7",
"@types/web3": "^1.0.20",
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-provider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { wordlist } from "ethereum-cryptography/bip39/wordlists/english";
import * as EthUtil from "ethereumjs-util";
import ethJSWallet from "ethereumjs-wallet";
import { hdkey as EthereumHDKey } from "ethereumjs-wallet";
import Transaction from "ethereumjs-tx";
import { Transaction } from "@ethereumjs/tx";
// @ts-ignore
import ProviderEngine from "@trufflesuite/web3-provider-engine";
import FiltersSubprovider from "@trufflesuite/web3-provider-engine/subproviders/filters";
Expand Down Expand Up @@ -150,7 +150,7 @@ class HDWalletProvider {
} else {
cb("Account not found");
}
const tx = new Transaction(txParams);
const tx = Transaction.fromTxData(txParams);
tx.sign(pkey as Buffer);
const rawTx = `0x${tx.serialize().toString("hex")}`;
cb(null, rawTx);
Expand Down
62 changes: 53 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,21 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@ethereumjs/common@^2.0.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.1.0.tgz#00534e89419f43556843f73abdf40235f37693ee"
integrity sha512-sY2yBKwZjlIM5Z+sBd9ZEEH5YDB5OsvSVCi5hzTqeMfv4307JfLH0MjM09whi4InLmqWRdJp/fmt/rQyP4qxKg==
dependencies:
crc-32 "^1.2.0"

"@ethereumjs/tx@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.0.2.tgz#9cd34226cad25fa6d1d66b620f647f846e649cbb"
integrity sha512-zmFCosjOdj1WoYEiQBdC4sCOAllBEwxdKuY85L9FgZ4zVDfZUVsQ4S9paczt4hVt65A7N8sJwgVEzDaQmrRaqw==
dependencies:
"@ethereumjs/common" "^2.0.0"
ethereumjs-util "^7.0.8"

"@ethersproject/abi@5.0.0-beta.153":
version "5.0.0-beta.153"
resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz#43a37172b33794e4562999f6e2d555b7599a8eee"
Expand Down Expand Up @@ -2788,6 +2803,13 @@
dependencies:
"@types/node" "*"

"@types/bn.js@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68"
integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==
dependencies:
"@types/node" "*"

"@types/body-parser@*":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.0.tgz#9f5c9d9bd04bb54be32d5eb9fc0d8c974e6cf58c"
Expand Down Expand Up @@ -2898,14 +2920,6 @@
dependencies:
bignumber.js "7.2.1"

"@types/ethereumjs-tx@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/ethereumjs-tx/-/ethereumjs-tx-1.0.1.tgz#31a46b858a51ec4395959b2ae37f5064a8688fbd"
integrity sha512-UtucmY/WoMCDhNebyFJQ+AevyFGeTgh8UYZE1aWqIRkk90E+eKWgGV2lAVjkg/gXqxLkJYZ0RcV1J09K9xlSvw==
dependencies:
"@types/bn.js" "*"
"@types/node" "*"

"@types/ethereumjs-util@^5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@types/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz#f49fe8114789ec0871721392c09318c3eb56671b"
Expand Down Expand Up @@ -7616,6 +7630,14 @@ cpr@^3.0.1:
mkdirp "~0.5.1"
rimraf "^2.5.4"

crc-32@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.0.tgz#cb2db6e29b88508e32d9dd0ec1693e7b41a18208"
integrity sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==
dependencies:
exit-on-epipe "~1.0.1"
printj "~1.1.0"

create-ecdh@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff"
Expand Down Expand Up @@ -9729,7 +9751,7 @@ ethereumjs-tx@2.1.2, ethereumjs-tx@^2.1.2:
ethereumjs-common "^1.5.0"
ethereumjs-util "^6.0.0"

ethereumjs-tx@^1.0.0, ethereumjs-tx@^1.1.1, ethereumjs-tx@^1.2.0, ethereumjs-tx@^1.2.2, ethereumjs-tx@^1.3.3, ethereumjs-tx@^1.3.7:
ethereumjs-tx@^1.1.1, ethereumjs-tx@^1.2.0, ethereumjs-tx@^1.2.2, ethereumjs-tx@^1.3.3, ethereumjs-tx@^1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a"
integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA==
Expand Down Expand Up @@ -9833,6 +9855,18 @@ ethereumjs-util@^7.0.2:
ethjs-util "0.1.6"
rlp "^2.2.4"

ethereumjs-util@^7.0.8:
version "7.0.9"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.0.9.tgz#2038baeb30f370a3e576ec175bd70bbbb6807d42"
integrity sha512-cRqvYYKJoitq6vMKMf8pXeVwvTrX+dRD0JwHaYqm8jvogK14tqIoCWH/KUHcRwnVxVXEYF/o6pup5jRG4V0xzg==
dependencies:
"@types/bn.js" "^5.1.0"
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@4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-4.2.0.tgz#e885e861424e373dbc556278f7259ff3fca5edab"
Expand Down Expand Up @@ -10100,6 +10134,11 @@ execution-time@^1.2.0:
dependencies:
pretty-hrtime "^1.0.3"

exit-on-epipe@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz#0bdd92e87d5285d267daa8171d0eb06159689692"
integrity sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==

exit@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
Expand Down Expand Up @@ -18442,6 +18481,11 @@ pretty-ms@^7.0.0:
dependencies:
parse-ms "^2.1.0"

printj@~1.1.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/printj/-/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222"
integrity sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==

private@^0.1.6, private@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
Expand Down

0 comments on commit 6ae17bc

Please sign in to comment.