From aeac5fcc0e37ba1f797871641845077586c8e360 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Wed, 6 Sep 2023 23:00:15 +0000 Subject: [PATCH 1/8] WIP: replace & upgrade deps in hdwallet-providers --- packages/hdwallet-provider/package.json | 9 +- packages/hdwallet-provider/src/index.ts | 6 +- yarn.lock | 575 ++++++++++++------------ 3 files changed, 303 insertions(+), 287 deletions(-) diff --git a/packages/hdwallet-provider/package.json b/packages/hdwallet-provider/package.json index c9cfdac4c5c..6a22b4746b0 100644 --- a/packages/hdwallet-provider/package.json +++ b/packages/hdwallet-provider/package.json @@ -23,21 +23,24 @@ "dependencies": { "@ethereumjs/common": "^2.4.0", "@ethereumjs/tx": "^3.3.0", + "@metamask/eth-json-rpc-middleware": "^11.0.1", + "@metamask/eth-json-rpc-provider": "^2.0.0", "@metamask/eth-sig-util": "4.0.1", + "@metamask/json-rpc-engine": "^7.1.1", + "@metamask/utils": "^8.1.0", "@truffle/hdwallet": "^0.1.4", "@types/ethereum-protocol": "^1.0.0", "@types/web3": "1.0.20", - "@types/web3-provider-engine": "^14.0.0", "ethereum-cryptography": "1.1.2", "ethereum-protocol": "^1.0.1", "ethereumjs-util": "^7.1.5", - "web3": "1.10.0", - "web3-provider-engine": "16.0.3" + "nonce-tracker": "^1.1.0" }, "devDependencies": { "@types/bip39": "^2.4.2", "@types/ethereumjs-util": "^5.2.0", "@types/mocha": "^5.2.7", + "eth-json-rpc-filters": "^6.0.0", "ganache": "7.9.1", "mocha": "10.1.0", "ts-node": "10.7.0", diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index 1c264221cec..fc21ff1fd6a 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -7,7 +7,7 @@ import * as EthUtil from "ethereumjs-util"; import { Transaction, FeeMarketEIP1559Transaction } from "@ethereumjs/tx"; import Common from "@ethereumjs/common"; -import ProviderEngine from "web3-provider-engine"; +import ProviderEngine from "@metamask/json-rpc-engine"; // @ts-ignore - web3-provider-engine doesn't have declaration files for these subproviders import FiltersSubprovider from "web3-provider-engine/subproviders/filters"; // @ts-ignore @@ -99,7 +99,7 @@ class HDWalletProvider { [ `No provider or an invalid provider was specified: '${providerToUse}'`, "Please specify a valid provider or URL, using the http, https, " + - "ws, or wss protocol.", + "ws, or wss protocol.", "" ].join("\n") ); @@ -119,7 +119,7 @@ class HDWalletProvider { if (this.#addresses.length === 0) { throw new Error( `Could not create addresses from your mnemonic or private key(s). ` + - `Please check that your inputs are correct.` + `Please check that your inputs are correct.` ); } diff --git a/yarn.lock b/yarn.lock index 55dfd4920b2..1f789ea3841 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1638,7 +1638,15 @@ crc-32 "^1.2.0" ethereumjs-util "^7.1.1" -"@ethereumjs/rlp@^4.0.0-beta.2": +"@ethereumjs/common@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.2.0.tgz#b71df25845caf5456449163012074a55f048e0a0" + integrity sha512-pksvzI0VyLgmuEF2FA/JR/4/y6hcPq8OUail3/AvycBaW1d5VSauOZzqGvJ3RTmR4MU35lWE8KseKOsEhrFRBA== + dependencies: + "@ethereumjs/util" "^8.1.0" + crc-32 "^1.2.0" + +"@ethereumjs/rlp@^4.0.0-beta.2", "@ethereumjs/rlp@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== @@ -1651,6 +1659,16 @@ "@ethereumjs/common" "^2.5.0" ethereumjs-util "^7.1.2" +"@ethereumjs/tx@^4.1.2": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.2.0.tgz#5988ae15daf5a3b3c815493bc6b495e76009e853" + integrity sha512-1nc6VO4jtFd172BbSnTnDQVr9IYBFl1y4xPzZdtkrkKIncBCkdbgfdRV+MiTkJYAtTxvV12GRZLqBFT1PNK6Yw== + dependencies: + "@ethereumjs/common" "^3.2.0" + "@ethereumjs/rlp" "^4.0.1" + "@ethereumjs/util" "^8.1.0" + ethereum-cryptography "^2.0.0" + "@ethereumjs/util@8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.0.2.tgz#b7348fc7253649b0f00685a94546c6eee1fad819" @@ -1660,6 +1678,15 @@ async "^3.2.4" ethereum-cryptography "^1.1.2" +"@ethereumjs/util@^8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.1.0.tgz#299df97fb6b034e0577ce9f94c7d9d1004409ed4" + integrity sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA== + dependencies: + "@ethereumjs/rlp" "^4.0.1" + ethereum-cryptography "^2.0.0" + micro-ftch "^0.3.1" + "@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" @@ -3293,6 +3320,47 @@ resolved "https://registry.yarnpkg.com/@mantine/utils/-/utils-5.10.5.tgz#ad620d714e545c6efb7f69d94ce46e3fd2fe01fb" integrity sha512-FGMq4dGs5HhDAtI0z46uzxzKKPmZ3h5uKUyKg1ZHoFR1mBtcUMbB6FylFmHqKFRWlJ5IXqX9dwmiVrLYUOfTmA== +"@metamask/abi-utils@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-1.2.0.tgz#068e1b0f5e423dfae96961e0e5276a7c1babc03a" + integrity sha512-Hf7fnBDM9ptCPDtq/wQffWbw859CdVGMwlpWUEsTH6gLXhXONGrRXHA2piyYPRuia8YYTdJvRC/zSK1/nyLvYg== + dependencies: + "@metamask/utils" "^3.4.1" + superstruct "^1.0.3" + +"@metamask/eth-json-rpc-middleware@^11.0.1": + version "11.0.2" + resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-middleware/-/eth-json-rpc-middleware-11.0.2.tgz#85e6639f5d159a3277d13609dea9f12ebfb5b4e8" + integrity sha512-/HqtuK/6E8sIJmzg0O3Ey5JsgK6O/VbDqg5R9thHFQMi9EtKXnnZFc8Blir7IOQraGVJFiZQIKZMHRTNQRyreg== + dependencies: + "@metamask/eth-json-rpc-provider" "^1.0.0" + "@metamask/eth-sig-util" "^6.0.0" + "@metamask/utils" "^5.0.1" + clone "^2.1.1" + eth-block-tracker "^7.0.1" + eth-rpc-errors "^4.0.3" + json-rpc-engine "^6.1.0" + pify "^3.0.0" + safe-stable-stringify "^2.3.2" + +"@metamask/eth-json-rpc-provider@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-provider/-/eth-json-rpc-provider-1.0.1.tgz#3fd5316c767847f4ca107518b611b15396a5a32c" + integrity sha512-whiUMPlAOrVGmX8aKYVPvlKyG4CpQXiNNyt74vE1xb5sPvmx5oA7B/kOi/JdBvhGQq97U1/AVdXEdk2zkP8qyA== + dependencies: + "@metamask/json-rpc-engine" "^7.0.0" + "@metamask/safe-event-emitter" "^3.0.0" + "@metamask/utils" "^5.0.1" + +"@metamask/eth-json-rpc-provider@^2.0.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-provider/-/eth-json-rpc-provider-2.2.0.tgz#7d7551ff075a42992cd7fd4054868f6a5f9ee541" + integrity sha512-pJk533YEEH/GbZMHoV4CEDQhH2/HeG/2M3JhNnhblcAMIYKaLDkl/+01hc0mDAgYs4vxf8FBkniBUlX5o7FLSQ== + dependencies: + "@metamask/json-rpc-engine" "^7.1.0" + "@metamask/safe-event-emitter" "^3.0.0" + "@metamask/utils" "^8.1.0" + "@metamask/eth-sig-util@4.0.1", "@metamask/eth-sig-util@^4.0.0": version "4.0.1" resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz#3ad61f6ea9ad73ba5b19db780d40d9aae5157088" @@ -3304,11 +3372,79 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" +"@metamask/eth-sig-util@^6.0.0": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-6.0.1.tgz#2c5a670c9552ce4d47309d5f5d6569d0518fec23" + integrity sha512-Lt2DC4w4Sbtbd4DCsE+vfjdWcnFHSxfSfiJpt66hfLtAbetHsvbZcwKoa46TEA3G/V48ZuS4NWvJmtaA4F8UWA== + dependencies: + "@ethereumjs/util" "^8.1.0" + "@metamask/abi-utils" "^1.2.0" + "@metamask/utils" "^5.0.2" + ethereum-cryptography "^2.1.2" + ethjs-util "^0.1.6" + tweetnacl "^1.0.3" + tweetnacl-util "^0.15.1" + +"@metamask/json-rpc-engine@^7.0.0", "@metamask/json-rpc-engine@^7.1.0", "@metamask/json-rpc-engine@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@metamask/json-rpc-engine/-/json-rpc-engine-7.1.1.tgz#90d4c1e1fe3bcfc983563f6e07715319b8857190" + integrity sha512-wPB8Or74OqMwcxa87JPOEjXwtgpyHPEXiLKblKRAtCjTJNQFp1Co//1CgFm5xj4Z5JbBGfGFiQNnj09Et40sig== + dependencies: + "@metamask/rpc-errors" "^6.0.0" + "@metamask/safe-event-emitter" "^3.0.0" + "@metamask/utils" "^8.1.0" + +"@metamask/rpc-errors@^6.0.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@metamask/rpc-errors/-/rpc-errors-6.1.0.tgz#dfdef7cba4b9ad01ca3f99e990b5980575b89b4f" + integrity sha512-JQElKxai26FpDyRKO/yH732wI+BV90i1u6pOuDOpdADSbppB2g1pPh3AGST1zkZqEE9eIKIUw8UdBQ4rp3VTSg== + dependencies: + "@metamask/utils" "^8.1.0" + fast-safe-stringify "^2.0.6" + "@metamask/safe-event-emitter@2.0.0", "@metamask/safe-event-emitter@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q== +"@metamask/safe-event-emitter@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.0.0.tgz#8c2b9073fe0722d48693143b0dc8448840daa3bd" + integrity sha512-j6Z47VOmVyGMlnKXZmL0fyvWfEYtKWCA9yGZkU3FCsGZUT5lHGmvaV9JA5F2Y+010y7+ROtR3WMXIkvl/nVzqQ== + +"@metamask/utils@^3.4.1": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" + integrity sha512-9cIRrfkWvHblSiNDVXsjivqa9Ak0RYo/1H6tqTqTbAx+oBK2Sva0lWDHxGchOqA7bySGUJKAWSNJvH6gdHZ0gQ== + dependencies: + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.3.8" + superstruct "^1.0.3" + +"@metamask/utils@^5.0.1", "@metamask/utils@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-5.0.2.tgz#140ba5061d90d9dac0280c19cab101bc18c8857c" + integrity sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g== + dependencies: + "@ethereumjs/tx" "^4.1.2" + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.3.8" + superstruct "^1.0.3" + +"@metamask/utils@^8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.1.0.tgz#b8e73f5b4696b1b668cf5c1421daad140a3f98ac" + integrity sha512-sFNpzBKRicDgM2ZuU6vrPROlqNGm8/jDsjc5WrU1RzCkAMc4Xr3vUUf8p59uQ6B09etUWNb8d2GTCbISdmH/Ug== + dependencies: + "@ethereumjs/tx" "^4.1.2" + "@noble/hashes" "^1.3.1" + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.5.4" + superstruct "^1.0.3" + "@microsoft/api-extractor-model@7.27.6": version "7.27.6" resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.27.6.tgz#308e44cd595d2fb446c6357759ee0675ec37d26e" @@ -3358,11 +3494,28 @@ dependencies: eslint-scope "5.1.1" +"@noble/curves@1.1.0", "@noble/curves@~1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" + integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== + dependencies: + "@noble/hashes" "1.3.1" + "@noble/hashes@1.1.2", "@noble/hashes@~1.1.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== +"@noble/hashes@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" + integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== + +"@noble/hashes@^1.3.1", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@noble/secp256k1@1.6.3", "@noble/secp256k1@~1.6.0": version "1.6.3" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.3.tgz#7eed12d9f4404b416999d0c87686836c4c5c9b94" @@ -4186,6 +4339,15 @@ "@noble/secp256k1" "~1.6.0" "@scure/base" "~1.1.0" +"@scure/bip32@1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.1.tgz#7248aea723667f98160f593d621c47e208ccbb10" + integrity sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A== + dependencies: + "@noble/curves" "~1.1.0" + "@noble/hashes" "~1.3.1" + "@scure/base" "~1.1.0" + "@scure/bip39@1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.0.tgz#92f11d095bae025f166bef3defcc5bf4945d419a" @@ -4194,6 +4356,14 @@ "@noble/hashes" "~1.1.1" "@scure/base" "~1.1.0" +"@scure/bip39@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" + integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== + dependencies: + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + "@sentry/core@5.30.0": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3" @@ -4657,7 +4827,7 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194" integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA== -"@types/ethereum-protocol@*", "@types/ethereum-protocol@^1.0.0": +"@types/ethereum-protocol@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/ethereum-protocol/-/ethereum-protocol-1.0.0.tgz#416e3827d5fdfa4658b0045b35a008747871b271" integrity sha512-3DiI3Zxf81CgX+VhxNNFJBv/sfr1BFBKQK2sQ85hU9FwWJJMWV5gRDV79OUNShiwj3tYYIezU94qpucsb3dThQ== @@ -5290,13 +5460,6 @@ resolved "https://registry.yarnpkg.com/@types/utf8/-/utf8-2.1.6.tgz#430cabb71a42d0a3613cce5621324fe4f5a25753" integrity sha512-pRs2gYF5yoKYrgSaira0DJqVg2tFuF+Qjp838xS7K+mJyY2jJzjsrl6y17GbIa4uMRogMbxs+ghNCvKg6XyNrA== -"@types/web3-provider-engine@^14.0.0": - version "14.0.1" - resolved "https://registry.yarnpkg.com/@types/web3-provider-engine/-/web3-provider-engine-14.0.1.tgz#9ceb76af025e9359a28cff1f0fc4c19070c40ab7" - integrity sha512-SaAfLJY/40wKFDsNFwaNfwqFSL6kVhTx9JD18qM+Gaw1qdAXLYF/6E7TIqWEdoG4so6fki/zxURP5NsoCePYJw== - dependencies: - "@types/ethereum-protocol" "*" - "@types/web3@1.0.20": version "1.0.20" resolved "https://registry.yarnpkg.com/@types/web3/-/web3-1.0.20.tgz#234dd1f976702c0daaff147c80f24a5582e09d0e" @@ -5947,13 +6110,6 @@ abstract-leveldown@^6.2.1, abstract-leveldown@~6.2.1, abstract-leveldown@~6.2.3: level-supports "~1.0.0" xtend "~4.0.0" -abstract-leveldown@~2.6.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz#1c5e8c6a5ef965ae8c35dfb3a8770c476b82c4b8" - integrity sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA== - dependencies: - xtend "~4.0.0" - abstract-leveldown@~6.0.0: version "6.0.3" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz#b4b6159343c74b0c5197b2817854782d8f748c4a" @@ -6626,7 +6782,7 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-eventemitter@0.2.4, async-eventemitter@^0.2.2: +async-eventemitter@0.2.4: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== @@ -6645,6 +6801,13 @@ async-mutex@^0.2.6: dependencies: tslib "^2.0.0" +async-mutex@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.3.2.tgz#1485eda5bda1b0ec7c8df1ac2e815757ad1831df" + integrity sha512-HuTK7E7MT7jZEh1P9GtRW9+aTWiDWWi9InbZ5hjxrnRa39KS4BW04+xLBhYNS2aXhHUIKZSw3gj4Pn1pj+qGAA== + dependencies: + tslib "^2.3.1" + async-retry@^1.2.1, async-retry@^1.3.1: version "1.3.3" resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280" @@ -6652,12 +6815,7 @@ async-retry@^1.2.1, async-retry@^1.3.1: dependencies: retry "0.13.1" -async@^1.4.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= - -async@^2.0.1, async@^2.1.2, async@^2.4.0, async@^2.5.0: +async@^2.4.0: version "2.6.3" resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== @@ -7392,13 +7550,6 @@ babylon@^6.18.0: resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== -backoff@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/backoff/-/backoff-2.5.0.tgz#f616eda9d3e4b66b8ca7fca79f695722c5f8e26f" - integrity sha1-9hbtqdPktmuMp/ynn2lXIsX44m8= - dependencies: - precond "0.2" - bail@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d" @@ -8234,13 +8385,6 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= -checkpoint-store@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06" - integrity sha1-BOTLUWuRQziTWB5tRgGnjpVS6gY= - dependencies: - functional-red-black-tree "^1.0.1" - cheerio@^1.0.0-rc.2: version "1.0.0-rc.3" resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6" @@ -8517,7 +8661,7 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clone@^2.0.0, clone@^2.1.1: +clone@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= @@ -9065,14 +9209,6 @@ cross-env@^7.0.3: dependencies: cross-spawn "^7.0.1" -cross-fetch@^2.1.0: - version "2.2.6" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.6.tgz#2ef0bb39a24ac034787965c457368a28730e220a" - integrity sha512-9JZz+vXCmfKUZ68zAptS7k4Nu8e2qcibe7WVZYps7sAgk5R8GYTc+T1WR0v1rlP9HxgARmOX1UTIJZFytajpNA== - dependencies: - node-fetch "^2.6.7" - whatwg-fetch "^2.0.4" - cross-fetch@^3.1.4: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" @@ -9447,13 +9583,6 @@ defer-to-connect@^2.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== -deferred-leveldown@~1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz#3acd2e0b75d1669924bc0a4b642851131173e1eb" - integrity sha512-uukrWD2bguRtXilKt6cAWKyoXrTSMo5m7crUdLfWQmu8kIm88w3QZoUL+6nhpfKVmhHANER6Re3sKoNoZ3IKMA== - dependencies: - abstract-leveldown "~2.6.0" - deferred-leveldown@~5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.0.1.tgz#1642eb18b535dfb2b6ac4d39fb10a9cbcfd13b09" @@ -10760,7 +10889,7 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -eth-block-tracker@4.4.3, eth-block-tracker@^4.4.2: +eth-block-tracker@4.4.3: version "4.4.3" resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-4.4.3.tgz#766a0a0eb4a52c867a28328e9ae21353812cf626" integrity sha512-A8tG4Z4iNg4mw5tP1Vung9N9IjgMNqpiMoJ/FouSFwNCGHv2X0mmOYwtQOJzki6XN7r7Tyo01S29p7b224I4jw== @@ -10772,6 +10901,17 @@ eth-block-tracker@4.4.3, eth-block-tracker@^4.4.2: pify "^3.0.0" safe-event-emitter "^1.0.1" +eth-block-tracker@^7.0.1: + version "7.1.0" + resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-7.1.0.tgz#dfc16085c6817cc30caabba381deb8d204c1c766" + integrity sha512-8YdplnuE1IK4xfqpf4iU7oBxnOYAc35934o083G8ao+8WM8QQtt/mVlAY6yIAdY1eMeLqg4Z//PZjJGmWGPMRg== + dependencies: + "@metamask/eth-json-rpc-provider" "^1.0.0" + "@metamask/safe-event-emitter" "^3.0.0" + "@metamask/utils" "^5.0.1" + json-rpc-random-id "^1.0.1" + pify "^3.0.0" + eth-ens-namehash@2.0.8, eth-ens-namehash@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" @@ -10780,7 +10920,7 @@ eth-ens-namehash@2.0.8, eth-ens-namehash@^2.0.8: idna-uts46-hx "^2.3.1" js-sha3 "^0.5.7" -eth-json-rpc-filters@4.2.2, eth-json-rpc-filters@^4.2.1: +eth-json-rpc-filters@4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== @@ -10792,15 +10932,16 @@ eth-json-rpc-filters@4.2.2, eth-json-rpc-filters@^4.2.1: json-rpc-engine "^6.1.0" pify "^5.0.0" -eth-json-rpc-infura@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/eth-json-rpc-infura/-/eth-json-rpc-infura-5.1.0.tgz#e6da7dc47402ce64c54e7018170d89433c4e8fb6" - integrity sha512-THzLye3PHUSGn1EXMhg6WTLW9uim7LQZKeKaeYsS9+wOBcamRiCQVGHa6D2/4P0oS0vSaxsBnU/J6qvn0MPdow== +eth-json-rpc-filters@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-6.0.1.tgz#0b3e370f017f5c6f58d3e7bd0756d8099ed85c56" + integrity sha512-ITJTvqoCw6OVMLs7pI8f4gG92n/St6x80ACtHodeS+IXmO0w+t1T5OOzfSt7KLSMLRkVUoexV7tztLgDxg+iig== dependencies: - eth-json-rpc-middleware "^6.0.0" - eth-rpc-errors "^3.0.0" - json-rpc-engine "^5.3.0" - node-fetch "^2.6.0" + "@metamask/safe-event-emitter" "^3.0.0" + async-mutex "^0.2.6" + eth-query "^2.1.2" + json-rpc-engine "^6.1.0" + pify "^5.0.0" eth-json-rpc-middleware@^6.0.0: version "6.0.0" @@ -10862,6 +11003,13 @@ eth-rpc-errors@^3.0.0: dependencies: fast-safe-stringify "^2.0.6" +eth-rpc-errors@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" + integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== + dependencies: + fast-safe-stringify "^2.0.6" + eth-sig-util@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" @@ -10877,16 +11025,6 @@ ethereum-bloom-filters@^1.0.6: dependencies: js-sha3 "^0.8.0" -ethereum-common@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.2.0.tgz#13bf966131cce1eeade62a1b434249bb4cb120ca" - integrity sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA== - -ethereum-common@^0.0.18: - version "0.0.18" - resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" - integrity sha1-L9w1dvIykDNYl26znaeDIT/5Uj8= - ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -10918,6 +11056,16 @@ ethereum-cryptography@1.1.2, ethereum-cryptography@^1.0.3, ethereum-cryptography "@scure/bip32" "1.1.0" "@scure/bip39" "1.1.0" +ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz#18fa7108622e56481157a5cb7c01c0c6a672eb67" + integrity sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug== + dependencies: + "@noble/curves" "1.1.0" + "@noble/hashes" "1.3.1" + "@scure/bip32" "1.3.1" + "@scure/bip39" "1.2.1" + ethereum-protocol@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ethereum-protocol/-/ethereum-protocol-1.0.1.tgz#b7d68142f4105e0ae7b5e178cf42f8d4dc4b93cf" @@ -10938,59 +11086,7 @@ ethereumjs-abi@^0.6.8: bn.js "^4.11.8" ethereumjs-util "^6.0.0" -ethereumjs-account@^2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-2.0.5.tgz#eeafc62de544cb07b0ee44b10f572c9c49e00a84" - integrity sha512-bgDojnXGjhMwo6eXQC0bY6UK2liSFUSMwwylOmQvZbSl/D7NXQ3+vrGO46ZeOgjGfxXmgIeVNDIiHw7fNZM4VA== - dependencies: - ethereumjs-util "^5.0.0" - rlp "^2.0.0" - safe-buffer "^5.1.1" - -ethereumjs-block@^1.2.2: - version "1.7.1" - resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz#78b88e6cc56de29a6b4884ee75379b6860333c3f" - integrity sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg== - dependencies: - async "^2.0.1" - ethereum-common "0.2.0" - ethereumjs-tx "^1.2.2" - ethereumjs-util "^5.0.0" - merkle-patricia-tree "^2.1.2" - -ethereumjs-block@~2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.2.2.tgz#c7654be7e22df489fda206139ecd63e2e9c04965" - integrity sha512-2p49ifhek3h2zeg/+da6XpdFR3GlqY3BIEiqxGF8j9aSRIgkb7M1Ky+yULBKJOu8PAZxfhsYA+HxUk2aCQp3vg== - dependencies: - async "^2.0.1" - ethereumjs-common "^1.5.0" - ethereumjs-tx "^2.1.1" - ethereumjs-util "^5.0.0" - merkle-patricia-tree "^2.1.2" - -ethereumjs-common@^1.1.0, ethereumjs-common@^1.5.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.5.2.tgz#2065dbe9214e850f2e955a80e650cb6999066979" - integrity sha512-hTfZjwGX52GS2jcVO6E2sx4YuFnf0Fhp5ylo4pEPhEffNln7vS59Hr5sLnp3/QCazFLluuBZ+FZ6J5HTp0EqCA== - -ethereumjs-tx@^1.2.2: - version "1.3.7" - resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a" - integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA== - dependencies: - ethereum-common "^0.0.18" - ethereumjs-util "^5.0.0" - -ethereumjs-tx@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz#5dfe7688bf177b45c9a23f86cf9104d47ea35fed" - integrity sha512-zZEK1onCeiORb0wyCXUvg94Ve5It/K6GD1K+26KfFKodiBiS6d9lfCXlUKGBBdQ+bv7Day+JK0tj1K+BeNFRAw== - dependencies: - ethereumjs-common "^1.5.0" - ethereumjs-util "^6.0.0" - -ethereumjs-util@^5.0.0, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2, ethereumjs-util@^5.1.5: +ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2: version "5.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== @@ -11027,23 +11123,6 @@ ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.2, ethereum ethereum-cryptography "^0.1.3" 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" - integrity sha512-r/XIUik/ynGbxS3y+mvGnbOKnuLo40V5Mj1J25+HEO63aWYREIqvWeRO/hnROlMBE5WoniQmPmhiaN0ctiHaXw== - dependencies: - async "^2.1.2" - async-eventemitter "^0.2.2" - ethereumjs-account "^2.0.3" - ethereumjs-block "~2.2.0" - ethereumjs-common "^1.1.0" - ethereumjs-util "^6.0.0" - fake-merkle-patricia-tree "^1.0.1" - functional-red-black-tree "^1.0.1" - merkle-patricia-tree "^2.3.2" - rustbn.js "~0.2.0" - safe-buffer "^5.1.1" - ethers@^4.0.32: version "4.0.49" resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.49.tgz#0eb0e9161a0c8b4761be547396bbe2fb121a8894" @@ -11095,6 +11174,40 @@ ethers@^5.0.13, ethers@^5.6.2, ethers@^5.6.9, ethers@^5.7.1: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" +ethjs-format@0.2.7: + version "0.2.7" + resolved "https://registry.yarnpkg.com/ethjs-format/-/ethjs-format-0.2.7.tgz#20c92f31c259a381588d069830d838b489774b86" + integrity sha512-uNYAi+r3/mvR3xYu2AfSXx5teP4ovy9z2FrRsblU+h2logsaIKZPi9V3bn3V7wuRcnG0HZ3QydgZuVaRo06C4Q== + dependencies: + bn.js "4.11.6" + ethjs-schema "0.2.1" + ethjs-util "0.1.3" + is-hex-prefixed "1.0.0" + number-to-bn "1.7.0" + strip-hex-prefix "1.0.0" + +ethjs-query@^0.3.8: + version "0.3.8" + resolved "https://registry.yarnpkg.com/ethjs-query/-/ethjs-query-0.3.8.tgz#aa5af02887bdd5f3c78b3256d0f22ffd5d357490" + integrity sha512-/J5JydqrOzU8O7VBOwZKUWXxHDGr46VqNjBCJgBVNNda+tv7Xc8Y2uJc6aMHHVbeN3YOQ7YRElgIc0q1CI02lQ== + dependencies: + babel-runtime "^6.26.0" + ethjs-format "0.2.7" + ethjs-rpc "0.2.0" + promise-to-callback "^1.0.0" + +ethjs-rpc@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ethjs-rpc/-/ethjs-rpc-0.2.0.tgz#3d0011e32cfff156ed6147818c6fb8f801701b4c" + integrity sha512-RINulkNZTKnj4R/cjYYtYMnFFaBcVALzbtEJEONrrka8IeoarNB9Jbzn+2rT00Cv8y/CxAI+GgY1d0/i2iQeOg== + dependencies: + promise-to-callback "^1.0.0" + +ethjs-schema@0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/ethjs-schema/-/ethjs-schema-0.2.1.tgz#47e138920421453617069034684642e26bb310f4" + integrity sha512-DXd8lwNrhT9sjsh/Vd2Z+4pfyGxhc0POVnLBUfwk5udtdoBzADyq+sK39dcb48+ZU+2VgtwHxtGWnLnCfmfW5g== + ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" @@ -11103,6 +11216,14 @@ ethjs-unit@0.1.6: bn.js "4.11.6" number-to-bn "1.7.0" +ethjs-util@0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.3.tgz#dfd5ea4a400dc5e421a889caf47e081ada78bb55" + integrity sha512-QqpX2dsEG2geSMG9dTMJVhfP1kGRdGMNjiHPiTjkju+X5cB0PQIwUzRr5k21pFkgF5zuLccqe83p7Gh5fFM5tQ== + dependencies: + is-hex-prefixed "1.0.0" + strip-hex-prefix "1.0.0" + ethjs-util@0.1.6, ethjs-util@^0.1.3, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -11357,13 +11478,6 @@ eyes@^0.1.8: resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== -fake-merkle-patricia-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz#4b8c3acfb520afadf9860b1f14cd8ce3402cddd3" - integrity sha1-S4w6z7Ugr635hgsfFM2M40As3dM= - dependencies: - checkpoint-store "^1.1.0" - faker@5.5.3: version "5.5.3" resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e" @@ -15159,11 +15273,6 @@ level-codec@9.0.2, level-codec@^9.0.0: dependencies: buffer "^5.6.0" -level-codec@~7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-7.0.1.tgz#341f22f907ce0f16763f24bddd681e395a0fb8a7" - integrity sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ== - level-concat-iterator@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz#5235b1f744bc34847ed65a50548aa88d22e881cf" @@ -15176,13 +15285,6 @@ level-concat-iterator@~2.0.0: resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263" integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw== -level-errors@^1.0.3, level-errors@~1.0.3: - version "1.0.5" - resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.0.5.tgz#83dbfb12f0b8a2516bdc9a31c4876038e227b859" - integrity sha512-/cLUpQduF6bNrWuAC4pwtUKA5t669pCsCi2XbmojG2tFeOr9j6ShtdDCtFFQO1DRt+EVZhx9gPzP9G2bUaG4ig== - dependencies: - errno "~0.1.1" - level-errors@^2.0.0, level-errors@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8" @@ -15190,16 +15292,6 @@ level-errors@^2.0.0, level-errors@~2.0.0: dependencies: errno "~0.1.1" -level-iterator-stream@~1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz#e43b78b1a8143e6fa97a4f485eb8ea530352f2ed" - integrity sha512-1qua0RHNtr4nrZBgYlpV0qHHeHpcRRWTxEZJ8xsemoHAXNL5tbooh4tPEEqIqsbWCAJBmUmkwYK/sW5OrFjWWw== - dependencies: - inherits "^2.0.1" - level-errors "^1.0.3" - readable-stream "^1.0.33" - xtend "^4.0.0" - level-iterator-stream@~4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c" @@ -15259,14 +15351,6 @@ level-write-stream@1.0.0: dependencies: end-stream "~0.1.0" -level-ws@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-0.0.0.tgz#372e512177924a00424b0b43aef2bb42496d228b" - integrity sha512-XUTaO/+Db51Uiyp/t7fCMGVFOTdtLS/NIACxE/GHsij15mKzxksZifKVjlXDF41JMUP/oM1Oc4YNGdKnc3dVLw== - dependencies: - readable-stream "~1.0.15" - xtend "~2.1.1" - level@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/level/-/level-6.0.1.tgz#dc34c5edb81846a6de5079eac15706334b0d7cd6" @@ -15323,19 +15407,6 @@ levelup@4.4.0, levelup@^4.3.2: level-supports "~1.0.0" xtend "~4.0.0" -levelup@^1.2.1: - version "1.3.9" - resolved "https://registry.yarnpkg.com/levelup/-/levelup-1.3.9.tgz#2dbcae845b2bb2b6bea84df334c475533bbd82ab" - integrity sha512-VVGHfKIlmw8w1XqpGOAGwq6sZm2WwWLmlDcULkKWQXEA5EopA8OBNJ2Ck2v6bdk8HeEZSbCSEgzXadyQFm76sQ== - dependencies: - deferred-leveldown "~1.2.1" - level-codec "~7.0.0" - level-errors "~1.0.3" - level-iterator-stream "~1.3.0" - prr "~1.0.1" - semver "~5.4.1" - xtend "~4.0.0" - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -15891,7 +15962,7 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" -memdown@1.2.4, memdown@^1.0.0: +memdown@1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/memdown/-/memdown-1.2.4.tgz#cd9a34aaf074d53445a271108eb4b8dd4ec0f27f" integrity sha512-tRPbP91kBQkzRBa1iNzMubbl/e+5/iwM+/y12nrIo5FDB/eMWgWtA4F9njNrNn8Y+tfJRaZXfA2SrO+YVfyAZg== @@ -16002,25 +16073,16 @@ merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz#982ca1b5a0fde00eed2f6aeed1f9152860b8208a" - integrity sha512-81PW5m8oz/pz3GvsAwbauj7Y00rqm81Tzad77tHBwU7pIAtN+TJnMSOJhxBKflSVYhptMMb9RskhqHqrSm1V+g== - dependencies: - async "^1.4.2" - ethereumjs-util "^5.0.0" - level-ws "0.0.0" - levelup "^1.2.1" - memdown "^1.0.0" - readable-stream "^2.0.0" - rlp "^2.0.0" - semaphore ">=1.0.1" - methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= +micro-ftch@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" + integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== + micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -16653,7 +16715,7 @@ node-emoji@^1.8.1: dependencies: lodash.toarray "^4.4.0" -node-fetch@2, node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.1.1, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: +node-fetch@2, node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.1.1, node-fetch@^2.6.1, node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== @@ -16752,6 +16814,14 @@ noms@0.0.0: inherits "^2.0.1" readable-stream "~1.0.31" +nonce-tracker@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/nonce-tracker/-/nonce-tracker-1.2.0.tgz#3e859da481ed824dbe3f7d74fd114264d8804023" + integrity sha512-K7YxuoVVoAYDn0TYDe3AXqndAC6rxXS4sBDajfDP+GcXH5ZHDRCgVoVKJCK8r3a3qcnE0XLqiMhBRC4iz1kVIQ== + dependencies: + async-mutex "^0.3.1" + ethjs-query "^0.3.8" + nopt@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" @@ -17138,11 +17208,6 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object-keys@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" - integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= - object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" @@ -18305,11 +18370,6 @@ precinct@^9.0.0: module-definition "^4.1.0" node-source-walk "^5.0.1" -precond@0.2: - version "0.2.3" - resolved "https://registry.yarnpkg.com/precond/-/precond-0.2.3.tgz#aa9591bcaa24923f1e0f4849d240f47efc1075ac" - integrity sha1-qpWRvKokkj8eD0hJ0kD0fvwQdaw= - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -18944,7 +19004,7 @@ read@1, read@^1.0.7: dependencies: mute-stream "~0.0.4" -readable-stream@1.0.33, readable-stream@^1.0.33, readable-stream@~1.0.15, readable-stream@~1.0.31: +readable-stream@1.0.33, readable-stream@~1.0.31: version "1.0.33" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.33.tgz#3a360dd66c1b1d7fd4705389860eda1d0f61126c" integrity sha1-OjYN1mwbHX/UcFOJhg7aHQ9hEmw= @@ -18973,7 +19033,7 @@ readable-stream@1.1.14: string_decoder "^1.1.1" util-deprecate "^1.0.1" -readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.6, readable-stream@^2.2.9, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@~2.3.6: +readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.6, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -19214,7 +19274,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@^2.79.0, request@^2.85.0, request@^2.88.2: +request@^2.79.0, request@^2.88.2: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -19578,6 +19638,11 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-stable-stringify@^2.3.2: + version "2.4.3" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" + integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== + "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -19700,11 +19765,6 @@ selfsigned@^2.1.1: dependencies: node-forge "^1" -semaphore@>=1.0.1, semaphore@^1.0.3: - version "1.1.0" - resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa" - integrity sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA== - semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" @@ -19734,11 +19794,6 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@~5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - integrity sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg== - send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -20761,6 +20816,11 @@ superstruct@^0.14.2: resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.14.2.tgz#0dbcdf3d83676588828f1cf5ed35cda02f59025b" integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ== +superstruct@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" + integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== + supports-color@8.1.1, supports-color@^8.0.0, supports-color@^8.1.0: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" @@ -21277,7 +21337,7 @@ tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0: +tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -22229,34 +22289,6 @@ web3-net@1.10.0: web3-core-method "1.10.0" web3-utils "1.10.0" -web3-provider-engine@16.0.3: - version "16.0.3" - resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-16.0.3.tgz#8ff93edf3a8da2f70d7f85c5116028c06a0d9f07" - integrity sha512-Q3bKhGqLfMTdLvkd4TtkGYJHcoVQ82D1l8jTIwwuJp/sAp7VHnRYb9YJ14SW/69VMWoOhSpPLZV2tWb9V0WJoA== - dependencies: - "@ethereumjs/tx" "^3.3.0" - async "^2.5.0" - backoff "^2.5.0" - clone "^2.0.0" - cross-fetch "^2.1.0" - eth-block-tracker "^4.4.2" - eth-json-rpc-filters "^4.2.1" - eth-json-rpc-infura "^5.1.0" - eth-json-rpc-middleware "^6.0.0" - eth-rpc-errors "^3.0.0" - eth-sig-util "^1.4.2" - ethereumjs-block "^1.2.2" - ethereumjs-util "^5.1.5" - ethereumjs-vm "^2.3.4" - json-stable-stringify "^1.0.1" - promise-to-callback "^1.0.0" - readable-stream "^2.2.9" - request "^2.85.0" - semaphore "^1.0.3" - ws "^5.1.1" - xhr "^2.2.0" - xtend "^4.0.1" - web3-providers-http@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.10.0.tgz#864fa48675e7918c9a4374e5f664b32c09d0151b" @@ -22492,11 +22524,6 @@ websocket@^1.0.32: utf-8-validate "^5.0.2" yaeti "^0.0.6" -whatwg-fetch@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== - whatwg-mimetype@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" @@ -22783,13 +22810,6 @@ ws@^3.0.0: safe-buffer "~5.1.0" ultron "~1.1.0" -ws@^5.1.1: - version "5.2.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.3.tgz#05541053414921bc29c63bee14b8b0dd50b07b3d" - integrity sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA== - dependencies: - async-limiter "~1.0.0" - xhr-request-promise@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz#343c44d1ee7726b8648069682d0f840c83b4261d" @@ -22810,7 +22830,7 @@ xhr-request@^1.0.1: url-set-query "^1.0.0" xhr "^2.0.4" -xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3: +xhr@^2.0.4, xhr@^2.3.3: version "2.5.0" resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.5.0.tgz#bed8d1676d5ca36108667692b74b316c496e49dd" integrity sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ== @@ -22845,13 +22865,6 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -xtend@~2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" - integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= - dependencies: - object-keys "~0.4.0" - y18n@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" From a71eb7ba25b1ca761b232e085e20fbcebb59d02d Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 02:02:43 +0000 Subject: [PATCH 2/8] WIP: replace & upgrade deps in hdwallet-providers --- packages/hdwallet-provider/package.json | 7 +++--- packages/hdwallet-provider/src/index.ts | 33 ++++++++++++++----------- yarn.lock | 7 +----- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/packages/hdwallet-provider/package.json b/packages/hdwallet-provider/package.json index 6a22b4746b0..c87c8abfcff 100644 --- a/packages/hdwallet-provider/package.json +++ b/packages/hdwallet-provider/package.json @@ -29,18 +29,17 @@ "@metamask/json-rpc-engine": "^7.1.1", "@metamask/utils": "^8.1.0", "@truffle/hdwallet": "^0.1.4", - "@types/ethereum-protocol": "^1.0.0", - "@types/web3": "1.0.20", + "eth-json-rpc-filters": "^6.0.1", "ethereum-cryptography": "1.1.2", - "ethereum-protocol": "^1.0.1", "ethereumjs-util": "^7.1.5", "nonce-tracker": "^1.1.0" }, "devDependencies": { "@types/bip39": "^2.4.2", + "@types/ethereum-protocol": "^1.0.0", "@types/ethereumjs-util": "^5.2.0", "@types/mocha": "^5.2.7", - "eth-json-rpc-filters": "^6.0.0", + "@types/web3": "1.0.20", "ganache": "7.9.1", "mocha": "10.1.0", "ts-node": "10.7.0", diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index fc21ff1fd6a..efa5e9fd41f 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -7,13 +7,14 @@ import * as EthUtil from "ethereumjs-util"; import { Transaction, FeeMarketEIP1559Transaction } from "@ethereumjs/tx"; import Common from "@ethereumjs/common"; -import ProviderEngine from "@metamask/json-rpc-engine"; -// @ts-ignore - web3-provider-engine doesn't have declaration files for these subproviders -import FiltersSubprovider from "web3-provider-engine/subproviders/filters"; +import { JsonRpcEngine } from "@metamask/json-rpc-engine"; +import { providerFromEngine, providerFromMiddleware } from "@metamask/eth-json-rpc-provider"; + +import { createFilterMiddleware } from "eth-json-rpc-filters"; +const filterMiddleware = createFilterMiddleware( // @ts-ignore import NonceSubProvider from "web3-provider-engine/subproviders/nonce-tracker"; -// @ts-ignore -import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; +//import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; // @ts-ignore import ProviderSubprovider from "web3-provider-engine/subproviders/provider"; // @ts-ignore @@ -23,9 +24,10 @@ import WebsocketProvider from "web3-provider-engine/subproviders/websocket"; import Url from "url"; import type { - JSONRPCRequestPayload, - JSONRPCResponsePayload -} from "ethereum-protocol"; + JsonRpcParams, + JsonRpcRequest, + JsonRpcResponse +} from "@metamask/utils"; import type { ConstructorArguments } from "./constructor/ConstructorArguments"; import { getOptions } from "./constructor/getOptions"; import { getPrivateKeys } from "./constructor/getPrivateKeys"; @@ -55,7 +57,7 @@ class HDWalletProvider { private hardfork: Hardfork; private initialized: Promise; - public engine: ProviderEngine; + public engine: JsonRpcEngine; constructor(...args: ConstructorArguments) { const { @@ -66,7 +68,8 @@ class HDWalletProvider { numberOfAddresses = 10, shareNonce = true, derivationPath = `m/44'/60'/0'/0/`, - pollingInterval = 4000, + // TODO: Unused/ deprecated...? + // pollingInterval = 4000, chainId, chainSettings = {}, @@ -81,8 +84,8 @@ class HDWalletProvider { this.#wallets = {}; this.#addresses = []; this.chainSettings = chainSettings; - this.engine = new ProviderEngine({ - pollingInterval + this.engine = new JsonRpcEngine({ + // pollingInterval }); let providerToUse; @@ -288,7 +291,7 @@ class HDWalletProvider { }, // @ts-ignore - the type doesn't take into account the possibility // that response.error could be a thing - (error: any, response: JSONRPCResponsePayload & { error?: any }) => { + (error: any, response: JsonRpcResponse & { error?: any }) => { if (error) { reject(error); return; @@ -364,7 +367,7 @@ class HDWalletProvider { public send( payload: JSONRPCRequestPayload, // @ts-ignore we patch this method so it doesn't conform to type - callback: (error: null | Error, response: JSONRPCResponsePayload) => void + callback: (error: null | Error, response: JsonRpcResponse) => void ): void { this.initialized.then(() => { this.engine.sendAsync(payload, callback); @@ -373,7 +376,7 @@ class HDWalletProvider { public sendAsync( payload: JSONRPCRequestPayload, - callback: (error: null | Error, response: JSONRPCResponsePayload) => void + callback: (error: null | Error, response: JsonRpcResponse) => void ): void { this.initialized.then(() => { this.engine.sendAsync(payload, callback); diff --git a/yarn.lock b/yarn.lock index 1f789ea3841..33c2cc35476 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10932,7 +10932,7 @@ eth-json-rpc-filters@4.2.2: json-rpc-engine "^6.1.0" pify "^5.0.0" -eth-json-rpc-filters@^6.0.0: +eth-json-rpc-filters@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-6.0.1.tgz#0b3e370f017f5c6f58d3e7bd0756d8099ed85c56" integrity sha512-ITJTvqoCw6OVMLs7pI8f4gG92n/St6x80ACtHodeS+IXmO0w+t1T5OOzfSt7KLSMLRkVUoexV7tztLgDxg+iig== @@ -11066,11 +11066,6 @@ ethereum-cryptography@^2.0.0, ethereum-cryptography@^2.1.2: "@scure/bip32" "1.3.1" "@scure/bip39" "1.2.1" -ethereum-protocol@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ethereum-protocol/-/ethereum-protocol-1.0.1.tgz#b7d68142f4105e0ae7b5e178cf42f8d4dc4b93cf" - integrity sha512-3KLX1mHuEsBW0dKG+c6EOJS1NBNqdCICvZW9sInmZTt5aY0oxmHVggYRE0lJu1tcnMD1K+AKHdLi6U43Awm1Vg== - ethereumjs-abi@^0.6.8: version "0.6.8" resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae" From 8636ad7574de238235d35e5807a7f2bc9453ce4b Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 03:24:26 +0000 Subject: [PATCH 3/8] wip --- packages/hdwallet-provider/package.json | 3 +- packages/hdwallet-provider/src/index.ts | 148 ++++++++++++++++-------- yarn.lock | 83 +++---------- 3 files changed, 119 insertions(+), 115 deletions(-) diff --git a/packages/hdwallet-provider/package.json b/packages/hdwallet-provider/package.json index c87c8abfcff..f55138243f8 100644 --- a/packages/hdwallet-provider/package.json +++ b/packages/hdwallet-provider/package.json @@ -29,10 +29,11 @@ "@metamask/json-rpc-engine": "^7.1.1", "@metamask/utils": "^8.1.0", "@truffle/hdwallet": "^0.1.4", + "eth-block-tracker": "^8.1.0", "eth-json-rpc-filters": "^6.0.1", "ethereum-cryptography": "1.1.2", "ethereumjs-util": "^7.1.5", - "nonce-tracker": "^1.1.0" + "nonce-tracker": "^2.0.0" }, "devDependencies": { "@types/bip39": "^2.4.2", diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index efa5e9fd41f..60fd0f3b774 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -7,13 +7,15 @@ import * as EthUtil from "ethereumjs-util"; import { Transaction, FeeMarketEIP1559Transaction } from "@ethereumjs/tx"; import Common from "@ethereumjs/common"; +import { PollingBlockTracker } from 'eth-block-tracker'; import { JsonRpcEngine } from "@metamask/json-rpc-engine"; -import { providerFromEngine, providerFromMiddleware } from "@metamask/eth-json-rpc-provider"; +//import type { JsonRpcMiddleware } from "@metamask/json-rpc-engine"; +import { SafeEventEmitterProvider, providerFromEngine } from "@metamask/eth-json-rpc-provider"; -import { createFilterMiddleware } from "eth-json-rpc-filters"; -const filterMiddleware = createFilterMiddleware( // @ts-ignore -import NonceSubProvider from "web3-provider-engine/subproviders/nonce-tracker"; +import createFilterMiddleware from "eth-json-rpc-filters"; +// @ts-ignore +import NonceSubProvider from "nonce-tracker"; //import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; // @ts-ignore import ProviderSubprovider from "web3-provider-engine/subproviders/provider"; @@ -32,7 +34,7 @@ import type { ConstructorArguments } from "./constructor/ConstructorArguments"; import { getOptions } from "./constructor/getOptions"; import { getPrivateKeys } from "./constructor/getPrivateKeys"; import { getMnemonic } from "./constructor/getMnemonic"; -import type { ChainId, ChainSettings, Hardfork } from "./constructor/types"; +import type { ChainId, ChainSettings, Hardfork, ProviderOrUrl } from "./constructor/types"; import { signTypedData, SignTypedDataVersion } from "@metamask/eth-sig-util"; import { createAccountGeneratorFromSeedAndPath, @@ -46,19 +48,34 @@ import { // function, resetting nonce from tx to tx. An instance can opt out // of this behavior by passing `shareNonce=false` to the constructor. // See issue #65 for more -const singletonNonceSubProvider = new NonceSubProvider(); +let singletonNonceSubProvider: null | NonceSubProvider; + +// TODO: Constrain type +type JsonRpcProvider = Record; + +const getSingletonNonceSubProvider = (opts: {rpcProvider: JsonRpcProvider, blockTracker: any}): NonceSubProvider => { + if (singletonNonceSubProvider) { + } else { + singletonNonceSubProvider = new NonceSubProvider({ + provider: opts.rpcProvider, + blockTracker: opts.blockTracker, + getPendingTransactions: (_address: string) => [], + getConfirmedTransactions: (_address: string) => [], + }); + } + return singletonNonceSubProvider; +} class HDWalletProvider { private walletHdpath: string; #wallets: { [address: string]: Buffer }; #addresses: string[]; + #provider: SafeEventEmitterProvider; private chainId?: ChainId; private chainSettings: ChainSettings; private hardfork: Hardfork; private initialized: Promise; - public engine: JsonRpcEngine; - constructor(...args: ConstructorArguments) { const { provider, @@ -84,16 +101,26 @@ class HDWalletProvider { this.#wallets = {}; this.#addresses = []; this.chainSettings = chainSettings; - this.engine = new JsonRpcEngine({ + const engine = new JsonRpcEngine({ // pollingInterval }); - let providerToUse; - if (HDWalletProvider.isValidProvider(provider)) { + let providerToUse: ProviderOrUrl; + if (typeof provider !== 'undefined' && HDWalletProvider.isValidProvider(provider)) { providerToUse = provider; - } else if (HDWalletProvider.isValidProvider(url)) { + } else if (typeof url !== 'undefined' && HDWalletProvider.isValidProvider(url)) { providerToUse = url; } else { + if (typeof providerOrUrl === 'undefined') { + throw new Error( + [ + `No provider or an invalid provider was specified.`, + "Please specify a valid provider or URL, using the http, https, " + + "ws, or wss protocol.", + "" + ].join("\n") + ); + } providerToUse = providerOrUrl; } @@ -149,7 +176,7 @@ class HDWalletProvider { const self = this; - this.engine.addProvider( + engine.push( new HookedSubprovider({ getAccounts(cb: any) { cb(null, tmpAccounts); @@ -252,54 +279,78 @@ class HDWalletProvider { }) ); - !shareNonce - ? this.engine.addProvider(new NonceSubProvider()) - : this.engine.addProvider(singletonNonceSubProvider); - - this.engine.addProvider(new FiltersSubprovider()); - if (typeof providerToUse === "string") { - const url = providerToUse; - - const providerProtocol = ( - Url.parse(url).protocol || "http:" - ).toLowerCase(); - - switch (providerProtocol) { - case "ws:": - case "wss:": - this.engine.addProvider(new WebsocketProvider({ rpcUrl: url })); - break; - default: - this.engine.addProvider(new RpcProvider({ rpcUrl: url })); + const createProvider = () => { + if (typeof providerToUse === "string") { + const url = providerToUse; + + const providerProtocol = ( + Url.parse(url).protocol || "http:" + ).toLowerCase(); + + switch (providerProtocol) { + case "ws:": + case "wss:": + return new WebsocketProvider({ rpcUrl: url }); + default: + return new RpcProvider({ rpcUrl: url }); + } + } else { + return new ProviderSubprovider(providerToUse); } - } else { - this.engine.addProvider(new ProviderSubprovider(providerToUse)); } + const rpcProvider = createProvider(); + + const blockTracker = new PollingBlockTracker({ + provider: rpcProvider, + // pollingInterval?: number; + // retryTimeout?: number; + // keepEventLoopActive?: boolean; + // setSkipCacheFlag?: boolean; + // blockResetDuration?: number; + // usePastBlocks?: boolean; + }); + + const nonceSubProvider = shareNonce + ? getSingletonNonceSubProvider({ + blockTracker, + rpcProvider, + }) + : new NonceSubProvider({ + blockTracker, + provider: rpcProvider, + getPendingTransactions: (_address: string) => [], + getConfirmedTransactions: (_address: string) => [], + }); + + const filtersSubProvider = createFilterMiddleware({ + blockTracker, + provider: rpcProvider, + }); + engine.push(nonceSubProvider as any); + engine.push(filtersSubProvider); + engine.push(rpcProvider); - // Required by the provider engine. - this.engine.start(); + this.#provider = providerFromEngine(engine); } private initialize(): Promise { return new Promise((resolve, reject) => { - this.engine.sendAsync( + this.#provider.sendAsync( { jsonrpc: "2.0", id: Date.now(), method: "eth_chainId", params: [] }, - // @ts-ignore - the type doesn't take into account the possibility - // that response.error could be a thing - (error: any, response: JsonRpcResponse & { error?: any }) => { + (error: any, response: JsonRpcResponse) => { if (error) { reject(error); return; - } else if (response.error) { + } else if ('error' in response) { reject(response.error); return; } - if (isNaN(parseInt(response.result, 16))) { + if ('result' in response && isNaN(parseInt(response.result, 16))) { const message = "When requesting the chain id from the node, it" + `returned the malformed result ${response.result}.`; @@ -365,21 +416,22 @@ class HDWalletProvider { } public send( - payload: JSONRPCRequestPayload, - // @ts-ignore we patch this method so it doesn't conform to type + payload: JsonRpcRequest, callback: (error: null | Error, response: JsonRpcResponse) => void ): void { this.initialized.then(() => { - this.engine.sendAsync(payload, callback); + // @ts-ignore we patch callback method so it doesn't conform to type + this.#provider.sendAsync(payload, callback); }); } public sendAsync( - payload: JSONRPCRequestPayload, - callback: (error: null | Error, response: JsonRpcResponse) => void + payload: JsonRpcRequest, + callback: (error: null | Error, response?: JsonRpcResponse) => void ): void { this.initialized.then(() => { - this.engine.sendAsync(payload, callback); + // @ts-ignore we patch callback method so it doesn't conform to type + this.#provider.sendAsync(payload, callback); }); } diff --git a/yarn.lock b/yarn.lock index 33c2cc35476..e4c7841d87f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3352,7 +3352,7 @@ "@metamask/safe-event-emitter" "^3.0.0" "@metamask/utils" "^5.0.1" -"@metamask/eth-json-rpc-provider@^2.0.0": +"@metamask/eth-json-rpc-provider@^2.0.0", "@metamask/eth-json-rpc-provider@^2.1.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-provider/-/eth-json-rpc-provider-2.2.0.tgz#7d7551ff075a42992cd7fd4054868f6a5f9ee541" integrity sha512-pJk533YEEH/GbZMHoV4CEDQhH2/HeG/2M3JhNnhblcAMIYKaLDkl/+01hc0mDAgYs4vxf8FBkniBUlX5o7FLSQ== @@ -10912,6 +10912,17 @@ eth-block-tracker@^7.0.1: json-rpc-random-id "^1.0.1" pify "^3.0.0" +eth-block-tracker@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-8.1.0.tgz#6ca4f6b955ff3e114f5aa0e8d36b11196ad1ea92" + integrity sha512-cdP9GMtJV87d4yuj4A3WX7gHIoJP4T4eeGgVW1jLjC/H7xuJsjs9vtwy9DJZvcd2cpRYZNQ7eWsdoJriHfi67Q== + dependencies: + "@metamask/eth-json-rpc-provider" "^2.1.0" + "@metamask/safe-event-emitter" "^3.0.0" + "@metamask/utils" "^8.1.0" + json-rpc-random-id "^1.0.1" + pify "^5.0.0" + eth-ens-namehash@2.0.8, eth-ens-namehash@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz#229ac46eca86d52e0c991e7cb2aef83ff0f68bcf" @@ -11169,40 +11180,6 @@ ethers@^5.0.13, ethers@^5.6.2, ethers@^5.6.9, ethers@^5.7.1: "@ethersproject/web" "5.7.1" "@ethersproject/wordlists" "5.7.0" -ethjs-format@0.2.7: - version "0.2.7" - resolved "https://registry.yarnpkg.com/ethjs-format/-/ethjs-format-0.2.7.tgz#20c92f31c259a381588d069830d838b489774b86" - integrity sha512-uNYAi+r3/mvR3xYu2AfSXx5teP4ovy9z2FrRsblU+h2logsaIKZPi9V3bn3V7wuRcnG0HZ3QydgZuVaRo06C4Q== - dependencies: - bn.js "4.11.6" - ethjs-schema "0.2.1" - ethjs-util "0.1.3" - is-hex-prefixed "1.0.0" - number-to-bn "1.7.0" - strip-hex-prefix "1.0.0" - -ethjs-query@^0.3.8: - version "0.3.8" - resolved "https://registry.yarnpkg.com/ethjs-query/-/ethjs-query-0.3.8.tgz#aa5af02887bdd5f3c78b3256d0f22ffd5d357490" - integrity sha512-/J5JydqrOzU8O7VBOwZKUWXxHDGr46VqNjBCJgBVNNda+tv7Xc8Y2uJc6aMHHVbeN3YOQ7YRElgIc0q1CI02lQ== - dependencies: - babel-runtime "^6.26.0" - ethjs-format "0.2.7" - ethjs-rpc "0.2.0" - promise-to-callback "^1.0.0" - -ethjs-rpc@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/ethjs-rpc/-/ethjs-rpc-0.2.0.tgz#3d0011e32cfff156ed6147818c6fb8f801701b4c" - integrity sha512-RINulkNZTKnj4R/cjYYtYMnFFaBcVALzbtEJEONrrka8IeoarNB9Jbzn+2rT00Cv8y/CxAI+GgY1d0/i2iQeOg== - dependencies: - promise-to-callback "^1.0.0" - -ethjs-schema@0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/ethjs-schema/-/ethjs-schema-0.2.1.tgz#47e138920421453617069034684642e26bb310f4" - integrity sha512-DXd8lwNrhT9sjsh/Vd2Z+4pfyGxhc0POVnLBUfwk5udtdoBzADyq+sK39dcb48+ZU+2VgtwHxtGWnLnCfmfW5g== - ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" @@ -11211,14 +11188,6 @@ ethjs-unit@0.1.6: bn.js "4.11.6" number-to-bn "1.7.0" -ethjs-util@0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.3.tgz#dfd5ea4a400dc5e421a889caf47e081ada78bb55" - integrity sha512-QqpX2dsEG2geSMG9dTMJVhfP1kGRdGMNjiHPiTjkju+X5cB0PQIwUzRr5k21pFkgF5zuLccqe83p7Gh5fFM5tQ== - dependencies: - is-hex-prefixed "1.0.0" - strip-hex-prefix "1.0.0" - ethjs-util@0.1.6, ethjs-util@^0.1.3, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -13680,11 +13649,6 @@ is-finite@^1.0.0: dependencies: number-is-nan "^1.0.0" -is-fn@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fn/-/is-fn-1.0.0.tgz#9543d5de7bcf5b08a22ec8a20bae6e286d510d8c" - integrity sha1-lUPV3nvPWwiiLsiiC65uKG1RDYw= - is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -16809,13 +16773,13 @@ noms@0.0.0: inherits "^2.0.1" readable-stream "~1.0.31" -nonce-tracker@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/nonce-tracker/-/nonce-tracker-1.2.0.tgz#3e859da481ed824dbe3f7d74fd114264d8804023" - integrity sha512-K7YxuoVVoAYDn0TYDe3AXqndAC6rxXS4sBDajfDP+GcXH5ZHDRCgVoVKJCK8r3a3qcnE0XLqiMhBRC4iz1kVIQ== +nonce-tracker@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/nonce-tracker/-/nonce-tracker-2.0.0.tgz#bc8ea185f9a5fcb3c96d7560d27378d3c779ffb8" + integrity sha512-0JlFAI22XKNOfqTBlNB/nxHl8md/j7ozZMlpiadyrcyN0a5lzkDiS6u0dML2gTDiDX/HCuC1+nr2od3RnlNVdA== dependencies: + "@ethersproject/providers" "^5.7.2" async-mutex "^0.3.1" - ethjs-query "^0.3.8" nopt@^5.0.0: version "5.0.0" @@ -18533,14 +18497,6 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" -promise-to-callback@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/promise-to-callback/-/promise-to-callback-1.0.0.tgz#5d2a749010bfb67d963598fcd3960746a68feef7" - integrity sha1-XSp0kBC/tn2WNZj805YHRqaP7vc= - dependencies: - is-fn "^1.0.0" - set-immediate-shim "^1.0.1" - promise.any@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/promise.any/-/promise.any-2.0.3.tgz#04153d59391b57307299718e5098177fba6f56b7" @@ -19876,11 +19832,6 @@ set-blocking@^2.0.0, set-blocking@~2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-immediate-shim@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" - integrity sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E= - set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" From a5decdbacc104ea86b2529ce968f684f873ca6b7 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 03:28:38 +0000 Subject: [PATCH 4/8] tsconfig(hdwallet-provider) add dom to lib for nonce-tracker usage of VoidFunction --- packages/hdwallet-provider/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hdwallet-provider/tsconfig.json b/packages/hdwallet-provider/tsconfig.json index 93b3a02628e..06034ac1e85 100644 --- a/packages/hdwallet-provider/tsconfig.json +++ b/packages/hdwallet-provider/tsconfig.json @@ -8,7 +8,8 @@ "esModuleInterop": true, "strict": true, "lib": [ - "es2019" + "es2019", + "dom" ], "outDir": "dist", "baseUrl": ".", From f7fb5f1dbdb3e0a97a3c6c4f08614404adf1b8b8 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 03:39:37 +0000 Subject: [PATCH 5/8] add back web3-provider-engine for HookedWalletProvider --- packages/hdwallet-provider/package.json | 3 +- packages/hdwallet-provider/src/index.ts | 80 ++-- yarn.lock | 462 +++++++++++++++++++++++- 3 files changed, 509 insertions(+), 36 deletions(-) diff --git a/packages/hdwallet-provider/package.json b/packages/hdwallet-provider/package.json index f55138243f8..b91cf88bfdd 100644 --- a/packages/hdwallet-provider/package.json +++ b/packages/hdwallet-provider/package.json @@ -33,7 +33,8 @@ "eth-json-rpc-filters": "^6.0.1", "ethereum-cryptography": "1.1.2", "ethereumjs-util": "^7.1.5", - "nonce-tracker": "^2.0.0" + "nonce-tracker": "^2.0.0", + "web3-provider-engine": "^16.0.6" }, "devDependencies": { "@types/bip39": "^2.4.2", diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index 60fd0f3b774..57ffb93475b 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -7,16 +7,20 @@ import * as EthUtil from "ethereumjs-util"; import { Transaction, FeeMarketEIP1559Transaction } from "@ethereumjs/tx"; import Common from "@ethereumjs/common"; -import { PollingBlockTracker } from 'eth-block-tracker'; +import { PollingBlockTracker } from "eth-block-tracker"; import { JsonRpcEngine } from "@metamask/json-rpc-engine"; //import type { JsonRpcMiddleware } from "@metamask/json-rpc-engine"; -import { SafeEventEmitterProvider, providerFromEngine } from "@metamask/eth-json-rpc-provider"; +import { + SafeEventEmitterProvider, + providerFromEngine +} from "@metamask/eth-json-rpc-provider"; // @ts-ignore import createFilterMiddleware from "eth-json-rpc-filters"; // @ts-ignore import NonceSubProvider from "nonce-tracker"; -//import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; +// @ts-ignore +import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; // @ts-ignore import ProviderSubprovider from "web3-provider-engine/subproviders/provider"; // @ts-ignore @@ -34,7 +38,12 @@ import type { ConstructorArguments } from "./constructor/ConstructorArguments"; import { getOptions } from "./constructor/getOptions"; import { getPrivateKeys } from "./constructor/getPrivateKeys"; import { getMnemonic } from "./constructor/getMnemonic"; -import type { ChainId, ChainSettings, Hardfork, ProviderOrUrl } from "./constructor/types"; +import type { + ChainId, + ChainSettings, + Hardfork, + ProviderOrUrl +} from "./constructor/types"; import { signTypedData, SignTypedDataVersion } from "@metamask/eth-sig-util"; import { createAccountGeneratorFromSeedAndPath, @@ -53,18 +62,21 @@ let singletonNonceSubProvider: null | NonceSubProvider; // TODO: Constrain type type JsonRpcProvider = Record; -const getSingletonNonceSubProvider = (opts: {rpcProvider: JsonRpcProvider, blockTracker: any}): NonceSubProvider => { +const getSingletonNonceSubProvider = (opts: { + rpcProvider: JsonRpcProvider; + blockTracker: any; +}): NonceSubProvider => { if (singletonNonceSubProvider) { } else { singletonNonceSubProvider = new NonceSubProvider({ - provider: opts.rpcProvider, - blockTracker: opts.blockTracker, - getPendingTransactions: (_address: string) => [], - getConfirmedTransactions: (_address: string) => [], + provider: opts.rpcProvider, + blockTracker: opts.blockTracker, + getPendingTransactions: (_address: string) => [], + getConfirmedTransactions: (_address: string) => [] }); } return singletonNonceSubProvider; -} +}; class HDWalletProvider { private walletHdpath: string; @@ -106,12 +118,18 @@ class HDWalletProvider { }); let providerToUse: ProviderOrUrl; - if (typeof provider !== 'undefined' && HDWalletProvider.isValidProvider(provider)) { + if ( + typeof provider !== "undefined" && + HDWalletProvider.isValidProvider(provider) + ) { providerToUse = provider; - } else if (typeof url !== 'undefined' && HDWalletProvider.isValidProvider(url)) { + } else if ( + typeof url !== "undefined" && + HDWalletProvider.isValidProvider(url) + ) { providerToUse = url; } else { - if (typeof providerOrUrl === 'undefined') { + if (typeof providerOrUrl === "undefined") { throw new Error( [ `No provider or an invalid provider was specified.`, @@ -297,11 +315,11 @@ class HDWalletProvider { } else { return new ProviderSubprovider(providerToUse); } - } + }; const rpcProvider = createProvider(); const blockTracker = new PollingBlockTracker({ - provider: rpcProvider, + provider: rpcProvider // pollingInterval?: number; // retryTimeout?: number; // keepEventLoopActive?: boolean; @@ -312,19 +330,19 @@ class HDWalletProvider { const nonceSubProvider = shareNonce ? getSingletonNonceSubProvider({ - blockTracker, - rpcProvider, - }) + blockTracker, + rpcProvider + }) : new NonceSubProvider({ - blockTracker, - provider: rpcProvider, - getPendingTransactions: (_address: string) => [], - getConfirmedTransactions: (_address: string) => [], - }); + blockTracker, + provider: rpcProvider, + getPendingTransactions: (_address: string) => [], + getConfirmedTransactions: (_address: string) => [] + }); const filtersSubProvider = createFilterMiddleware({ blockTracker, - provider: rpcProvider, + provider: rpcProvider }); engine.push(nonceSubProvider as any); engine.push(filtersSubProvider); @@ -346,11 +364,11 @@ class HDWalletProvider { if (error) { reject(error); return; - } else if ('error' in response) { + } else if ("error" in response) { reject(response.error); return; } - if ('result' in response && isNaN(parseInt(response.result, 16))) { + if ("result" in response && isNaN(parseInt(response.result, 16))) { const message = "When requesting the chain id from the node, it" + `returned the malformed result ${response.result}.`; @@ -417,7 +435,10 @@ class HDWalletProvider { public send( payload: JsonRpcRequest, - callback: (error: null | Error, response: JsonRpcResponse) => void + callback: ( + error: null | Error, + response: JsonRpcResponse + ) => void ): void { this.initialized.then(() => { // @ts-ignore we patch callback method so it doesn't conform to type @@ -427,7 +448,10 @@ class HDWalletProvider { public sendAsync( payload: JsonRpcRequest, - callback: (error: null | Error, response?: JsonRpcResponse) => void + callback: ( + error: null | Error, + response?: JsonRpcResponse + ) => void ): void { this.initialized.then(() => { // @ts-ignore we patch callback method so it doesn't conform to type diff --git a/yarn.lock b/yarn.lock index e4c7841d87f..57a2c0d48a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1344,6 +1344,30 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@cypress/request@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.1.tgz#72d7d5425236a2413bd3d8bb66d02d9dc3168960" + integrity sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + http-signature "~1.3.6" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + performance-now "^2.1.0" + qs "6.10.4" + safe-buffer "^5.1.2" + tough-cookie "^4.1.3" + tunnel-agent "^0.6.0" + uuid "^8.3.2" + "@dependents/detective-less@^3.0.1": version "3.0.2" resolved "https://registry.yarnpkg.com/@dependents/detective-less/-/detective-less-3.0.2.tgz#c6e46997010fe03a5dc98351a7e99a46d34f5832" @@ -6110,6 +6134,20 @@ abstract-leveldown@^6.2.1, abstract-leveldown@~6.2.1, abstract-leveldown@~6.2.3: level-supports "~1.0.0" xtend "~4.0.0" +abstract-leveldown@~2.6.0: + version "2.6.3" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz#1c5e8c6a5ef965ae8c35dfb3a8770c476b82c4b8" + integrity sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA== + dependencies: + xtend "~4.0.0" + +abstract-leveldown@~2.7.1: + version "2.7.2" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz#87a44d7ebebc341d59665204834c8b7e0932cc93" + integrity sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w== + dependencies: + xtend "~4.0.0" + abstract-leveldown@~6.0.0: version "6.0.3" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz#b4b6159343c74b0c5197b2817854782d8f748c4a" @@ -6782,7 +6820,7 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-eventemitter@0.2.4: +async-eventemitter@0.2.4, async-eventemitter@^0.2.2: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== @@ -6815,6 +6853,18 @@ async-retry@^1.2.1, async-retry@^1.3.1: dependencies: retry "0.13.1" +async@^1.4.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + integrity sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w== + +async@^2.0.1, async@^2.1.2, async@^2.5.0: + version "2.6.4" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== + dependencies: + lodash "^4.17.14" + async@^2.4.0: version "2.6.3" resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" @@ -7550,6 +7600,13 @@ babylon@^6.18.0: resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== +backoff@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/backoff/-/backoff-2.5.0.tgz#f616eda9d3e4b66b8ca7fca79f695722c5f8e26f" + integrity sha512-wC5ihrnUXmR2douXmXLCe5O3zg3GKIyvRi/hi58a/XyRxVI+3/yM0PYueQOZXPXQ9pxBislYkw+sF9b7C/RuMA== + dependencies: + precond "0.2" + bail@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d" @@ -8385,6 +8442,13 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= +checkpoint-store@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06" + integrity sha512-J/NdY2WvIx654cc6LWSq/IYFFCUf75fFTgwzFnmbqyORH4MwgiQCgswLLKBGzmsyTI5V7i5bp/So6sMbDWhedg== + dependencies: + functional-red-black-tree "^1.0.1" + cheerio@^1.0.0-rc.2: version "1.0.0-rc.3" resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6" @@ -8661,7 +8725,7 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clone@^2.1.1: +clone@^2.0.0, clone@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= @@ -9583,6 +9647,13 @@ defer-to-connect@^2.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== +deferred-leveldown@~1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz#3acd2e0b75d1669924bc0a4b642851131173e1eb" + integrity sha512-uukrWD2bguRtXilKt6cAWKyoXrTSMo5m7crUdLfWQmu8kIm88w3QZoUL+6nhpfKVmhHANER6Re3sKoNoZ3IKMA== + dependencies: + abstract-leveldown "~2.6.0" + deferred-leveldown@~5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.0.1.tgz#1642eb18b535dfb2b6ac4d39fb10a9cbcfd13b09" @@ -10901,6 +10972,15 @@ eth-block-tracker@4.4.3: pify "^3.0.0" safe-event-emitter "^1.0.1" +eth-block-tracker@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-5.0.1.tgz#c5ad39902bd0454223b601ec0874f9fcc9f30eed" + integrity sha512-NVs+JDSux0FdmOrl3A2YDcQFkkYf9/qW9irvPmtC7bhMoPAe6oBlaqqe/m9Ixh5rkKqAox4mEyWGpsFmf/IsNw== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + json-rpc-random-id "^1.0.1" + pify "^3.0.0" + eth-block-tracker@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-7.1.0.tgz#dfc16085c6817cc30caabba381deb8d204c1c766" @@ -10931,7 +11011,7 @@ eth-ens-namehash@2.0.8, eth-ens-namehash@^2.0.8: idna-uts46-hx "^2.3.1" js-sha3 "^0.5.7" -eth-json-rpc-filters@4.2.2: +eth-json-rpc-filters@4.2.2, eth-json-rpc-filters@^4.2.1: version "4.2.2" resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== @@ -10954,6 +11034,16 @@ eth-json-rpc-filters@^6.0.1: json-rpc-engine "^6.1.0" pify "^5.0.0" +eth-json-rpc-infura@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eth-json-rpc-infura/-/eth-json-rpc-infura-5.1.0.tgz#e6da7dc47402ce64c54e7018170d89433c4e8fb6" + integrity sha512-THzLye3PHUSGn1EXMhg6WTLW9uim7LQZKeKaeYsS9+wOBcamRiCQVGHa6D2/4P0oS0vSaxsBnU/J6qvn0MPdow== + dependencies: + eth-json-rpc-middleware "^6.0.0" + eth-rpc-errors "^3.0.0" + json-rpc-engine "^5.3.0" + node-fetch "^2.6.0" + eth-json-rpc-middleware@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-6.0.0.tgz#4fe16928b34231a2537856f08a5ebbc3d0c31175" @@ -11036,6 +11126,16 @@ ethereum-bloom-filters@^1.0.6: dependencies: js-sha3 "^0.8.0" +ethereum-common@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.2.0.tgz#13bf966131cce1eeade62a1b434249bb4cb120ca" + integrity sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA== + +ethereum-common@^0.0.18: + version "0.0.18" + resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" + integrity sha512-EoltVQTRNg2Uy4o84qpa2aXymXDJhxm7eos/ACOg0DG4baAbMjhbdAEsx9GeE8sC3XCxnYvrrzZDH8D8MtA2iQ== + ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -11092,7 +11192,59 @@ ethereumjs-abi@^0.6.8: bn.js "^4.11.8" ethereumjs-util "^6.0.0" -ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2: +ethereumjs-account@^2.0.3: + version "2.0.5" + resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-2.0.5.tgz#eeafc62de544cb07b0ee44b10f572c9c49e00a84" + integrity sha512-bgDojnXGjhMwo6eXQC0bY6UK2liSFUSMwwylOmQvZbSl/D7NXQ3+vrGO46ZeOgjGfxXmgIeVNDIiHw7fNZM4VA== + dependencies: + ethereumjs-util "^5.0.0" + rlp "^2.0.0" + safe-buffer "^5.1.1" + +ethereumjs-block@^1.2.2: + version "1.7.1" + resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz#78b88e6cc56de29a6b4884ee75379b6860333c3f" + integrity sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg== + dependencies: + async "^2.0.1" + ethereum-common "0.2.0" + ethereumjs-tx "^1.2.2" + ethereumjs-util "^5.0.0" + merkle-patricia-tree "^2.1.2" + +ethereumjs-block@~2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.2.2.tgz#c7654be7e22df489fda206139ecd63e2e9c04965" + integrity sha512-2p49ifhek3h2zeg/+da6XpdFR3GlqY3BIEiqxGF8j9aSRIgkb7M1Ky+yULBKJOu8PAZxfhsYA+HxUk2aCQp3vg== + dependencies: + async "^2.0.1" + ethereumjs-common "^1.5.0" + ethereumjs-tx "^2.1.1" + ethereumjs-util "^5.0.0" + merkle-patricia-tree "^2.1.2" + +ethereumjs-common@^1.1.0, ethereumjs-common@^1.5.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.5.2.tgz#2065dbe9214e850f2e955a80e650cb6999066979" + integrity sha512-hTfZjwGX52GS2jcVO6E2sx4YuFnf0Fhp5ylo4pEPhEffNln7vS59Hr5sLnp3/QCazFLluuBZ+FZ6J5HTp0EqCA== + +ethereumjs-tx@^1.2.2: + version "1.3.7" + resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a" + integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA== + dependencies: + ethereum-common "^0.0.18" + ethereumjs-util "^5.0.0" + +ethereumjs-tx@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz#5dfe7688bf177b45c9a23f86cf9104d47ea35fed" + integrity sha512-zZEK1onCeiORb0wyCXUvg94Ve5It/K6GD1K+26KfFKodiBiS6d9lfCXlUKGBBdQ+bv7Day+JK0tj1K+BeNFRAw== + dependencies: + ethereumjs-common "^1.5.0" + ethereumjs-util "^6.0.0" + +ethereumjs-util@^5.0.0, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2, ethereumjs-util@^5.1.5: version "5.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== @@ -11129,6 +11281,23 @@ ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.2, ethereum ethereum-cryptography "^0.1.3" 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" + integrity sha512-r/XIUik/ynGbxS3y+mvGnbOKnuLo40V5Mj1J25+HEO63aWYREIqvWeRO/hnROlMBE5WoniQmPmhiaN0ctiHaXw== + dependencies: + async "^2.1.2" + async-eventemitter "^0.2.2" + ethereumjs-account "^2.0.3" + ethereumjs-block "~2.2.0" + ethereumjs-common "^1.1.0" + ethereumjs-util "^6.0.0" + fake-merkle-patricia-tree "^1.0.1" + functional-red-black-tree "^1.0.1" + merkle-patricia-tree "^2.3.2" + rustbn.js "~0.2.0" + safe-buffer "^5.1.1" + ethers@^4.0.32: version "4.0.49" resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.49.tgz#0eb0e9161a0c8b4761be547396bbe2fb121a8894" @@ -11442,6 +11611,13 @@ eyes@^0.1.8: resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== +fake-merkle-patricia-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz#4b8c3acfb520afadf9860b1f14cd8ce3402cddd3" + integrity sha512-Tgq37lkc9pUIgIKw5uitNUKcgcYL3R6JvXtKQbOf/ZSavXbidsksgp/pAY6p//uhw0I4yoMsvTSovvVIsk/qxA== + dependencies: + checkpoint-store "^1.1.0" + faker@5.5.3: version "5.5.3" resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e" @@ -12321,7 +12497,7 @@ global-prefix@^1.0.1: is-windows "^1.0.1" which "^1.2.14" -global@^4.4.0: +global@^4.4.0, global@~4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== @@ -13096,6 +13272,15 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +http-signature@~1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9" + integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw== + dependencies: + assert-plus "^1.0.0" + jsprim "^2.0.2" + sshpk "^1.14.1" + http2-wrapper@^2.1.10: version "2.2.0" resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.0.tgz#b80ad199d216b7d3680195077bd7b9060fa9d7f3" @@ -13649,6 +13834,11 @@ is-finite@^1.0.0: dependencies: number-is-nan "^1.0.0" +is-fn@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fn/-/is-fn-1.0.0.tgz#9543d5de7bcf5b08a22ec8a20bae6e286d510d8c" + integrity sha512-XoFPJQmsAShb3jEQRfzf2rqXavq7fIqF/jOekp308JlThqrODnMpweVSGilKTCXELfLhltGP2AGgbQGVP8F1dg== + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -14929,6 +15119,11 @@ json-schema@0.2.3: resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-schema@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" + integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" @@ -15029,6 +15224,16 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +jsprim@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" + integrity sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ== + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.4.0" + verror "1.10.0" + "jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.3.3: version "3.3.5" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz#4766bd05a8e2a11af222becd19e15575e52a853a" @@ -15232,6 +15437,11 @@ level-codec@9.0.2, level-codec@^9.0.0: dependencies: buffer "^5.6.0" +level-codec@~7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-7.0.1.tgz#341f22f907ce0f16763f24bddd681e395a0fb8a7" + integrity sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ== + level-concat-iterator@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz#5235b1f744bc34847ed65a50548aa88d22e881cf" @@ -15244,6 +15454,13 @@ level-concat-iterator@~2.0.0: resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263" integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw== +level-errors@^1.0.3: + version "1.1.2" + resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.1.2.tgz#4399c2f3d3ab87d0625f7e3676e2d807deff404d" + integrity sha512-Sw/IJwWbPKF5Ai4Wz60B52yj0zYeqzObLh8k1Tk88jVmD51cJSKWSYpRyhVIvFzZdvsPqlH5wfhp/yxdsaQH4w== + dependencies: + errno "~0.1.1" + level-errors@^2.0.0, level-errors@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8" @@ -15251,6 +15468,23 @@ level-errors@^2.0.0, level-errors@~2.0.0: dependencies: errno "~0.1.1" +level-errors@~1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.0.5.tgz#83dbfb12f0b8a2516bdc9a31c4876038e227b859" + integrity sha512-/cLUpQduF6bNrWuAC4pwtUKA5t669pCsCi2XbmojG2tFeOr9j6ShtdDCtFFQO1DRt+EVZhx9gPzP9G2bUaG4ig== + dependencies: + errno "~0.1.1" + +level-iterator-stream@~1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz#e43b78b1a8143e6fa97a4f485eb8ea530352f2ed" + integrity sha512-1qua0RHNtr4nrZBgYlpV0qHHeHpcRRWTxEZJ8xsemoHAXNL5tbooh4tPEEqIqsbWCAJBmUmkwYK/sW5OrFjWWw== + dependencies: + inherits "^2.0.1" + level-errors "^1.0.3" + readable-stream "^1.0.33" + xtend "^4.0.0" + level-iterator-stream@~4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c" @@ -15310,6 +15544,14 @@ level-write-stream@1.0.0: dependencies: end-stream "~0.1.0" +level-ws@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-0.0.0.tgz#372e512177924a00424b0b43aef2bb42496d228b" + integrity sha512-XUTaO/+Db51Uiyp/t7fCMGVFOTdtLS/NIACxE/GHsij15mKzxksZifKVjlXDF41JMUP/oM1Oc4YNGdKnc3dVLw== + dependencies: + readable-stream "~1.0.15" + xtend "~2.1.1" + level@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/level/-/level-6.0.1.tgz#dc34c5edb81846a6de5079eac15706334b0d7cd6" @@ -15366,6 +15608,19 @@ levelup@4.4.0, levelup@^4.3.2: level-supports "~1.0.0" xtend "~4.0.0" +levelup@^1.2.1: + version "1.3.9" + resolved "https://registry.yarnpkg.com/levelup/-/levelup-1.3.9.tgz#2dbcae845b2bb2b6bea84df334c475533bbd82ab" + integrity sha512-VVGHfKIlmw8w1XqpGOAGwq6sZm2WwWLmlDcULkKWQXEA5EopA8OBNJ2Ck2v6bdk8HeEZSbCSEgzXadyQFm76sQ== + dependencies: + deferred-leveldown "~1.2.1" + level-codec "~7.0.0" + level-errors "~1.0.3" + level-iterator-stream "~1.3.0" + prr "~1.0.1" + semver "~5.4.1" + xtend "~4.0.0" + leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -15755,7 +16010,7 @@ lru_map@^0.3.3: resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== -ltgt@2.2.1, ltgt@^2.1.2: +ltgt@2.2.1, ltgt@^2.1.2, ltgt@~2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= @@ -15932,6 +16187,18 @@ memdown@1.2.4: inherits "~2.0.1" ltgt "~2.1.3" +memdown@^1.0.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/memdown/-/memdown-1.4.1.tgz#b4e4e192174664ffbae41361aa500f3119efe215" + integrity sha512-iVrGHZB8i4OQfM155xx8akvG9FIj+ht14DX5CQkCTG4EHzZ3d3sgckIf/Lm9ivZalEsFuEVnWv2B2WZvbrro2w== + dependencies: + abstract-leveldown "~2.7.1" + functional-red-black-tree "^1.0.1" + immediate "^3.2.3" + inherits "~2.0.1" + ltgt "~2.2.0" + safe-buffer "~5.1.1" + memfs@^3.4.3: version "3.4.7" resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.4.7.tgz#e5252ad2242a724f938cb937e3c4f7ceb1f70e5a" @@ -16032,6 +16299,20 @@ merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz#982ca1b5a0fde00eed2f6aeed1f9152860b8208a" + integrity sha512-81PW5m8oz/pz3GvsAwbauj7Y00rqm81Tzad77tHBwU7pIAtN+TJnMSOJhxBKflSVYhptMMb9RskhqHqrSm1V+g== + dependencies: + async "^1.4.2" + ethereumjs-util "^5.0.0" + level-ws "0.0.0" + levelup "^1.2.1" + memdown "^1.0.0" + readable-stream "^2.0.0" + rlp "^2.0.0" + semaphore ">=1.0.1" + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -16681,6 +16962,13 @@ node-fetch@2, node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.1.1, node-fetch dependencies: whatwg-url "^5.0.0" +node-fetch@^2.6.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + node-forge@^1: version "1.3.1" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" @@ -17167,6 +17455,11 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== +object-keys@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" + integrity sha512-ncrLw+X55z7bkl5PnUvHwFK9FcGuFYo9gtjws2XtSzL+aZ8tm830P60WJ0dSmFVaSalWieW5MD7kEdnXda9yJw== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" @@ -18329,6 +18622,11 @@ precinct@^9.0.0: module-definition "^4.1.0" node-source-walk "^5.0.1" +precond@0.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/precond/-/precond-0.2.3.tgz#aa9591bcaa24923f1e0f4849d240f47efc1075ac" + integrity sha512-QCYG84SgGyGzqJ/vlMsxeXd/pgL/I94ixdNFyh1PusWmTCyVfPJjZ1K1jvHtsbfnXQs2TSkEP2fR7QiMZAnKFQ== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -18497,6 +18795,14 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" +promise-to-callback@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/promise-to-callback/-/promise-to-callback-1.0.0.tgz#5d2a749010bfb67d963598fcd3960746a68feef7" + integrity sha512-uhMIZmKM5ZteDMfLgJnoSq9GCwsNKrYau73Awf1jIy6/eUcuuZ3P+CD9zUv0kJsIUbU+x6uLNIhXhLHDs1pNPA== + dependencies: + is-fn "^1.0.0" + set-immediate-shim "^1.0.1" + promise.any@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/promise.any/-/promise.any-2.0.3.tgz#04153d59391b57307299718e5098177fba6f56b7" @@ -18586,6 +18892,11 @@ psl@^1.1.28: resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== +psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + public-encrypt@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" @@ -18649,6 +18960,13 @@ qrcode@1.4.4: pngjs "^3.3.0" yargs "^13.2.4" +qs@6.10.4: + version "6.10.4" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.4.tgz#6a3003755add91c0ec9eacdc5f878b034e73f9e7" + integrity sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g== + dependencies: + side-channel "^1.0.4" + qs@6.11.0, qs@^6.10.3: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" @@ -18684,6 +19002,11 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g== +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + queue-microtask@^1.2.2, queue-microtask@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -18965,7 +19288,7 @@ readable-stream@1.0.33, readable-stream@~1.0.31: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@1.1.14: +readable-stream@1.1.14, readable-stream@^1.0.33: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= @@ -18997,11 +19320,34 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.6, readable string_decoder "~1.1.1" util-deprecate "~1.0.1" +readable-stream@^2.2.9: + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + readable-stream@~0.0.2: version "0.0.4" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-0.0.4.tgz#f32d76e3fb863344a548d79923007173665b3b8d" integrity sha1-8y124/uGM0SlSNeZIwBxc2ZbO40= +readable-stream@~1.0.15: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + readdir-scoped-modules@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309" @@ -19716,6 +20062,11 @@ selfsigned@^2.1.1: dependencies: node-forge "^1" +semaphore@>=1.0.1, semaphore@^1.0.3: + version "1.1.0" + resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa" + integrity sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA== + semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" @@ -19745,6 +20096,11 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@~5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + integrity sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg== + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -19832,6 +20188,11 @@ set-blocking@^2.0.0, set-blocking@~2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= +set-immediate-shim@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + integrity sha512-Li5AOqrZWCVA2n5kryzEmqai6bKSIvpz5oUJHPVj6+dsbD3X1ixtsY5tEnsaNpH3pFAHmG8eIHUrtEtohrg+UQ== + set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" @@ -20357,6 +20718,21 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +sshpk@^1.14.1: + version "1.17.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5" + integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + sshpk@^1.7.0: version "1.16.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" @@ -21151,6 +21527,16 @@ tough-cookie@^2.3.1, "tough-cookie@^2.3.3 || ^3.0.1 || ^4.0.0", tough-cookie@~2. psl "^1.1.28" punycode "^2.1.1" +tough-cookie@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" + integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -21676,6 +22062,11 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + universalify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" @@ -21755,6 +22146,14 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + url-set-query@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" @@ -22235,6 +22634,33 @@ web3-net@1.10.0: web3-core-method "1.10.0" web3-utils "1.10.0" +web3-provider-engine@^16.0.6: + version "16.0.6" + resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-16.0.6.tgz#7c5c392c21f090e4a75cae7e57b1ea90769d5d08" + integrity sha512-tQ5w3USNZx2AC7PPI2I6mAlf7rFOldU9+5nZumaXys9x8QElY9x7yAKsxFn4ngGyXkImx//1ywg6KEW3Qwn/9Q== + dependencies: + "@cypress/request" "^3.0.0" + "@ethereumjs/tx" "^3.3.0" + async "^2.5.0" + backoff "^2.5.0" + clone "^2.0.0" + eth-block-tracker "^5.0.1" + eth-json-rpc-filters "^4.2.1" + eth-json-rpc-infura "^5.1.0" + eth-json-rpc-middleware "^6.0.0" + eth-rpc-errors "^3.0.0" + eth-sig-util "^1.4.2" + ethereumjs-block "^1.2.2" + ethereumjs-util "^5.1.5" + ethereumjs-vm "^2.3.4" + json-stable-stringify "^1.0.1" + promise-to-callback "^1.0.0" + readable-stream "^2.2.9" + semaphore "^1.0.3" + ws "^7.5.9" + xhr "^2.2.0" + xtend "^4.0.1" + web3-providers-http@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.10.0.tgz#864fa48675e7918c9a4374e5f664b32c09d0151b" @@ -22756,6 +23182,11 @@ ws@^3.0.0: safe-buffer "~5.1.0" ultron "~1.1.0" +ws@^7.5.9: + version "7.5.9" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" + integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== + xhr-request-promise@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz#343c44d1ee7726b8648069682d0f840c83b4261d" @@ -22786,6 +23217,16 @@ xhr@^2.0.4, xhr@^2.3.3: parse-headers "^2.0.0" xtend "^4.0.0" +xhr@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d" + integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== + dependencies: + global "~4.4.0" + is-function "^1.0.1" + parse-headers "^2.0.0" + xtend "^4.0.0" + xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" @@ -22811,6 +23252,13 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +xtend@~2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" + integrity sha512-vMNKzr2rHP9Dp/e1NQFnLQlwlhp9L/LfvnsVdHxN1f+uggyVI3i08uD14GPvCToPkdsRfyPqIyYGmIk58V98ZQ== + dependencies: + object-keys "~0.4.0" + y18n@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" From 85907f127141b76255a7ec5a42f503d787ad1367 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 05:12:34 +0000 Subject: [PATCH 6/8] wip --- packages/hdwallet-provider/package.json | 2 +- packages/hdwallet-provider/src/index.ts | 65 +++++++++++++------ .../hdwallet-provider/test/provider.test.ts | 20 ++++-- .../test/signTypedData.test.ts | 2 +- 4 files changed, 59 insertions(+), 30 deletions(-) diff --git a/packages/hdwallet-provider/package.json b/packages/hdwallet-provider/package.json index b91cf88bfdd..1aaf1738adc 100644 --- a/packages/hdwallet-provider/package.json +++ b/packages/hdwallet-provider/package.json @@ -17,7 +17,7 @@ "scripts": { "build": "tsc", "prepare": "yarn build", - "test": "yarn build && mocha --exit -r ts-node/register test/**/*.test.ts" + "test": "yarn build && mocha --exit -t 5000 -r ts-node/register test/**/*.test.ts" }, "types": "dist/index.d.ts", "dependencies": { diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index 57ffb93475b..f562a3d3fe3 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -18,7 +18,8 @@ import { // @ts-ignore import createFilterMiddleware from "eth-json-rpc-filters"; // @ts-ignore -import NonceSubProvider from "nonce-tracker"; +import NonceSubProvider from "web3-provider-engine/subproviders/nonce-tracker"; +// import NonceSubProvider from "nonce-tracker"; // @ts-ignore import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; // @ts-ignore @@ -67,12 +68,16 @@ const getSingletonNonceSubProvider = (opts: { blockTracker: any; }): NonceSubProvider => { if (singletonNonceSubProvider) { + // TODO: throw if opts mismatch existing? } else { singletonNonceSubProvider = new NonceSubProvider({ - provider: opts.rpcProvider, + // provider: opts.rpcProvider, + /* + provider: opts.rpcProvider.provider as any, blockTracker: opts.blockTracker, getPendingTransactions: (_address: string) => [], getConfirmedTransactions: (_address: string) => [] + */ }); } return singletonNonceSubProvider; @@ -87,6 +92,7 @@ class HDWalletProvider { private chainSettings: ChainSettings; private hardfork: Hardfork; private initialized: Promise; + public _blockTracker: PollingBlockTracker; constructor(...args: ConstructorArguments) { const { @@ -97,8 +103,7 @@ class HDWalletProvider { numberOfAddresses = 10, shareNonce = true, derivationPath = `m/44'/60'/0'/0/`, - // TODO: Unused/ deprecated...? - // pollingInterval = 4000, + pollingInterval = 4000, chainId, chainSettings = {}, @@ -174,17 +179,6 @@ class HDWalletProvider { const tmpAccounts = this.#addresses; const tmpWallets = this.#wallets; - // if user supplied the chain id, use that - otherwise fetch it - if ( - typeof chainId !== "undefined" || - (chainSettings && typeof chainSettings.chainId !== "undefined") - ) { - this.chainId = chainId || chainSettings.chainId; - this.initialized = Promise.resolve(); - } else { - this.initialized = this.initialize(); - } - // EIP155 compliant transactions are enabled for hardforks later // than or equal to "spurious dragon" this.hardfork = @@ -194,7 +188,7 @@ class HDWalletProvider { const self = this; - engine.push( + const hookedSubprovider = new HookedSubprovider({ getAccounts(cb: any) { cb(null, tmpAccounts); @@ -295,7 +289,6 @@ class HDWalletProvider { cb(null, signature); } }) - ); const createProvider = () => { if (typeof providerToUse === "string") { @@ -317,16 +310,18 @@ class HDWalletProvider { } }; const rpcProvider = createProvider(); + console.log('HDP.CONSTRUCTOR', {rpcProvider}); const blockTracker = new PollingBlockTracker({ - provider: rpcProvider - // pollingInterval?: number; + provider: rpcProvider, + pollingInterval, // retryTimeout?: number; // keepEventLoopActive?: boolean; // setSkipCacheFlag?: boolean; // blockResetDuration?: number; // usePastBlocks?: boolean; }); + this._blockTracker = blockTracker; const nonceSubProvider = shareNonce ? getSingletonNonceSubProvider({ @@ -334,25 +329,48 @@ class HDWalletProvider { rpcProvider }) : new NonceSubProvider({ + /* blockTracker, provider: rpcProvider, getPendingTransactions: (_address: string) => [], getConfirmedTransactions: (_address: string) => [] + */ }); const filtersSubProvider = createFilterMiddleware({ blockTracker, provider: rpcProvider }); - engine.push(nonceSubProvider as any); + engine.push((req, _res, next, end) => { + console.log('EN1', {req, _res, next, end}); + return hookedSubprovider.handleRequest(req, next, end); + }); + engine.push((req, _res, next, end) => { + console.log('EN2', {req, _res, next, end}); + return nonceSubProvider.handleRequest(req, next, end); + }); engine.push(filtersSubProvider); - engine.push(rpcProvider); + // engine.push(filtersSubProvider.handleRequest); + //engine.push(rpcProvider); this.#provider = providerFromEngine(engine); + + // if user supplied the chain id, use that - otherwise fetch it + if ( + typeof chainId !== "undefined" || + (chainSettings && typeof chainSettings.chainId !== "undefined") + ) { + this.chainId = chainId || chainSettings.chainId; + this.initialized = Promise.resolve(); + } else { + this.initialized = this.initialize(); + } + } private initialize(): Promise { return new Promise((resolve, reject) => { + console.log('INITIALIZE', {provider: this.#provider}); this.#provider.sendAsync( { jsonrpc: "2.0", @@ -361,6 +379,7 @@ class HDWalletProvider { params: [] }, (error: any, response: JsonRpcResponse) => { + console.log('INITIALIZE.HANDLE', {error, response}); if (error) { reject(error); return; @@ -440,7 +459,9 @@ class HDWalletProvider { response: JsonRpcResponse ) => void ): void { + console.trace('SEND'); this.initialized.then(() => { + console.log('SEND.INITIALIZED'); // @ts-ignore we patch callback method so it doesn't conform to type this.#provider.sendAsync(payload, callback); }); @@ -453,7 +474,9 @@ class HDWalletProvider { response?: JsonRpcResponse ) => void ): void { + console.trace('HDP.SENDASYNC'); this.initialized.then(() => { + console.log('HDP.SENDASYNC.INITIALIZED'); // @ts-ignore we patch callback method so it doesn't conform to type this.#provider.sendAsync(payload, callback); }); diff --git a/packages/hdwallet-provider/test/provider.test.ts b/packages/hdwallet-provider/test/provider.test.ts index 9fcd707dd88..fb6897b5835 100644 --- a/packages/hdwallet-provider/test/provider.test.ts +++ b/packages/hdwallet-provider/test/provider.test.ts @@ -28,9 +28,11 @@ describe("HD Wallet Provider", function () { afterEach(() => { web3.setProvider(null); + /* if (hdWalletProvider) { hdWalletProvider.engine.stop(); } + */ }); describe("instantiating with positional arguments", () => { @@ -55,7 +57,11 @@ describe("HD Wallet Provider", function () { assert.deepEqual(hdWalletProvider.getAddresses(), truffleDevAccounts); web3.setProvider(hdWalletProvider as provider); - const number = await web3.eth.getBlockNumber(); + console.log('FOOO', {hdWalletProvider}); + const number = await web3.eth.getBlockNumber((x,y) => { + console.log('XYZ', x, y); + }); + console.log('BAR', {number}); assert(number === 0); }); @@ -226,13 +232,13 @@ describe("HD Wallet Provider", function () { provider: ganacheProvider // polling interval is unspecified }); - assert.ok(hdWalletProvider.engine, "Web3ProviderEngine instantiated"); assert.ok( - (hdWalletProvider.engine as any)._blockTracker, + hdWalletProvider._blockTracker, "PollingBlockTracker instantiated" ); assert.deepEqual( - (hdWalletProvider.engine as any)._blockTracker._pollingInterval, + // @ts-ignore + hdWalletProvider._blockTracker._pollingInterval, 4000, "PollingBlockTracker with expected pollingInterval" ); @@ -249,13 +255,13 @@ describe("HD Wallet Provider", function () { // double the default value, for less chatty JSON-RPC pollingInterval: 8000 }); - assert.ok(hdWalletProvider.engine, "Web3ProviderEngine instantiated"); assert.ok( - (hdWalletProvider.engine as any)._blockTracker, + hdWalletProvider._blockTracker, "PollingBlockTracker instantiated" ); assert.deepEqual( - (hdWalletProvider.engine as any)._blockTracker._pollingInterval, + // @ts-ignore + hdWalletProvider._blockTracker._pollingInterval, 8000, "PollingBlockTracker with expected pollingInterval" ); diff --git a/packages/hdwallet-provider/test/signTypedData.test.ts b/packages/hdwallet-provider/test/signTypedData.test.ts index 1d22cc067f5..d00b3fe625a 100644 --- a/packages/hdwallet-provider/test/signTypedData.test.ts +++ b/packages/hdwallet-provider/test/signTypedData.test.ts @@ -47,7 +47,7 @@ describe("eth_signTypedData_v4", function () { params: ["0x627306090abab3a6e1400e9345bc60c78a8bef57", msgParams_v4], jsonrpc: "2.0", id: 1 - }); + }) as unknown as { result: string}; const expectedResult = "0xbc12f50c57213e1ce05a904541e8cdeebd25fdd4aac1fe07dc99ec1dd940f5a86fecfb1c3567cd5d64635694fba4a8fd9415c4b35192002108912d65d57570811c"; assert.equal(result, expectedResult); From 34ab1231e9fe39385b50951410f22c57af4fbd59 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 05:44:25 +0000 Subject: [PATCH 7/8] wip --- packages/hdwallet-provider/package.json | 2 +- packages/hdwallet-provider/src/index.ts | 8 +- yarn.lock | 109 +++++++----------------- 3 files changed, 39 insertions(+), 80 deletions(-) diff --git a/packages/hdwallet-provider/package.json b/packages/hdwallet-provider/package.json index 1aaf1738adc..037fc2a68cc 100644 --- a/packages/hdwallet-provider/package.json +++ b/packages/hdwallet-provider/package.json @@ -23,7 +23,7 @@ "dependencies": { "@ethereumjs/common": "^2.4.0", "@ethereumjs/tx": "^3.3.0", - "@metamask/eth-json-rpc-middleware": "^11.0.1", + "@metamask/eth-json-rpc-middleware": "^12.0.0", "@metamask/eth-json-rpc-provider": "^2.0.0", "@metamask/eth-sig-util": "4.0.1", "@metamask/json-rpc-engine": "^7.1.1", diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index f562a3d3fe3..21373d90ac0 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -9,6 +9,7 @@ import Common from "@ethereumjs/common"; import { PollingBlockTracker } from "eth-block-tracker"; import { JsonRpcEngine } from "@metamask/json-rpc-engine"; +import { providerAsMiddleware } from "@metamask/eth-json-rpc-middleware"; //import type { JsonRpcMiddleware } from "@metamask/json-rpc-engine"; import { SafeEventEmitterProvider, @@ -23,7 +24,7 @@ import NonceSubProvider from "web3-provider-engine/subproviders/nonce-tracker"; // @ts-ignore import HookedSubprovider from "web3-provider-engine/subproviders/hooked-wallet"; // @ts-ignore -import ProviderSubprovider from "web3-provider-engine/subproviders/provider"; +//import ProviderSubprovider from "web3-provider-engine/subproviders/provider"; // @ts-ignore import RpcProvider from "web3-provider-engine/subproviders/rpc"; // @ts-ignore @@ -306,10 +307,11 @@ class HDWalletProvider { return new RpcProvider({ rpcUrl: url }); } } else { - return new ProviderSubprovider(providerToUse); + return providerToUse; } }; const rpcProvider = createProvider(); + const rpcProviderMiddleware = providerAsMiddleware(rpcProvider); console.log('HDP.CONSTRUCTOR', {rpcProvider}); const blockTracker = new PollingBlockTracker({ @@ -351,7 +353,7 @@ class HDWalletProvider { }); engine.push(filtersSubProvider); // engine.push(filtersSubProvider.handleRequest); - //engine.push(rpcProvider); + engine.push(rpcProviderMiddleware); this.#provider = providerFromEngine(engine); diff --git a/yarn.lock b/yarn.lock index 57a2c0d48a7..b0d45f75b1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3344,37 +3344,28 @@ resolved "https://registry.yarnpkg.com/@mantine/utils/-/utils-5.10.5.tgz#ad620d714e545c6efb7f69d94ce46e3fd2fe01fb" integrity sha512-FGMq4dGs5HhDAtI0z46uzxzKKPmZ3h5uKUyKg1ZHoFR1mBtcUMbB6FylFmHqKFRWlJ5IXqX9dwmiVrLYUOfTmA== -"@metamask/abi-utils@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-1.2.0.tgz#068e1b0f5e423dfae96961e0e5276a7c1babc03a" - integrity sha512-Hf7fnBDM9ptCPDtq/wQffWbw859CdVGMwlpWUEsTH6gLXhXONGrRXHA2piyYPRuia8YYTdJvRC/zSK1/nyLvYg== +"@metamask/abi-utils@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@metamask/abi-utils/-/abi-utils-2.0.2.tgz#ad394e9cb8a95ac177cad942daadd88a246c0de8" + integrity sha512-B/A1dY/w4F/t6cDHUscklO6ovb/ztFsrsTXFd8QlqSByk/vyy+QbPE3VVpmmyI/7RX+PA1AJcvBdzCIz+r9dVQ== dependencies: - "@metamask/utils" "^3.4.1" + "@metamask/utils" "^8.0.0" superstruct "^1.0.3" -"@metamask/eth-json-rpc-middleware@^11.0.1": - version "11.0.2" - resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-middleware/-/eth-json-rpc-middleware-11.0.2.tgz#85e6639f5d159a3277d13609dea9f12ebfb5b4e8" - integrity sha512-/HqtuK/6E8sIJmzg0O3Ey5JsgK6O/VbDqg5R9thHFQMi9EtKXnnZFc8Blir7IOQraGVJFiZQIKZMHRTNQRyreg== +"@metamask/eth-json-rpc-middleware@^12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-middleware/-/eth-json-rpc-middleware-12.0.0.tgz#d7178d8c3bf85c6978b14dd1c3b9bbe4a90facde" + integrity sha512-ZxNmnM2e2Yt/ChjHjhPVHokRr/mwMY5o/W65b8y4tNI6PWuaaIYzN6CzKZVJr4c/XuYkYnzaT0CL63/QkA6edw== dependencies: - "@metamask/eth-json-rpc-provider" "^1.0.0" - "@metamask/eth-sig-util" "^6.0.0" - "@metamask/utils" "^5.0.1" - clone "^2.1.1" - eth-block-tracker "^7.0.1" - eth-rpc-errors "^4.0.3" - json-rpc-engine "^6.1.0" - pify "^3.0.0" - safe-stable-stringify "^2.3.2" - -"@metamask/eth-json-rpc-provider@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@metamask/eth-json-rpc-provider/-/eth-json-rpc-provider-1.0.1.tgz#3fd5316c767847f4ca107518b611b15396a5a32c" - integrity sha512-whiUMPlAOrVGmX8aKYVPvlKyG4CpQXiNNyt74vE1xb5sPvmx5oA7B/kOi/JdBvhGQq97U1/AVdXEdk2zkP8qyA== - dependencies: - "@metamask/json-rpc-engine" "^7.0.0" - "@metamask/safe-event-emitter" "^3.0.0" - "@metamask/utils" "^5.0.1" + "@metamask/eth-json-rpc-provider" "^2.1.0" + "@metamask/eth-sig-util" "^7.0.0" + "@metamask/json-rpc-engine" "^7.1.1" + "@metamask/rpc-errors" "^6.0.0" + "@metamask/utils" "^8.1.0" + eth-block-tracker "^8.0.0" + klona "^2.0.6" + pify "^5.0.0" + safe-stable-stringify "^2.4.3" "@metamask/eth-json-rpc-provider@^2.0.0", "@metamask/eth-json-rpc-provider@^2.1.0": version "2.2.0" @@ -3396,20 +3387,20 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@metamask/eth-sig-util@^6.0.0": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-6.0.1.tgz#2c5a670c9552ce4d47309d5f5d6569d0518fec23" - integrity sha512-Lt2DC4w4Sbtbd4DCsE+vfjdWcnFHSxfSfiJpt66hfLtAbetHsvbZcwKoa46TEA3G/V48ZuS4NWvJmtaA4F8UWA== +"@metamask/eth-sig-util@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-7.0.0.tgz#b035a2b826018578a5d463668bb64828271376d8" + integrity sha512-8KeXZB4SKx3EfNS5ahbjUMegyGvDQYk6Nk3hmM658sXpfAQR5ZlIXBgj+9RF+ZROqsU6EuNVgKt7Fr10re60PQ== dependencies: "@ethereumjs/util" "^8.1.0" - "@metamask/abi-utils" "^1.2.0" - "@metamask/utils" "^5.0.2" + "@metamask/abi-utils" "^2.0.2" + "@metamask/utils" "^8.1.0" ethereum-cryptography "^2.1.2" ethjs-util "^0.1.6" tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@metamask/json-rpc-engine@^7.0.0", "@metamask/json-rpc-engine@^7.1.0", "@metamask/json-rpc-engine@^7.1.1": +"@metamask/json-rpc-engine@^7.1.0", "@metamask/json-rpc-engine@^7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@metamask/json-rpc-engine/-/json-rpc-engine-7.1.1.tgz#90d4c1e1fe3bcfc983563f6e07715319b8857190" integrity sha512-wPB8Or74OqMwcxa87JPOEjXwtgpyHPEXiLKblKRAtCjTJNQFp1Co//1CgFm5xj4Z5JbBGfGFiQNnj09Et40sig== @@ -3436,28 +3427,7 @@ resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.0.0.tgz#8c2b9073fe0722d48693143b0dc8448840daa3bd" integrity sha512-j6Z47VOmVyGMlnKXZmL0fyvWfEYtKWCA9yGZkU3FCsGZUT5lHGmvaV9JA5F2Y+010y7+ROtR3WMXIkvl/nVzqQ== -"@metamask/utils@^3.4.1": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" - integrity sha512-9cIRrfkWvHblSiNDVXsjivqa9Ak0RYo/1H6tqTqTbAx+oBK2Sva0lWDHxGchOqA7bySGUJKAWSNJvH6gdHZ0gQ== - dependencies: - "@types/debug" "^4.1.7" - debug "^4.3.4" - semver "^7.3.8" - superstruct "^1.0.3" - -"@metamask/utils@^5.0.1", "@metamask/utils@^5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-5.0.2.tgz#140ba5061d90d9dac0280c19cab101bc18c8857c" - integrity sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g== - dependencies: - "@ethereumjs/tx" "^4.1.2" - "@types/debug" "^4.1.7" - debug "^4.3.4" - semver "^7.3.8" - superstruct "^1.0.3" - -"@metamask/utils@^8.1.0": +"@metamask/utils@^8.0.0", "@metamask/utils@^8.1.0": version "8.1.0" resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-8.1.0.tgz#b8e73f5b4696b1b668cf5c1421daad140a3f98ac" integrity sha512-sFNpzBKRicDgM2ZuU6vrPROlqNGm8/jDsjc5WrU1RzCkAMc4Xr3vUUf8p59uQ6B09etUWNb8d2GTCbISdmH/Ug== @@ -10981,18 +10951,7 @@ eth-block-tracker@^5.0.1: json-rpc-random-id "^1.0.1" pify "^3.0.0" -eth-block-tracker@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-7.1.0.tgz#dfc16085c6817cc30caabba381deb8d204c1c766" - integrity sha512-8YdplnuE1IK4xfqpf4iU7oBxnOYAc35934o083G8ao+8WM8QQtt/mVlAY6yIAdY1eMeLqg4Z//PZjJGmWGPMRg== - dependencies: - "@metamask/eth-json-rpc-provider" "^1.0.0" - "@metamask/safe-event-emitter" "^3.0.0" - "@metamask/utils" "^5.0.1" - json-rpc-random-id "^1.0.1" - pify "^3.0.0" - -eth-block-tracker@^8.1.0: +eth-block-tracker@^8.0.0, eth-block-tracker@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-8.1.0.tgz#6ca4f6b955ff3e114f5aa0e8d36b11196ad1ea92" integrity sha512-cdP9GMtJV87d4yuj4A3WX7gHIoJP4T4eeGgVW1jLjC/H7xuJsjs9vtwy9DJZvcd2cpRYZNQ7eWsdoJriHfi67Q== @@ -11104,13 +11063,6 @@ eth-rpc-errors@^3.0.0: dependencies: fast-safe-stringify "^2.0.6" -eth-rpc-errors@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" - integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== - dependencies: - fast-safe-stringify "^2.0.6" - eth-sig-util@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" @@ -15331,6 +15283,11 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== +klona@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.6.tgz#85bffbf819c03b2f53270412420a4555ef882e22" + integrity sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA== + language-subtag-registry@~0.3.2: version "0.3.22" resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz#2e1500861b2e457eba7e7ae86877cbd08fa1fd1d" @@ -19935,7 +19892,7 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -safe-stable-stringify@^2.3.2: +safe-stable-stringify@^2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== From 37defba68f935934d8239eaa771ecbf03df734ae Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 16 Oct 2023 05:45:02 +0000 Subject: [PATCH 8/8] wip --- packages/hdwallet-provider/src/index.ts | 224 ++++++++++++------------ 1 file changed, 111 insertions(+), 113 deletions(-) diff --git a/packages/hdwallet-provider/src/index.ts b/packages/hdwallet-provider/src/index.ts index 21373d90ac0..9860099c989 100644 --- a/packages/hdwallet-provider/src/index.ts +++ b/packages/hdwallet-provider/src/index.ts @@ -64,7 +64,7 @@ let singletonNonceSubProvider: null | NonceSubProvider; // TODO: Constrain type type JsonRpcProvider = Record; -const getSingletonNonceSubProvider = (opts: { +const getSingletonNonceSubProvider = (_opts: { rpcProvider: JsonRpcProvider; blockTracker: any; }): NonceSubProvider => { @@ -73,7 +73,7 @@ const getSingletonNonceSubProvider = (opts: { } else { singletonNonceSubProvider = new NonceSubProvider({ // provider: opts.rpcProvider, - /* + /* provider: opts.rpcProvider.provider as any, blockTracker: opts.blockTracker, getPendingTransactions: (_address: string) => [], @@ -189,107 +189,106 @@ class HDWalletProvider { const self = this; - const hookedSubprovider = - new HookedSubprovider({ - getAccounts(cb: any) { - cb(null, tmpAccounts); - }, - getPrivateKey(address: string, cb: any) { - if (!tmpWallets[address]) { - cb("Account not found"); - return; - } else { - cb(null, tmpWallets[address].toString("hex")); - } - }, - async signTransaction(txParams: any, cb: any) { - await self.initialized; - // we need to rename the 'gas' field - txParams.gasLimit = txParams.gas; - delete txParams.gas; - - let pkey; - const from = txParams.from.toLowerCase(); - if (tmpWallets[from]) { - pkey = tmpWallets[from]; - } else { - cb("Account not found"); - return; - } - const chain = self.chainId; - const KNOWN_CHAIN_IDS = new Set([1, 3, 4, 5, 42]); - let txOptions; - if (typeof chain !== "undefined" && KNOWN_CHAIN_IDS.has(chain)) { - txOptions = { - common: new Common({ chain, hardfork: self.hardfork }) - }; - } else if (typeof chain !== "undefined") { - txOptions = { - common: Common.forCustomChain( - 1, - { - name: "custom chain", - chainId: chain - }, - self.hardfork - ) - }; - } + const hookedSubprovider = new HookedSubprovider({ + getAccounts(cb: any) { + cb(null, tmpAccounts); + }, + getPrivateKey(address: string, cb: any) { + if (!tmpWallets[address]) { + cb("Account not found"); + return; + } else { + cb(null, tmpWallets[address].toString("hex")); + } + }, + async signTransaction(txParams: any, cb: any) { + await self.initialized; + // we need to rename the 'gas' field + txParams.gasLimit = txParams.gas; + delete txParams.gas; + + let pkey; + const from = txParams.from.toLowerCase(); + if (tmpWallets[from]) { + pkey = tmpWallets[from]; + } else { + cb("Account not found"); + return; + } + const chain = self.chainId; + const KNOWN_CHAIN_IDS = new Set([1, 3, 4, 5, 42]); + let txOptions; + if (typeof chain !== "undefined" && KNOWN_CHAIN_IDS.has(chain)) { + txOptions = { + common: new Common({ chain, hardfork: self.hardfork }) + }; + } else if (typeof chain !== "undefined") { + txOptions = { + common: Common.forCustomChain( + 1, + { + name: "custom chain", + chainId: chain + }, + self.hardfork + ) + }; + } - // Taken from https://github.com/ethers-io/ethers.js/blob/2a7ce0e72a1e0c9469e10392b0329e75e341cf18/packages/abstract-signer/src.ts/index.ts#L215 - const hasEip1559 = - txParams.maxFeePerGas !== undefined || - txParams.maxPriorityFeePerGas !== undefined; - const tx = hasEip1559 - ? FeeMarketEIP1559Transaction.fromTxData(txParams, txOptions) - : Transaction.fromTxData(txParams, txOptions); - - const signedTx = tx.sign(pkey as Buffer); - const rawTx = `0x${signedTx.serialize().toString("hex")}`; - cb(null, rawTx); - }, - signMessage({ data, from }: any, cb: any) { - const dataIfExists = data; - if (!dataIfExists) { - cb("No data to sign"); - return; - } - if (!tmpWallets[from]) { - cb("Account not found"); - return; - } - let pkey = tmpWallets[from]; - const dataBuff = EthUtil.toBuffer(dataIfExists); - const msgHashBuff = EthUtil.hashPersonalMessage(dataBuff); - const sig = EthUtil.ecsign(msgHashBuff, pkey); - const rpcSig = EthUtil.toRpcSig(sig.v, sig.r, sig.s); - cb(null, rpcSig); - }, - signPersonalMessage(...args: any[]) { - this.signMessage(...args); - }, - signTypedMessage( - { data, from }: { data: string; from: string }, - cb: any - ) { - if (!data) { - cb("No data to sign"); - return; - } - // convert address to lowercase in case it is in checksum format - const fromAddress = from.toLowerCase(); - if (!tmpWallets[fromAddress]) { - cb("Account not found"); - return; - } - const signature = signTypedData({ - data: JSON.parse(data), - privateKey: tmpWallets[fromAddress], - version: SignTypedDataVersion.V4 - }); - cb(null, signature); + // Taken from https://github.com/ethers-io/ethers.js/blob/2a7ce0e72a1e0c9469e10392b0329e75e341cf18/packages/abstract-signer/src.ts/index.ts#L215 + const hasEip1559 = + txParams.maxFeePerGas !== undefined || + txParams.maxPriorityFeePerGas !== undefined; + const tx = hasEip1559 + ? FeeMarketEIP1559Transaction.fromTxData(txParams, txOptions) + : Transaction.fromTxData(txParams, txOptions); + + const signedTx = tx.sign(pkey as Buffer); + const rawTx = `0x${signedTx.serialize().toString("hex")}`; + cb(null, rawTx); + }, + signMessage({ data, from }: any, cb: any) { + const dataIfExists = data; + if (!dataIfExists) { + cb("No data to sign"); + return; } - }) + if (!tmpWallets[from]) { + cb("Account not found"); + return; + } + let pkey = tmpWallets[from]; + const dataBuff = EthUtil.toBuffer(dataIfExists); + const msgHashBuff = EthUtil.hashPersonalMessage(dataBuff); + const sig = EthUtil.ecsign(msgHashBuff, pkey); + const rpcSig = EthUtil.toRpcSig(sig.v, sig.r, sig.s); + cb(null, rpcSig); + }, + signPersonalMessage(...args: any[]) { + this.signMessage(...args); + }, + signTypedMessage( + { data, from }: { data: string; from: string }, + cb: any + ) { + if (!data) { + cb("No data to sign"); + return; + } + // convert address to lowercase in case it is in checksum format + const fromAddress = from.toLowerCase(); + if (!tmpWallets[fromAddress]) { + cb("Account not found"); + return; + } + const signature = signTypedData({ + data: JSON.parse(data), + privateKey: tmpWallets[fromAddress], + version: SignTypedDataVersion.V4 + }); + cb(null, signature); + } + }); const createProvider = () => { if (typeof providerToUse === "string") { @@ -312,11 +311,11 @@ class HDWalletProvider { }; const rpcProvider = createProvider(); const rpcProviderMiddleware = providerAsMiddleware(rpcProvider); - console.log('HDP.CONSTRUCTOR', {rpcProvider}); + console.log("HDP.CONSTRUCTOR", { rpcProvider }); const blockTracker = new PollingBlockTracker({ provider: rpcProvider, - pollingInterval, + pollingInterval // retryTimeout?: number; // keepEventLoopActive?: boolean; // setSkipCacheFlag?: boolean; @@ -331,7 +330,7 @@ class HDWalletProvider { rpcProvider }) : new NonceSubProvider({ - /* + /* blockTracker, provider: rpcProvider, getPendingTransactions: (_address: string) => [], @@ -344,11 +343,11 @@ class HDWalletProvider { provider: rpcProvider }); engine.push((req, _res, next, end) => { - console.log('EN1', {req, _res, next, end}); + console.log("EN1", { req, _res, next, end }); return hookedSubprovider.handleRequest(req, next, end); }); engine.push((req, _res, next, end) => { - console.log('EN2', {req, _res, next, end}); + console.log("EN2", { req, _res, next, end }); return nonceSubProvider.handleRequest(req, next, end); }); engine.push(filtersSubProvider); @@ -367,12 +366,11 @@ class HDWalletProvider { } else { this.initialized = this.initialize(); } - } private initialize(): Promise { return new Promise((resolve, reject) => { - console.log('INITIALIZE', {provider: this.#provider}); + console.log("INITIALIZE", { provider: this.#provider }); this.#provider.sendAsync( { jsonrpc: "2.0", @@ -381,7 +379,7 @@ class HDWalletProvider { params: [] }, (error: any, response: JsonRpcResponse) => { - console.log('INITIALIZE.HANDLE', {error, response}); + console.log("INITIALIZE.HANDLE", { error, response }); if (error) { reject(error); return; @@ -461,9 +459,9 @@ class HDWalletProvider { response: JsonRpcResponse ) => void ): void { - console.trace('SEND'); + console.trace("SEND"); this.initialized.then(() => { - console.log('SEND.INITIALIZED'); + console.log("SEND.INITIALIZED"); // @ts-ignore we patch callback method so it doesn't conform to type this.#provider.sendAsync(payload, callback); }); @@ -476,9 +474,9 @@ class HDWalletProvider { response?: JsonRpcResponse ) => void ): void { - console.trace('HDP.SENDASYNC'); + console.trace("HDP.SENDASYNC"); this.initialized.then(() => { - console.log('HDP.SENDASYNC.INITIALIZED'); + console.log("HDP.SENDASYNC.INITIALIZED"); // @ts-ignore we patch callback method so it doesn't conform to type this.#provider.sendAsync(payload, callback); });