From ed60297642609e66850fc74ae3f682e6815cc5cb Mon Sep 17 00:00:00 2001 From: bludnic Date: Sat, 14 Oct 2023 03:55:44 +0100 Subject: [PATCH 01/12] feat: add tests before updating `web3-utils` --- src/lib/__tests__/eth-utils.spec.js | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/lib/__tests__/eth-utils.spec.js diff --git a/src/lib/__tests__/eth-utils.spec.js b/src/lib/__tests__/eth-utils.spec.js new file mode 100644 index 000000000..42e259bb9 --- /dev/null +++ b/src/lib/__tests__/eth-utils.spec.js @@ -0,0 +1,55 @@ +// @vitest-environment node +// Some crypto libs throw errors when using `jsdom` environment + +import { describe, it, expect } from 'vitest' +import Web3Eth from 'web3-eth' + +import { toEther, toWei, getAccountFromPassphrase } from '@/lib/eth-utils' + +describe('eth-utils', () => { + describe('toEther', () => { + it('should convert Wei amount to Ether from a number', () => { + expect(toEther(1)).toBe('0.000000000000000001') + }) + + it('should convert Wei amount to Ether from a numeric string', () => { + expect(toEther('1')).toBe('0.000000000000000001') + }) + }) + + describe('toWei', () => { + it('should convert Ether value into Wei from a number', () => { + expect(toWei(1)).toBe('1000000000000000000') + }) + + it('should convert Ether value into Wei from a numeric string', () => { + expect(toWei('1')).toBe('1000000000000000000') + }) + + it('should convert Gwei value into Wei', () => { + expect(toWei(1, 'gwei')).toBe('1000000000') + }) + }) + + describe('getAccountFromPassphrase', () => { + const passphrase = 'joy mouse injury soft decade bid rough about alarm wreck season sting' + const api = new Web3Eth('https://clown.adamant.im') + + it('should generate account from passphrase with "web3Account"', () => { + expect(getAccountFromPassphrase(passphrase, api)).toMatchObject({ + web3Account: { + address: '0x045d7e948087D9C6D88D58e41587A610400869B6', + privateKey: '0x344854fa2184c252bdcc09daf8fe7fbcc960aed8f4da68de793f9fbc50b5a686' + }, + address: '0x045d7e948087D9C6D88D58e41587A610400869B6', + privateKey: '0x344854fa2184c252bdcc09daf8fe7fbcc960aed8f4da68de793f9fbc50b5a686' + }) + }) + + it('should generate account from passphrase without "web3Account"', () => { + expect(getAccountFromPassphrase(passphrase)).toEqual({ + privateKey: '0x344854fa2184c252bdcc09daf8fe7fbcc960aed8f4da68de793f9fbc50b5a686' + }) + }) + }) +}) From 1be8905659dd985553b893801a57d18dcd4c1c3b Mon Sep 17 00:00:00 2001 From: bludnic Date: Sat, 14 Oct 2023 03:59:55 +0100 Subject: [PATCH 02/12] feat(`web3-utils`): upgrade from v1 -> v4 --- package-lock.json | 356 +++++++++++++++++++++++++++++++++++++++++-- package.json | 2 +- src/lib/eth-utils.js | 2 +- 3 files changed, 346 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 40f8459fb..6cad81495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,7 +71,7 @@ "vuex": "^4.1.0", "vuex-persist": "^3.1.3", "web3-eth": "^1.9.0", - "web3-utils": "^1.9.0" + "web3-utils": "^4.0.6" }, "devDependencies": { "@electron/notarize": "^2.1.0", @@ -2729,6 +2729,17 @@ "ethereumjs-util": "^7.1.1" } }, + "node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@ethereumjs/tx": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.2.tgz", @@ -2738,6 +2749,19 @@ "ethereumjs-util": "^7.1.2" } }, + "node_modules/@ethereumjs/util": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", + "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", + "dependencies": { + "@ethereumjs/rlp": "^4.0.1", + "ethereum-cryptography": "^2.0.0", + "micro-ftch": "^0.3.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@ethersproject/abi": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", @@ -3544,6 +3568,17 @@ "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==", "dev": true }, + "node_modules/@noble/curves": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", + "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", + "dependencies": { + "@noble/hashes": "1.3.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/hashes": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", @@ -3836,6 +3871,39 @@ "integrity": "sha512-cEjvTPU32OM9lUFegJagO0mRnIn+rbqrG89vV8/xLnLFX0DoR0r1oy5IlTga71Q7uT3Qus7qm7wgeiMT/+Irlg==", "dev": true }, + "node_modules/@scure/base": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz", + "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", + "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", + "dependencies": { + "@noble/curves": "~1.1.0", + "@noble/hashes": "~1.3.1", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "dependencies": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -4998,6 +5066,24 @@ "web3-utils": "^1.2.1" } }, + "node_modules/abi-decoder/node_modules/web3-utils": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.2.tgz", + "integrity": "sha512-TdApdzdse5YR+5GCX/b/vQnhhbj1KSAtfrDtRW7YS0kcWp1gkJsN62gw6GzCaNTeXookB7UrLtmDUuMv65qgow==", + "dependencies": { + "@ethereumjs/util": "^8.1.0", + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereum-cryptography": "^2.1.2", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/abortcontroller-polyfill": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", @@ -8479,6 +8565,17 @@ "js-sha3": "^0.8.0" } }, + "node_modules/ethereum-cryptography": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz", + "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" + } + }, "node_modules/ethereumjs-util": { "version": "7.1.5", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", @@ -10913,6 +11010,11 @@ "resolved": "https://registry.npmjs.org/merkle-lib/-/merkle-lib-2.0.10.tgz", "integrity": "sha512-XrNQvUbn1DL5hKNe46Ccs+Tu3/PYOlrcZILuGUhb95oKBPjc/nmIC8D462PQkipVDGKRvwhn+QFg2cCdIvmDJA==" }, + "node_modules/micro-ftch": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", + "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==" + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -15130,6 +15232,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-core-helpers/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-core-method": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.10.0.tgz", @@ -15145,6 +15264,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-core-method/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-core-promievent": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.10.0.tgz", @@ -15188,6 +15324,35 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" }, + "node_modules/web3-core/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-errors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.1.2.tgz", + "integrity": "sha512-qlyuV5r6MzjLasIalVWBIIfW4Y7hBX2bZv8TRnXvI1EjiZ36zIFKgE9RF+/iRBjXmOsvIUQQ2Z9gMvYGfOwUwQ==", + "dependencies": { + "web3-types": "^1.2.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, "node_modules/web3-eth": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.10.0.tgz", @@ -15222,6 +15387,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-eth-abi/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-eth-accounts": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.10.0.tgz", @@ -15242,6 +15424,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-eth-accounts/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-eth-contract": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.10.0.tgz", @@ -15260,6 +15459,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-eth-contract/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-eth-ens": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.10.0.tgz", @@ -15278,6 +15494,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-eth-ens/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-eth-iban": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.10.0.tgz", @@ -15290,6 +15523,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-eth-iban/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-eth-personal": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.10.0.tgz", @@ -15311,6 +15561,40 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" }, + "node_modules/web3-eth-personal/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-eth/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-net": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.10.0.tgz", @@ -15324,6 +15608,23 @@ "node": ">=8.0.0" } }, + "node_modules/web3-net/node_modules/web3-utils": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", + "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "dependencies": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/web3-providers-http": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.10.0.tgz", @@ -15363,21 +15664,44 @@ "node": ">=8.0.0" } }, + "node_modules/web3-types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.2.0.tgz", + "integrity": "sha512-ljx8mrkrOI8fRqvgOdxfpKYoso6n7I8T9LsqXl+Mz2Db0L+2H15an0xgdoWYpKndTPiU2NKRWFiopYifBQzcxQ==", + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, "node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.0.6.tgz", + "integrity": "sha512-nLVtMf9mWTX604XiQQkWZlHLCag9GdHfQtnGJDNaDssTLUx5SpOm1CjhKCHcVcAH/QazEsWcLqUAuyqwKST1kA==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "ethereum-cryptography": "^2.0.0", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-validator": "^2.0.2" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-validator": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.2.tgz", + "integrity": "sha512-9sQ5owd2UldTsva3o3htj2fTPpbmUwb4TfBXhjIkew8FyT0ss3DPI+j3p6XrfdxIVBEQ5r17YUakElDV99aW+A==", + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "util": "^0.12.5", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "zod": "^3.21.4" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/webidl-conversions": { @@ -16248,6 +16572,14 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zod": { + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } } } diff --git a/package.json b/package.json index 259e6b845..3499db5de 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "vuex": "^4.1.0", "vuex-persist": "^3.1.3", "web3-eth": "^1.9.0", - "web3-utils": "^1.9.0" + "web3-utils": "^4.0.6" }, "devDependencies": { "@electron/notarize": "^2.1.0", diff --git a/src/lib/eth-utils.js b/src/lib/eth-utils.js index ca10f5bd6..f5f9c9696 100644 --- a/src/lib/eth-utils.js +++ b/src/lib/eth-utils.js @@ -1,5 +1,5 @@ import hdkey from 'hdkey' -import web3Utils from 'web3-utils' +import * as web3Utils from 'web3-utils' import BigNumber from 'bignumber.js' import cache from '@/store/cache.js' From b65a53c9f0fbf2a0c3363a4b720d81ecb08261a8 Mon Sep 17 00:00:00 2001 From: bludnic Date: Sat, 14 Oct 2023 04:47:04 +0100 Subject: [PATCH 03/12] feat(`web3-eth`): upgrade from v1 -> v4 --- package-lock.json | 1039 ++++++--------------------------------------- package.json | 2 +- 2 files changed, 140 insertions(+), 901 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6cad81495..b9f61dd7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,7 +70,7 @@ "vuetify": "^3.3.17", "vuex": "^4.1.0", "vuex-persist": "^3.1.3", - "web3-eth": "^1.9.0", + "web3-eth": "^4.2.0", "web3-utils": "^4.0.6" }, "devDependencies": { @@ -2720,15 +2720,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@ethereumjs/common": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.5.0.tgz", - "integrity": "sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg==", - "dependencies": { - "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.1" - } - }, "node_modules/@ethereumjs/rlp": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", @@ -2740,15 +2731,6 @@ "node": ">=14" } }, - "node_modules/@ethereumjs/tx": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.2.tgz", - "integrity": "sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog==", - "dependencies": { - "@ethereumjs/common": "^2.5.0", - "ethereumjs-util": "^7.1.2" - } - }, "node_modules/@ethereumjs/util": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", @@ -4242,6 +4224,14 @@ "dev": true, "optional": true }, + "node_modules/@types/ws": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", + "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", @@ -5084,11 +5074,6 @@ "node": ">=8.0.0" } }, - "node_modules/abortcontroller-polyfill": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", - "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==" - }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -6045,11 +6030,6 @@ "resolved": "https://registry.npmjs.org/buffer-reverse/-/buffer-reverse-1.0.1.tgz", "integrity": "sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg==" }, - "node_modules/buffer-to-arraybuffer": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", - "integrity": "sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==" - }, "node_modules/buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -6060,6 +6040,8 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", "hasInstallScript": true, + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -6438,56 +6420,6 @@ "node": ">=8" } }, - "node_modules/cids": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", - "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "buffer": "^5.5.0", - "class-is": "^1.1.0", - "multibase": "~0.6.0", - "multicodec": "^1.0.0", - "multihashes": "~0.4.15" - }, - "engines": { - "node": ">=4.0.0", - "npm": ">=3.0.0" - } - }, - "node_modules/cids/node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/cids/node_modules/multicodec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", - "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "buffer": "^5.6.0", - "varint": "^5.0.0" - } - }, "node_modules/cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -6497,11 +6429,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/class-is": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", - "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" - }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -6835,16 +6762,6 @@ "node": "> 0.10" } }, - "node_modules/content-hash": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", - "integrity": "sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", - "dependencies": { - "cids": "^0.7.1", - "multicodec": "^0.5.5", - "multihashes": "^0.4.15" - } - }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -7062,15 +6979,6 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" }, - "node_modules/d": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", - "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", - "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, "node_modules/data-urls": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", @@ -7142,14 +7050,6 @@ "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", "dev": true }, - "node_modules/decode-uri-component": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", - "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", - "engines": { - "node": ">=0.10" - } - }, "node_modules/decompress-response": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", @@ -7589,11 +7489,6 @@ "node": ">=6.0.0" } }, - "node_modules/dom-walk": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", - "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" - }, "node_modules/domexception": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", @@ -8122,20 +8017,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es5-ext": { - "version": "0.10.62", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", - "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", - "hasInstallScript": true, - "dependencies": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "next-tick": "^1.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", @@ -8143,30 +8024,6 @@ "dev": true, "optional": true }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "node_modules/es6-symbol": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", - "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", - "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, "node_modules/esbuild": { "version": "0.18.15", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.15.tgz", @@ -8528,35 +8385,6 @@ "node": ">=0.10.0" } }, - "node_modules/eth-ens-namehash": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", - "integrity": "sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", - "dependencies": { - "idna-uts46-hx": "^2.3.1", - "js-sha3": "^0.5.7" - } - }, - "node_modules/eth-ens-namehash/node_modules/js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==" - }, - "node_modules/eth-lib": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", - "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", - "dependencies": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" - } - }, - "node_modules/eth-lib/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/ethereum-bloom-filters": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", @@ -8631,11 +8459,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" }, - "node_modules/eventemitter3": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", - "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==" - }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -8741,19 +8564,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/ext": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", - "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", - "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" - }, "node_modules/extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", @@ -9327,15 +9137,6 @@ "node": ">=10" } }, - "node_modules/global": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", - "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", - "dependencies": { - "min-document": "^2.19.0", - "process": "^0.11.10" - } - }, "node_modules/global-agent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz", @@ -9627,11 +9428,6 @@ "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, - "node_modules/http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==" - }, "node_modules/http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", @@ -9727,25 +9523,6 @@ "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==" }, - "node_modules/idna-uts46-hx": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", - "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", - "dependencies": { - "punycode": "2.1.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/idna-uts46-hx/node_modules/punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -10047,11 +9824,6 @@ "node": ">=8" } }, - "node_modules/is-function": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", - "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" - }, "node_modules/is-generator-function": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", @@ -10301,11 +10073,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" - }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", @@ -10399,6 +10166,14 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "peerDependencies": { + "ws": "*" + } + }, "node_modules/iterare": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", @@ -11089,18 +10864,11 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, "engines": { "node": ">=4" } }, - "node_modules/min-document": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", - "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", - "dependencies": { - "dom-walk": "^0.1.0" - } - }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -11206,91 +10974,6 @@ "integrity": "sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==", "dev": true }, - "node_modules/multibase": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", - "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - }, - "node_modules/multibase/node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/multicodec": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", - "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "varint": "^5.0.0" - } - }, - "node_modules/multihashes": { - "version": "0.4.21", - "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", - "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", - "dependencies": { - "buffer": "^5.5.0", - "multibase": "^0.7.0", - "varint": "^5.0.0" - } - }, - "node_modules/multihashes/node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/multihashes/node_modules/multibase": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", - "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", - "deprecated": "This module has been superseded by the multiformats module", - "dependencies": { - "base-x": "^3.0.8", - "buffer": "^5.5.0" - } - }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -11331,11 +11014,6 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "node_modules/next-tick": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", - "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" - }, "node_modules/nise": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.4.tgz", @@ -11541,14 +11219,6 @@ "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", "dev": true }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -11597,18 +11267,11 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/oboe": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.5.tgz", - "integrity": "sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", - "dependencies": { - "http-https": "^1.0.0" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -11777,11 +11440,6 @@ "safe-buffer": "^5.1.1" } }, - "node_modules/parse-headers": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", - "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" - }, "node_modules/parse5": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", @@ -12102,14 +11760,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -12342,19 +11992,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "dependencies": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", @@ -13322,46 +12959,6 @@ "resolved": "https://registry.npmjs.org/simple-audio/-/simple-audio-1.0.1.tgz", "integrity": "sha512-keHSGuWntr7+ZuH0+TyvRUILomgorQSeNmO3SmM5NJfApEr+x7cdmr72W+rYETXqeqnmMLXjdD3x6rU0rQC3mA==" }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/simple-get": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", - "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", - "dependencies": { - "decompress-response": "^3.3.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "node_modules/simple-get/node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/simple-update-notifier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", @@ -13597,14 +13194,6 @@ "xtend": "^4.0.2" } }, - "node_modules/strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -14054,14 +13643,6 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "node_modules/timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/tiny-secp256k1": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz", @@ -14240,11 +13821,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" }, - "node_modules/type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", - "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -14344,14 +13920,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, "node_modules/typeforce": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.18.0.tgz", @@ -14554,16 +14122,13 @@ "requires-port": "^1.0.0" } }, - "node_modules/url-set-query": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", - "integrity": "sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==" - }, "node_modules/utf-8-validate": { "version": "5.0.10", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "hasInstallScript": true, + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -14603,6 +14168,7 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" @@ -14619,11 +14185,6 @@ "node": ">= 0.10" } }, - "node_modules/varint": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", - "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" - }, "node_modules/varuint-bitcoin": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz", @@ -15204,141 +14765,24 @@ } }, "node_modules/web3-core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.10.0.tgz", - "integrity": "sha512-fWySwqy2hn3TL89w5TM8wXF1Z2Q6frQTKHWmP0ppRQorEK8NcHJRfeMiv/mQlSKoTS1F6n/nv2uyZsixFycjYQ==", - "dependencies": { - "@types/bn.js": "^5.1.1", - "@types/node": "^12.12.6", - "bignumber.js": "^9.0.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-requestmanager": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-helpers": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.10.0.tgz", - "integrity": "sha512-pIxAzFDS5vnbXvfvLSpaA1tfRykAe9adw43YCKsEYQwH0gCLL0kMLkaCX3q+Q8EVmAh+e1jWL/nl9U0de1+++g==", - "dependencies": { - "web3-eth-iban": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-helpers/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-method": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.10.0.tgz", - "integrity": "sha512-4R700jTLAMKDMhQ+nsVfIXvH6IGJlJzGisIfMKWAIswH31h5AZz7uDUW2YctI+HrYd+5uOAlS4OJeeT9bIpvkA==", - "dependencies": { - "@ethersproject/transactions": "^5.6.2", - "web3-core-helpers": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-method/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-promievent": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.10.0.tgz", - "integrity": "sha512-68N7k5LWL5R38xRaKFrTFT2pm2jBNFaM4GioS00YjAKXRQ3KjmhijOMG3TICz6Aa5+6GDWYelDNx21YAeZ4YTg==", - "dependencies": { - "eventemitter3": "4.0.4" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-requestmanager": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.10.0.tgz", - "integrity": "sha512-3z/JKE++Os62APml4dvBM+GAuId4h3L9ckUrj7ebEtS2AR0ixyQPbrBodgL91Sv7j7cQ3Y+hllaluqjguxvSaQ==", - "dependencies": { - "util": "^0.12.5", - "web3-core-helpers": "1.10.0", - "web3-providers-http": "1.10.0", - "web3-providers-ipc": "1.10.0", - "web3-providers-ws": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core-subscriptions": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.10.0.tgz", - "integrity": "sha512-HGm1PbDqsxejI075gxBc5OSkwymilRWZufIy9zEpnWKNmfbuv5FfHgW1/chtJP6aP3Uq2vHkvTDl3smQBb8l+g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.2.0.tgz", + "integrity": "sha512-pkZJx3HAY3b3CutaFarODFgK3TDvcXC4T0n8cpvwiZjDzakUUFAssVUDwrmFyCFKAo5kmfs6qWFW7BAZLJeBFA==", "dependencies": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.10.0" + "web3-errors": "^1.1.2", + "web3-eth-iban": "^4.0.6", + "web3-providers-http": "^4.0.6", + "web3-providers-ws": "^4.0.6", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6", + "web3-validator": "^2.0.2" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-core/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "node_modules/web3-core/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "node": ">=14", + "npm": ">=6.12.0" }, - "engines": { - "node": ">=8.0.0" + "optionalDependencies": { + "web3-providers-ipc": "^4.0.6" } }, "node_modules/web3-errors": { @@ -15354,25 +14798,25 @@ } }, "node_modules/web3-eth": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.10.0.tgz", - "integrity": "sha512-Z5vT6slNMLPKuwRyKGbqeGYC87OAy8bOblaqRTgg94CXcn/mmqU7iPIlG4506YdcdK3x6cfEDG7B6w+jRxypKA==", - "dependencies": { - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-eth-accounts": "1.10.0", - "web3-eth-contract": "1.10.0", - "web3-eth-ens": "1.10.0", - "web3-eth-iban": "1.10.0", - "web3-eth-personal": "1.10.0", - "web3-net": "1.10.0", - "web3-utils": "1.10.0" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.2.0.tgz", + "integrity": "sha512-8YUEp5bq8j6KzlWpf856e0ZTXSNgJEYPg1gzzrmFC2+l0cjbul7vHnLA7DAsQGrIvXvvHvRp8da/8Ogm+G6FYQ==", + "dependencies": { + "setimmediate": "^1.0.5", + "web3-core": "^4.2.0", + "web3-errors": "^1.1.2", + "web3-eth-abi": "^4.1.2", + "web3-eth-accounts": "^4.0.6", + "web3-net": "^4.0.6", + "web3-providers-ws": "^4.0.6", + "web3-rpc-methods": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6", + "web3-validator": "^2.0.2" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-eth-abi": { @@ -15405,263 +14849,128 @@ } }, "node_modules/web3-eth-accounts": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.10.0.tgz", - "integrity": "sha512-wiq39Uc3mOI8rw24wE2n15hboLE0E9BsQLdlmsL4Zua9diDS6B5abXG0XhFcoNsXIGMWXVZz4TOq3u4EdpXF/Q==", - "dependencies": { - "@ethereumjs/common": "2.5.0", - "@ethereumjs/tx": "3.3.2", - "eth-lib": "0.2.8", - "ethereumjs-util": "^7.1.5", - "scrypt-js": "^3.0.1", - "uuid": "^9.0.0", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-accounts/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-contract": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.10.0.tgz", - "integrity": "sha512-MIC5FOzP/+2evDksQQ/dpcXhSqa/2hFNytdl/x61IeWxhh6vlFeSjq0YVTAyIzdjwnL7nEmZpjfI6y6/Ufhy7w==", - "dependencies": { - "@types/bn.js": "^5.1.1", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-core-subscriptions": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-contract/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-ens": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.10.0.tgz", - "integrity": "sha512-3hpGgzX3qjgxNAmqdrC2YUQMTfnZbs4GeLEmy8aCWziVwogbuqQZ+Gzdfrym45eOZodk+lmXyLuAdqkNlvkc1g==", - "dependencies": { - "content-hash": "^2.5.2", - "eth-ens-namehash": "2.0.8", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-promievent": "1.10.0", - "web3-eth-abi": "1.10.0", - "web3-eth-contract": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-ens/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.0.6.tgz", + "integrity": "sha512-xkOXXAEZs2CcR2v33CvFwtGJQS05ye7c3dlXcqwre91fhah9e6u4CPztpyR7HIKegWfIG1DRUwrcEqM2EMo4/w==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "@ethereumjs/rlp": "^4.0.1", + "crc-32": "^1.2.2", + "ethereum-cryptography": "^2.0.0", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6", + "web3-validator": "^2.0.2" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-eth-iban": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.10.0.tgz", - "integrity": "sha512-0l+SP3IGhInw7Q20LY3IVafYEuufo4Dn75jAHT7c2aDJsIolvf2Lc6ugHkBajlwUneGfbRQs/ccYPQ9JeMUbrg==", - "dependencies": { - "bn.js": "^5.2.1", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-iban/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", - "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-personal": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.10.0.tgz", - "integrity": "sha512-anseKn98w/d703eWq52uNuZi7GhQeVjTC5/svrBWEKob0WZ5kPdo+EZoFN0sp5a5ubbrk/E0xSl1/M5yORMtpg==", - "dependencies": { - "@types/node": "^12.12.6", - "web3-core": "1.10.0", - "web3-core-helpers": "1.10.0", - "web3-core-method": "1.10.0", - "web3-net": "1.10.0", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-personal/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" - }, - "node_modules/web3-eth-personal/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.6.tgz", + "integrity": "sha512-q47MbmoYWdfoylHlKZkZRHiPYeiFWqRiHou/wTYJEeZa2D3NG0wuPWz3jeQdZ5NzmS85yh+p2hxa54azVT8qmw==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6", + "web3-validator": "^2.0.2" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-eth/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "node_modules/web3-eth/node_modules/web3-eth-abi": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.1.2.tgz", + "integrity": "sha512-s8gvjUwzb2ZnAef0Jy68pjmeshYIKBoYlVj/1yuuFP9t3io3oQQIEyGlaCx7P4ifsZ186gMa4QjCCeIt7HYm7Q==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "@ethersproject/abi": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-net": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.10.0.tgz", - "integrity": "sha512-NLH/N3IshYWASpxk4/18Ge6n60GEvWBVeM8inx2dmZJVmRI6SJIlUxbL8jySgiTn3MMZlhbdvrGo8fpUW7a1GA==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.0.6.tgz", + "integrity": "sha512-Th4AtgpBgMdt76PmYyNBQxwAd2hAR8hIjhU4xjhqk1JATlXpcfgzyhegeAsvnSht4tcLnVQt6SN4ZVccllpd4A==", "dependencies": { - "web3-core": "1.10.0", - "web3-core-method": "1.10.0", - "web3-utils": "1.10.0" + "web3-core": "^4.2.0", + "web3-rpc-methods": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-net/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "node_modules/web3-providers-http": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.0.6.tgz", + "integrity": "sha512-FnBw0X25Xu0FejOgY2Ra7WY4p3fSrHxZuQ5a4j0ytDCE+0wxKQN0BaLRC7+uigbVvwEziQwzrhe+tn8bYAQKXQ==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "cross-fetch": "^3.1.5", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-providers-http": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.10.0.tgz", - "integrity": "sha512-eNr965YB8a9mLiNrkjAWNAPXgmQWfpBfkkn7tpEFlghfww0u3I0tktMZiaToJVcL2+Xq+81cxbkpeWJ5XQDwOA==", + "node_modules/web3-providers-ipc": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-4.0.6.tgz", + "integrity": "sha512-17Ky978qGgdSWtctc/WKj9kX+QUypk6arZLI/Rfmq4zQpoR5ngH38CGozRkXUonr9hITYNaLW82NB1SPi1pRPQ==", + "optional": true, "dependencies": { - "abortcontroller-polyfill": "^1.7.3", - "cross-fetch": "^3.1.4", - "es6-promise": "^4.2.8", - "web3-core-helpers": "1.10.0" + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-providers-ipc": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.10.0.tgz", - "integrity": "sha512-OfXG1aWN8L1OUqppshzq8YISkWrYHaATW9H8eh0p89TlWMc1KZOL9vttBuaBEi96D/n0eYDn2trzt22bqHWfXA==", + "node_modules/web3-providers-ws": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.6.tgz", + "integrity": "sha512-0Q0SuKpr05gK+tUXdzPNmYlDV3exdqxnHx3f8p3cqz+v66J04EOT31bbETS0VcpDiQ9YaVS8FVSjT4PaseuNag==", "dependencies": { - "oboe": "2.1.5", - "web3-core-helpers": "1.10.0" + "@types/ws": "8.5.3", + "isomorphic-ws": "^5.0.0", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6", + "ws": "^8.8.1" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, - "node_modules/web3-providers-ws": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.10.0.tgz", - "integrity": "sha512-sK0fNcglW36yD5xjnjtSGBnEtf59cbw4vZzJ+CmOWIKGIR96mP5l684g0WD0Eo+f4NQc2anWWXG74lRc9OVMCQ==", + "node_modules/web3-rpc-methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.1.2.tgz", + "integrity": "sha512-fzYp9eJyzq/UBzpP9kOQormelLfvl1kJnX5ucHv4T6kZaQfDuBt5XoYDtCDXSXVaz2MgTowsXwKEVAzN6h7+Ag==", "dependencies": { - "eventemitter3": "4.0.4", - "web3-core-helpers": "1.10.0", - "websocket": "^1.0.32" + "web3-core": "^4.2.0", + "web3-types": "^1.2.0", + "web3-validator": "^2.0.2" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-types": { @@ -15778,35 +15087,6 @@ "dev": true, "peer": true }, - "node_modules/websocket": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", - "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", - "dependencies": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/websocket/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/websocket/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, "node_modules/whatwg-encoding": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", @@ -16400,13 +15680,13 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/ws": { "version": "8.13.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dev": true, "engines": { "node": ">=10.0.0" }, @@ -16423,39 +15703,6 @@ } } }, - "node_modules/xhr": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", - "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", - "dependencies": { - "global": "~4.4.0", - "is-function": "^1.0.1", - "parse-headers": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "node_modules/xhr-request": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", - "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", - "dependencies": { - "buffer-to-arraybuffer": "^0.0.5", - "object-assign": "^4.1.1", - "query-string": "^5.0.1", - "simple-get": "^2.7.0", - "timed-out": "^4.0.1", - "url-set-query": "^1.0.0", - "xhr": "^2.0.4" - } - }, - "node_modules/xhr-request-promise": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", - "integrity": "sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", - "dependencies": { - "xhr-request": "^1.1.0" - } - }, "node_modules/xml-name-validator": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", @@ -16505,14 +15752,6 @@ "node": ">=10" } }, - "node_modules/yaeti": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", - "engines": { - "node": ">=0.10.32" - } - }, "node_modules/yaku": { "version": "0.16.7", "resolved": "https://registry.npmjs.org/yaku/-/yaku-0.16.7.tgz", diff --git a/package.json b/package.json index 3499db5de..047d0bba9 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "vuetify": "^3.3.17", "vuex": "^4.1.0", "vuex-persist": "^3.1.3", - "web3-eth": "^1.9.0", + "web3-eth": "^4.2.0", "web3-utils": "^4.0.6" }, "devDependencies": { From 18c24c74a4e5b728f4590949777797368239b130 Mon Sep 17 00:00:00 2001 From: bludnic Date: Sat, 14 Oct 2023 04:48:45 +0100 Subject: [PATCH 04/12] feat(`eth-utils`): fix failed test --- package-lock.json | 1 + package.json | 1 + src/lib/eth-utils.js | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index b9f61dd7f..6886398fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -71,6 +71,7 @@ "vuex": "^4.1.0", "vuex-persist": "^3.1.3", "web3-eth": "^4.2.0", + "web3-eth-accounts": "^4.0.6", "web3-utils": "^4.0.6" }, "devDependencies": { diff --git a/package.json b/package.json index 047d0bba9..9de99f922 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "vuex": "^4.1.0", "vuex-persist": "^3.1.3", "web3-eth": "^4.2.0", + "web3-eth-accounts": "^4.0.6", "web3-utils": "^4.0.6" }, "devDependencies": { diff --git a/src/lib/eth-utils.js b/src/lib/eth-utils.js index f5f9c9696..4ae80a7cb 100644 --- a/src/lib/eth-utils.js +++ b/src/lib/eth-utils.js @@ -1,5 +1,6 @@ import hdkey from 'hdkey' import * as web3Utils from 'web3-utils' +import { privateKeyToAccount } from 'web3-eth-accounts' import BigNumber from 'bignumber.js' import cache from '@/store/cache.js' @@ -33,7 +34,7 @@ export function getAccountFromPassphrase(passphrase, api) { hdkey.fromMasterSeed(seed).derive(HD_KEY_PATH)._privateKey ) // web3Account is for user wallet; We don't need it, when exporting a private key - const web3Account = api ? api.accounts.privateKeyToAccount(privateKey) : undefined + const web3Account = api ? privateKeyToAccount(privateKey) : undefined return { web3Account, From 59db8b951729432756d36f97ef795665b1d94abf Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 17 Oct 2023 03:43:07 +0100 Subject: [PATCH 05/12] chore(store): upgrade `web3-eth` api refactor(`eth-utils`): remove `BatchQueue` (https://github.com/web3/web3.js/issues/6224) --- package-lock.json | 35 ++++ package.json | 1 + src/lib/eth-utils.js | 35 ---- src/store/modules/erc20/erc20-actions.js | 19 +- .../modules/eth-base/eth-base-actions.js | 193 ++++++++---------- src/store/modules/eth/actions.js | 57 +++--- 6 files changed, 162 insertions(+), 178 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6886398fb..a4da5594e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,6 +72,7 @@ "vuex-persist": "^3.1.3", "web3-eth": "^4.2.0", "web3-eth-accounts": "^4.0.6", + "web3-eth-contract": "^4.1.0", "web3-utils": "^4.0.6" }, "devDependencies": { @@ -14867,6 +14868,40 @@ "npm": ">=6.12.0" } }, + "node_modules/web3-eth-contract": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.1.0.tgz", + "integrity": "sha512-e1eEXSwzNUaC5j0WWDqQ527fPFtIswoJZ/cov8mWvTQi3+dqyI590/6s7IF6A5CGew1RrewAqPMrR9m7WQt7hw==", + "dependencies": { + "web3-core": "^4.2.0", + "web3-errors": "^1.1.2", + "web3-eth": "^4.2.0", + "web3-eth-abi": "^4.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6", + "web3-validator": "^2.0.2" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-contract/node_modules/web3-eth-abi": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.1.2.tgz", + "integrity": "sha512-s8gvjUwzb2ZnAef0Jy68pjmeshYIKBoYlVj/1yuuFP9t3io3oQQIEyGlaCx7P4ifsZ186gMa4QjCCeIt7HYm7Q==", + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "web3-errors": "^1.1.2", + "web3-types": "^1.2.0", + "web3-utils": "^4.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, "node_modules/web3-eth-iban": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.6.tgz", diff --git a/package.json b/package.json index 9de99f922..fd1be2bbd 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "vuex-persist": "^3.1.3", "web3-eth": "^4.2.0", "web3-eth-accounts": "^4.0.6", + "web3-eth-contract": "^4.1.0", "web3-utils": "^4.0.6" }, "devDependencies": { diff --git a/src/lib/eth-utils.js b/src/lib/eth-utils.js index 4ae80a7cb..ff4933cae 100644 --- a/src/lib/eth-utils.js +++ b/src/lib/eth-utils.js @@ -106,38 +106,3 @@ export function toFraction(amount, decimals, separator = '.') { return whole + (fraction ? separator + fraction : '') } - -export class BatchQueue { - constructor(createBatchRequest) { - this._createBatchRequest = createBatchRequest - this._queue = [] - this._timer = null - } - - enqueue(key, supplier) { - if (typeof supplier !== 'function') return - if (this._queue.some((x) => x.key === key)) return - - const requests = supplier() - this._queue.push({ key, requests: Array.isArray(requests) ? requests : [requests] }) - } - - start() { - this.stop() - this._timer = setInterval(() => this._execute(), 2000) - } - - stop() { - clearInterval(this._timer) - } - - _execute() { - const requests = this._queue.splice(0, 20) - if (!requests.length) return - - const batch = this._createBatchRequest() - requests.forEach((x) => x.requests.forEach((r) => batch.add(r))) - - batch.execute() - } -} diff --git a/src/store/modules/erc20/erc20-actions.js b/src/store/modules/erc20/erc20-actions.js index bf3eec025..9dc1366f1 100644 --- a/src/store/modules/erc20/erc20-actions.js +++ b/src/store/modules/erc20/erc20-actions.js @@ -2,8 +2,10 @@ import abiDecoder from 'abi-decoder' import * as ethUtils from '../../../lib/eth-utils' import { FetchStatus, INCREASE_FEE_MULTIPLIER } from '@/lib/constants' +import EthContract from 'web3-eth-contract' import Erc20 from './erc20.abi.json' import createActions from '../eth-base/eth-base-actions' +import getEndpointUrl from '@/lib/getEndpointUrl' /** Timestamp of the most recent status update */ let lastStatusUpdate = 0 @@ -14,7 +16,7 @@ const STATUS_INTERVAL = 25000 abiDecoder.addABI(Erc20) const initTransaction = (api, context, ethAddress, amount, increaseFee) => { - const contract = new api.Contract(Erc20, context.state.contractAddress) + const contract = new EthContract(Erc20, context.state.contractAddress) const transaction = { from: context.state.address, @@ -52,17 +54,17 @@ const parseTransaction = (context, tx) => { // Why comparing to eth.actions, there is no fee and status? hash: tx.hash, senderId: tx.from, - blockNumber: tx.blockNumber, + blockNumber: Number(tx.blockNumber), amount, recipientId, - gasPrice: +(tx.gasPrice || tx.effectiveGasPrice) + gasPrice: Number(tx.gasPrice || tx.effectiveGasPrice) } } return null } -const createSpecificActions = (api, queue) => ({ +const createSpecificActions = (api) => ({ updateBalance: { root: true, async handler({ state, commit }, payload = {}) { @@ -71,7 +73,9 @@ const createSpecificActions = (api, queue) => ({ } try { - const contract = new api.Contract(Erc20, state.contractAddress) + const contract = new EthContract(Erc20, state.contractAddress) + const endpoint = getEndpointUrl('ETH') + contract.setProvider(endpoint) const rawBalance = await contract.methods.balanceOf(state.address).call() const balance = Number(ethUtils.toFraction(rawBalance, state.decimals)) @@ -88,7 +92,10 @@ const createSpecificActions = (api, queue) => ({ updateStatus(context) { if (!context.state.address) return - const contract = new api.Contract(Erc20, context.state.contractAddress) + const contract = new EthContract(Erc20, context.state.contractAddress) + const endpoint = getEndpointUrl('ETH') + contract.setProvider(endpoint) + contract.methods .balanceOf(context.state.address) .call() diff --git a/src/store/modules/eth-base/eth-base-actions.js b/src/store/modules/eth-base/eth-base-actions.js index 734facfe1..60d298907 100644 --- a/src/store/modules/eth-base/eth-base-actions.js +++ b/src/store/modules/eth-base/eth-base-actions.js @@ -1,4 +1,5 @@ import Web3Eth from 'web3-eth' +import BigNumber from 'bignumber.js' import getEndpointUrl from '../../../lib/getEndpointUrl' import * as utils from '../../../lib/eth-utils' @@ -13,12 +14,11 @@ const CHUNK_SIZE = 25 export default function createActions(config) { const endpoint = getEndpointUrl('ETH') const api = new Web3Eth(endpoint) - const queue = new utils.BatchQueue(() => new api.BatchRequest()) const { onInit = () => {}, initTransaction, parseTransaction, createSpecificActions } = config return { - ...createSpecificActions(api, queue), + ...createSpecificActions(api), /** * Handles `afterLogin` action: generates ETH-account and requests its balance. @@ -29,7 +29,6 @@ export default function createActions(config) { const account = utils.getAccountFromPassphrase(passphrase, api) context.commit('account', account) context.dispatch('updateStatus') - queue.start() onInit(context) } @@ -39,7 +38,6 @@ export default function createActions(config) { reset: { root: true, handler(context) { - queue.stop() context.commit('reset') } }, @@ -58,8 +56,6 @@ export default function createActions(config) { } context.dispatch('updateStatus') - - queue.start() } }, @@ -170,19 +166,17 @@ export default function createActions(config) { const transaction = context.state.transactions[payload.hash] if (!transaction) return - const supplier = () => - api.getBlock.request(payload.blockNumber, (err, block) => { - if (!err && block) { - context.commit('transactions', [ - { - hash: transaction.hash, - timestamp: block.timestamp * 1000 - } - ]) - } - }) + void api.getBlock(payload.blockNumber).then((block) => { + // Converting from BigInt into Number must be safe + const timestamp = BigNumber(block.timestamp.toString()).multipliedBy(1000).toNumber() - queue.enqueue('block:' + payload.blockNumber, supplier) + context.commit('transactions', [ + { + hash: transaction.hash, + timestamp + } + ]) + }) }, /** @@ -207,60 +201,56 @@ export default function createActions(config) { ]) } - const key = 'transaction:' + payload.hash - const supplier = () => - api.getTransaction.request(payload.hash, (err, tx) => { - if (!err && tx && tx.input) { - const transaction = parseTransaction(context, tx) - const status = existing ? existing.status : 'REGISTERED' - if (transaction) { - context.commit('transactions', [ - { - ...transaction, - status - } - ]) - // Fetch receipt details: status and actual gas consumption - const { attempt, ...receiptPayload } = payload - context.dispatch('getTransactionReceipt', receiptPayload) - // Now we know that the transaction has been registered by the ETH network. - // Nothing else to do here, let's proceed to checking its status (see getTransactionReceipt) - return - } + void api.getTransaction(payload.hash).then((tx) => { + if (tx && tx.input) { + const transaction = parseTransaction(context, tx) + const status = existing ? existing.status : 'REGISTERED' + if (transaction) { + context.commit('transactions', [ + { + ...transaction, + status + } + ]) + // Fetch receipt details: status and actual gas consumption + const { attempt, ...receiptPayload } = payload + context.dispatch('getTransactionReceipt', receiptPayload) + // Now we know that the transaction has been registered by the ETH network. + // Nothing else to do here, let's proceed to checking its status (see getTransactionReceipt) + return } + } - const attempt = payload.attempt || 0 - const retryCount = tf.getPendingTxRetryCount( - payload.timestamp || (existing && existing.timestamp), - context.state.crypto - ) - const retry = attempt < retryCount - const retryTimeout = tf.getPendingTxRetryTimeout( - payload.timestamp || (existing && existing.timestamp), - context.state.crypto - ) - - if (!retry) { - // Give up, if transaction could not be found after so many attempts - context.commit('transactions', [{ hash: payload.hash, status: 'REJECTED' }]) - } else if (!payload.updateOnly) { - // In case of an error or a pending transaction fetch its details once again later - // Increment attempt counter, if no transaction was found so far - const newPayload = tx - ? payload - : { - ...payload, - attempt: attempt + 1, - force: true, - updateOnly: false, - dropStatus: false - } - - setTimeout(() => context.dispatch('getTransaction', newPayload), retryTimeout) - } - }) + const attempt = payload.attempt || 0 + const retryCount = tf.getPendingTxRetryCount( + payload.timestamp || (existing && existing.timestamp), + context.state.crypto + ) + const retry = attempt < retryCount + const retryTimeout = tf.getPendingTxRetryTimeout( + payload.timestamp || (existing && existing.timestamp), + context.state.crypto + ) + + if (!retry) { + // Give up, if transaction could not be found after so many attempts + context.commit('transactions', [{ hash: payload.hash, status: 'REJECTED' }]) + } else if (!payload.updateOnly) { + // In case of an error or a pending transaction fetch its details once again later + // Increment attempt counter, if no transaction was found so far + const newPayload = tx + ? payload + : { + ...payload, + attempt: attempt + 1, + force: true, + updateOnly: false, + dropStatus: false + } - queue.enqueue(key, supplier) + setTimeout(() => context.dispatch('getTransaction', newPayload), retryTimeout) + } + }) }, /** @@ -274,47 +264,44 @@ export default function createActions(config) { const gasPrice = transaction.gasPrice - const supplier = () => - api.getTransactionReceipt.request(payload.hash, (err, tx) => { - let replay = true - - if (!err && tx) { - const update = { - hash: payload.hash, - fee: utils.calculateFee(tx.gasUsed, gasPrice) - } + void api.getTransactionReceipt(payload.hash).then((tx) => { + let replay = true - if (Number(tx.status) === 0) { - // Status "0x0" means that the transaction has been rejected - update.status = 'REJECTED' - } else if (tx.blockNumber) { - // If blockNumber is not null, the transaction is confirmed - update.status = 'CONFIRMED' - update.blockNumber = tx.blockNumber - } + if (tx) { + const update = { + hash: payload.hash, + fee: utils.calculateFee(tx.gasUsed, gasPrice) + } - context.commit('transactions', [update]) + if (Number(tx.status) === 0) { + // Status "0x0" means that the transaction has been rejected + update.status = 'REJECTED' + } else if (tx.blockNumber) { + // If blockNumber is not null, the transaction is confirmed + update.status = 'CONFIRMED' + update.blockNumber = Number(tx.blockNumber) + } - if (tx.blockNumber) { - context.dispatch('getBlock', { - ...payload, - blockNumber: tx.blockNumber - }) - } + context.commit('transactions', [update]) - // Re-fetch tx details if it's status is still unknown - replay = !update.status + if (tx.blockNumber) { + context.dispatch('getBlock', { + ...payload, + blockNumber: Number(tx.blockNumber) + }) } - if (replay) { - // In case of an error or a pending transaction fetch its receipt once again later - // Increment attempt counter, if no transaction was found so far - const newPayload = { ...payload, attempt: 1 + (payload.attempt || 0) } - setTimeout(() => context.dispatch('getTransactionReceipt', newPayload), RETRY_TIMEOUT) - } - }) + // Re-fetch tx details if it's status is still unknown + replay = !update.status + } - queue.enqueue('transactionReceipt:' + payload.hash, supplier) + if (replay) { + // In case of an error or a pending transaction fetch its receipt once again later + // Increment attempt counter, if no transaction was found so far + const newPayload = { ...payload, attempt: 1 + (payload.attempt || 0) } + setTimeout(() => context.dispatch('getTransactionReceipt', newPayload), RETRY_TIMEOUT) + } + }) }, /** diff --git a/src/store/modules/eth/actions.js b/src/store/modules/eth/actions.js index 0065f087e..d87840c5f 100644 --- a/src/store/modules/eth/actions.js +++ b/src/store/modules/eth/actions.js @@ -1,7 +1,7 @@ import * as utils from '../../../lib/eth-utils' import createActions from '../eth-base/eth-base-actions' -import { DEFAULT_ETH_TRANSFER_GAS, FetchStatus, INCREASE_FEE_MULTIPLIER } from '@/lib/constants'; +import { DEFAULT_ETH_TRANSFER_GAS, FetchStatus, INCREASE_FEE_MULTIPLIER } from '@/lib/constants' import { storeCryptoAddress } from '@/lib/store-crypto-address' /** Timestamp of the most recent status update */ @@ -42,12 +42,12 @@ const parseTransaction = (context, tx) => { amount: utils.toEther(tx.value.toString(10)), fee: utils.calculateFee(tx.gas, (tx.gasPrice || tx.effectiveGasPrice).toString(10)), status: tx.blockNumber ? 'CONFIRMED' : 'PENDING', - blockNumber: tx.blockNumber, - gasPrice: +(tx.gasPrice || tx.effectiveGasPrice) + blockNumber: Number(tx.blockNumber), + gasPrice: Number(tx.gasPrice || tx.effectiveGasPrice) } } -const createSpecificActions = (api, queue) => ({ +const createSpecificActions = (api) => ({ updateBalance: { root: true, async handler({ state, commit }, payload = {}) { @@ -59,7 +59,7 @@ const createSpecificActions = (api, queue) => ({ const rawBalance = await api.getBalance(state.address, 'latest') const balance = Number(utils.toEther(rawBalance.toString())) - commit('balance', balance); + commit('balance', balance) commit('setBalanceStatus', FetchStatus.Success) } catch (err) { commit('setBalanceStatus', FetchStatus.Error) @@ -75,40 +75,29 @@ const createSpecificActions = (api, queue) => ({ updateStatus(context) { if (!context.state.address) return - const supplier = () => { - if (!context.state.address) return [] + // Balance + void api.getBalance(context.state.address, 'latest').then((balance) => { + context.commit('balance', Number(utils.toEther(balance.toString()))) + context.commit('setBalanceStatus', FetchStatus.Success) + }) - return [ - // Balance - api.getBalance.request(context.state.address, 'latest', (err, balance) => { - if (!err) { - context.commit('balance', Number(utils.toEther(balance.toString()))) - context.commit('setBalanceStatus', FetchStatus.Success) - } else { - context.commit('setBalanceStatus', FetchStatus.Error) - } - }), - // Current gas price - api.getGasPrice.request((err, price) => { - // It is OK with London hardfork - if (!err) { - context.commit('gasPrice', { - gasPrice: price, // string type - fee: +(+utils.calculateFee(DEFAULT_ETH_TRANSFER_GAS, price)).toFixed(8) // number type, in ETH - }) - } - }), - // Current block number - api.getBlockNumber.request((err, number) => { - if (!err) context.commit('blockNumber', number) - }) - ] - } + // Current gas price + void api.getGasPrice().then((price) => { + // It is OK with London hardfork + context.commit('gasPrice', { + gasPrice: price, // string type + fee: +(+utils.calculateFee(DEFAULT_ETH_TRANSFER_GAS, price)).toFixed(8) // number type, in ETH + }) + }) + + // Current block number + void api.getBlockNumber().then((number) => { + context.commit('blockNumber', Number(number)) + }) const delay = Math.max(0, STATUS_INTERVAL - Date.now() + lastStatusUpdate) setTimeout(() => { if (context.state.address) { - queue.enqueue('status', supplier) lastStatusUpdate = Date.now() context.dispatch('updateStatus') } From 4a4083fdcff0c828522929b55621fd39345b729a Mon Sep 17 00:00:00 2001 From: bludnic Date: Mon, 23 Oct 2023 17:23:38 +0100 Subject: [PATCH 06/12] chore: replace legacy `abi-decoder` dependency --- package-lock.json | 702 ++--------------------- package.json | 2 +- src/lib/abi/abi-decoder.ts | 213 +++++++ src/store/modules/erc20/erc20-actions.js | 3 +- 4 files changed, 255 insertions(+), 665 deletions(-) create mode 100644 src/lib/abi/abi-decoder.ts diff --git a/package-lock.json b/package-lock.json index a4da5594e..d62a79bab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,6 @@ "@stablelib/utf8": "^1.0.1", "@zxing/browser": "^0.1.4", "@zxing/library": "^0.20.0", - "abi-decoder": "^2.4.0", "assert": "^2.1.0", "axios": "^1.5.0", "b64-to-blob": "^1.2.19", @@ -71,6 +70,7 @@ "vuex": "^4.1.0", "vuex-persist": "^3.1.3", "web3-eth": "^4.2.0", + "web3-eth-abi": "^4.1.3", "web3-eth-accounts": "^4.0.6", "web3-eth-contract": "^4.1.0", "web3-utils": "^4.0.6" @@ -2733,393 +2733,6 @@ "node": ">=14" } }, - "node_modules/@ethereumjs/util": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", - "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", - "dependencies": { - "@ethereumjs/rlp": "^4.0.1", - "ethereum-cryptography": "^2.0.0", - "micro-ftch": "^0.3.1" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/abstract-provider": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", - "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0" - } - }, - "node_modules/@ethersproject/abstract-signer": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", - "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "node_modules/@ethersproject/address": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", - "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/rlp": "^5.7.0" - } - }, - "node_modules/@ethersproject/base64": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", - "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0" - } - }, - "node_modules/@ethersproject/bignumber": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", - "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "bn.js": "^5.2.1" - } - }, - "node_modules/@ethersproject/bytes": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", - "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/constants": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", - "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.7.0" - } - }, - "node_modules/@ethersproject/hash": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", - "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "js-sha3": "0.8.0" - } - }, - "node_modules/@ethersproject/logger": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ] - }, - "node_modules/@ethersproject/networks": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", - "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/properties": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", - "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/rlp": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", - "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/signing-key": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", - "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/strings": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", - "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/transactions": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", - "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0" - } - }, - "node_modules/@ethersproject/web": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", - "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", @@ -4002,14 +3615,6 @@ "node": ">= 10" } }, - "node_modules/@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/cacheable-request": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", @@ -4139,14 +3744,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.10.tgz", "integrity": "sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ==" }, - "node_modules/@types/pbkdf2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", - "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/plist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.2.tgz", @@ -4199,14 +3796,6 @@ "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", "dev": true }, - "node_modules/@types/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/semver": { "version": "7.5.2", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz", @@ -5049,31 +4638,18 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, - "node_modules/abi-decoder": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/abi-decoder/-/abi-decoder-2.4.0.tgz", - "integrity": "sha512-TOLU2q1HgYOjs1GKGtVzaqrYkar6I2fT9a80rzx6/9EJ/5crb4nCGuro0grZayixem93T7omrajYmLiMkYDLDA==", - "dependencies": { - "web3-eth-abi": "^1.2.1", - "web3-utils": "^1.2.1" - } - }, - "node_modules/abi-decoder/node_modules/web3-utils": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.2.tgz", - "integrity": "sha512-TdApdzdse5YR+5GCX/b/vQnhhbj1KSAtfrDtRW7YS0kcWp1gkJsN62gw6GzCaNTeXookB7UrLtmDUuMv65qgow==", - "dependencies": { - "@ethereumjs/util": "^8.1.0", - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereum-cryptography": "^2.1.2", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "node_modules/abitype": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", + "integrity": "sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==", + "peerDependencies": { + "typescript": ">=4.9.4", + "zod": "^3 >=3.19.1" }, - "engines": { - "node": ">=8.0.0" + "peerDependenciesMeta": { + "zod": { + "optional": true + } } }, "node_modules/acorn": { @@ -5791,11 +5367,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -8387,14 +7958,6 @@ "node": ">=0.10.0" } }, - "node_modules/ethereum-bloom-filters": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", - "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", - "dependencies": { - "js-sha3": "^0.8.0" - } - }, "node_modules/ethereum-cryptography": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz", @@ -8406,61 +7969,6 @@ "@scure/bip39": "1.2.1" } }, - "node_modules/ethereumjs-util": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", - "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", - "dependencies": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/ethereumjs-util/node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, - "node_modules/ethjs-unit": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", - "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", - "dependencies": { - "bn.js": "4.11.6", - "number-to-bn": "1.7.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/ethjs-unit/node_modules/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" - }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -9852,15 +9360,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -10257,11 +9756,6 @@ "resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.7.3.tgz", "integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==" }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -10486,20 +9980,6 @@ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, - "node_modules/keccak": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", - "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/keyv": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", @@ -10787,11 +10267,6 @@ "resolved": "https://registry.npmjs.org/merkle-lib/-/merkle-lib-2.0.10.tgz", "integrity": "sha512-XrNQvUbn1DL5hKNe46Ccs+Tu3/PYOlrcZILuGUhb95oKBPjc/nmIC8D462PQkipVDGKRvwhn+QFg2cCdIvmDJA==" }, - "node_modules/micro-ftch": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", - "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==" - }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -11197,24 +10672,6 @@ "webpack": "^4.0.0 || ^5.0.0" } }, - "node_modules/number-to-bn": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", - "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", - "dependencies": { - "bn.js": "4.11.6", - "strip-hex-prefix": "1.0.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/number-to-bn/node_modules/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" - }, "node_modules/nwsapi": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", @@ -12368,17 +11825,6 @@ "inherits": "^2.0.1" } }, - "node_modules/rlp": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", - "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", - "dependencies": { - "bn.js": "^5.2.0" - }, - "bin": { - "rlp": "bin/rlp" - } - }, "node_modules/roarr": { "version": "2.15.4", "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", @@ -12785,11 +12231,6 @@ "compute-scroll-into-view": "^3.0.2" } }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, "node_modules/secp256k1": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", @@ -13327,18 +12768,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", - "dependencies": { - "is-hex-prefixed": "1.0.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -13931,7 +13360,6 @@ "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", - "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -14138,11 +13566,6 @@ "node": ">=6.14.2" } }, - "node_modules/utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" - }, "node_modules/utf8-byte-length": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", @@ -14788,11 +14211,11 @@ } }, "node_modules/web3-errors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.1.2.tgz", - "integrity": "sha512-qlyuV5r6MzjLasIalVWBIIfW4Y7hBX2bZv8TRnXvI1EjiZ36zIFKgE9RF+/iRBjXmOsvIUQQ2Z9gMvYGfOwUwQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.1.3.tgz", + "integrity": "sha512-3GA4leG6XsKLmFWe62mIjVgW4GhkJmvd4IaRLgnKtNnqNmx6L9YWysYwgQ09BaD/NmhKN+AtalSVRds8gU+N0w==", "dependencies": { - "web3-types": "^1.2.0" + "web3-types": "^1.3.0" }, "engines": { "node": ">=14", @@ -14822,32 +14245,19 @@ } }, "node_modules/web3-eth-abi": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.10.0.tgz", - "integrity": "sha512-cwS+qRBWpJ43aI9L3JS88QYPfFcSJJ3XapxOQ4j40v6mk7ATpA8CVK1vGTzpihNlOfMVRBkR95oAj7oL6aiDOg==", - "dependencies": { - "@ethersproject/abi": "^5.6.3", - "web3-utils": "1.10.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/web3-eth-abi/node_modules/web3-utils": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.0.tgz", - "integrity": "sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.1.3.tgz", + "integrity": "sha512-iInBZFXWtmH3hC2dKZY6peO5QeprXj/SMZLDZXaiRk6ZYjKX07BpdnMAKniaguhi5OHz8HoFAqy3OGCH/k8x+g==", "dependencies": { - "bn.js": "^5.2.1", - "ethereum-bloom-filters": "^1.0.6", - "ethereumjs-util": "^7.1.0", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randombytes": "^2.1.0", - "utf8": "3.0.0" + "abitype": "0.7.1", + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" }, "engines": { - "node": ">=8.0.0" + "node": ">=14", + "npm": ">=6.12.0" } }, "node_modules/web3-eth-accounts": { @@ -14886,22 +14296,6 @@ "npm": ">=6.12.0" } }, - "node_modules/web3-eth-contract/node_modules/web3-eth-abi": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.1.2.tgz", - "integrity": "sha512-s8gvjUwzb2ZnAef0Jy68pjmeshYIKBoYlVj/1yuuFP9t3io3oQQIEyGlaCx7P4ifsZ186gMa4QjCCeIt7HYm7Q==", - "dependencies": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "web3-errors": "^1.1.2", - "web3-types": "^1.2.0", - "web3-utils": "^4.0.6" - }, - "engines": { - "node": ">=14", - "npm": ">=6.12.0" - } - }, "node_modules/web3-eth-iban": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.6.tgz", @@ -14917,22 +14311,6 @@ "npm": ">=6.12.0" } }, - "node_modules/web3-eth/node_modules/web3-eth-abi": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.1.2.tgz", - "integrity": "sha512-s8gvjUwzb2ZnAef0Jy68pjmeshYIKBoYlVj/1yuuFP9t3io3oQQIEyGlaCx7P4ifsZ186gMa4QjCCeIt7HYm7Q==", - "dependencies": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "web3-errors": "^1.1.2", - "web3-types": "^1.2.0", - "web3-utils": "^4.0.6" - }, - "engines": { - "node": ">=14", - "npm": ">=6.12.0" - } - }, "node_modules/web3-net": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.0.6.tgz", @@ -15010,23 +14388,23 @@ } }, "node_modules/web3-types": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.2.0.tgz", - "integrity": "sha512-ljx8mrkrOI8fRqvgOdxfpKYoso6n7I8T9LsqXl+Mz2Db0L+2H15an0xgdoWYpKndTPiU2NKRWFiopYifBQzcxQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.3.0.tgz", + "integrity": "sha512-ReRq6D0w6Mr6PkC8mtn6JwBgbVAobPFYNWFO994C7LzTNweYQegb0peri5KMpEHQm2iG2tQbiIyAAeseIohc2Q==", "engines": { "node": ">=14", "npm": ">=6.12.0" } }, "node_modules/web3-utils": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.0.6.tgz", - "integrity": "sha512-nLVtMf9mWTX604XiQQkWZlHLCag9GdHfQtnGJDNaDssTLUx5SpOm1CjhKCHcVcAH/QazEsWcLqUAuyqwKST1kA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.0.7.tgz", + "integrity": "sha512-sy8S6C2FIa5NNHc8DjND+Fx3S8KDAizuh5RbL1RX3h0PRbFgPfWzF5RfUns8gTt0mjJuOhs/IaDhrZfeTszG5A==", "dependencies": { "ethereum-cryptography": "^2.0.0", - "web3-errors": "^1.1.2", - "web3-types": "^1.2.0", - "web3-validator": "^2.0.2" + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-validator": "^2.0.3" }, "engines": { "node": ">=14", @@ -15034,14 +14412,14 @@ } }, "node_modules/web3-validator": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.2.tgz", - "integrity": "sha512-9sQ5owd2UldTsva3o3htj2fTPpbmUwb4TfBXhjIkew8FyT0ss3DPI+j3p6XrfdxIVBEQ5r17YUakElDV99aW+A==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.3.tgz", + "integrity": "sha512-fJbAQh+9LSNWy+l5Ze6HABreml8fra98o5+vS073T35jUcLbRZ0IOjF/ZPJhJNbJDt+jP1vseZsc3z3uX9mxxQ==", "dependencies": { "ethereum-cryptography": "^2.0.0", "util": "^0.12.5", - "web3-errors": "^1.1.2", - "web3-types": "^1.2.0", + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", "zod": "^3.21.4" }, "engines": { diff --git a/package.json b/package.json index fd1be2bbd..7c11d8070 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "@stablelib/utf8": "^1.0.1", "@zxing/browser": "^0.1.4", "@zxing/library": "^0.20.0", - "abi-decoder": "^2.4.0", "assert": "^2.1.0", "axios": "^1.5.0", "b64-to-blob": "^1.2.19", @@ -84,6 +83,7 @@ "vuex": "^4.1.0", "vuex-persist": "^3.1.3", "web3-eth": "^4.2.0", + "web3-eth-abi": "^4.1.3", "web3-eth-accounts": "^4.0.6", "web3-eth-contract": "^4.1.0", "web3-utils": "^4.0.6" diff --git a/src/lib/abi/abi-decoder.ts b/src/lib/abi/abi-decoder.ts new file mode 100644 index 000000000..fc2c454b1 --- /dev/null +++ b/src/lib/abi/abi-decoder.ts @@ -0,0 +1,213 @@ +import BigNumber from 'bignumber.js' +import { sha3 } from 'web3-utils' +import { decodeParameters } from 'web3-eth-abi' + +const state = { + savedABIs: [], + methodIDs: {}, + keepNonDecodedLogs: false +} + +function _getABIs() { + return state.savedABIs +} + +function _typeToString(input): string { + if (input.type === 'tuple') { + return '(' + input.components!.map(_typeToString).join(',') + ')' + } + return input.type +} + +function _addABI(abiArray) { + if (Array.isArray(abiArray)) { + // Iterate new abi to generate method id"s + abiArray.map(function (abi) { + if (abi.name) { + const signature = sha3(abi.name + '(' + abi.inputs.map(_typeToString).join(',') + ')') + if (abi.type === 'event') { + state.methodIDs[signature.slice(2)] = abi + } else { + state.methodIDs[signature.slice(2, 10)] = abi + } + } + }) + + state.savedABIs = state.savedABIs.concat(abiArray) + } else { + throw new Error('Expected ABI array, got ' + typeof abiArray) + } +} + +function _removeABI(abiArray) { + if (Array.isArray(abiArray)) { + // Iterate new abi to generate method id"s + abiArray.map(function (abi) { + if (abi.name) { + const signature = sha3( + abi.name + + '(' + + abi.inputs + .map(function (input) { + return input.type + }) + .join(',') + + ')' + ) + if (abi.type === 'event') { + if (state.methodIDs[signature.slice(2)]) { + delete state.methodIDs[signature.slice(2)] + } + } else { + if (state.methodIDs[signature.slice(2, 10)]) { + delete state.methodIDs[signature.slice(2, 10)] + } + } + } + }) + } else { + throw new Error('Expected ABI array, got ' + typeof abiArray) + } +} + +function _getMethodIDs() { + return state.methodIDs +} + +function _decodeMethod(data) { + const methodID = data.slice(2, 10) + const abiItem = state.methodIDs[methodID] + if (abiItem) { + let decoded = decodeParameters(abiItem.inputs, data.slice(10)) + + let retData = { + name: abiItem.name, + params: [] + } + + for (let i = 0; i < decoded.__length__; i++) { + let param = decoded[i] + let parsedParam = param + const isUint = abiItem.inputs[i].type.indexOf('uint') === 0 + const isInt = abiItem.inputs[i].type.indexOf('int') === 0 + const isAddress = abiItem.inputs[i].type.indexOf('address') === 0 + + if (isUint || isInt) { + const isArray = Array.isArray(param) + + if (isArray) { + parsedParam = param.map((val) => new BigNumber(val).toString()) + } else { + parsedParam = new BigNumber(param).toString() + } + } + + // Addresses returned by web3 are randomly cased so we need to standardize and lowercase all + if (isAddress) { + const isArray = Array.isArray(param) + + if (isArray) { + parsedParam = param.map((_) => _.toLowerCase()) + } else { + parsedParam = param.toLowerCase() + } + } + + retData.params.push({ + name: abiItem.inputs[i].name, + value: parsedParam, + type: abiItem.inputs[i].type + }) + } + + return retData + } +} + +function _decodeLogs(logs) { + return logs + .filter((log) => log.topics.length > 0) + .map((logItem) => { + const methodID = logItem.topics[0].slice(2) + const method = state.methodIDs[methodID] + if (method) { + const logData = logItem.data + let decodedParams = [] + let dataIndex = 0 + let topicsIndex = 1 + + let dataTypes = [] + method.inputs.map(function (input) { + if (!input.indexed) { + dataTypes.push(input.type) + } + }) + + const decodedData = decodeParameters(dataTypes, logData.slice(2)) + + // Loop topic and data to get the params + method.inputs.map(function (param) { + let decodedP = { + name: param.name, + type: param.type + } + + if (param.indexed) { + decodedP.value = logItem.topics[topicsIndex] + topicsIndex++ + } else { + decodedP.value = decodedData[dataIndex] + dataIndex++ + } + + if (param.type === 'address') { + decodedP.value = decodedP.value.toLowerCase() + // 42 because len(0x) + 40 + if (decodedP.value.length > 42) { + let toRemove = decodedP.value.length - 42 + let temp = decodedP.value.split('') + temp.splice(2, toRemove) + decodedP.value = temp.join('') + } + } + + if (param.type === 'uint256' || param.type === 'uint8' || param.type === 'int') { + // ensure to remove leading 0x for hex numbers + if (typeof decodedP.value === 'string' && decodedP.value.startsWith('0x')) { + decodedP.value = new BigNumber(decodedP.value.slice(2), 16).toString(10) + } else { + decodedP.value = new BigNumber(decodedP.value).toString(10) + } + } + + decodedParams.push(decodedP) + }) + + return { + name: method.name, + events: decodedParams, + address: logItem.address + } + } + }) + .filter((decoded) => state.keepNonDecodedLogs || decoded) +} + +function _keepNonDecodedLogs() { + state.keepNonDecodedLogs = true +} + +function _discardNonDecodedLogs() { + state.keepNonDecodedLogs = false +} + +export default { + getABIs: _getABIs, + addABI: _addABI, + getMethodIDs: _getMethodIDs, + decodeMethod: _decodeMethod, + decodeLogs: _decodeLogs, + removeABI: _removeABI, + keepNonDecodedLogs: _keepNonDecodedLogs, + discardNonDecodedLogs: _discardNonDecodedLogs +} diff --git a/src/store/modules/erc20/erc20-actions.js b/src/store/modules/erc20/erc20-actions.js index 9dc1366f1..d0c0ad870 100644 --- a/src/store/modules/erc20/erc20-actions.js +++ b/src/store/modules/erc20/erc20-actions.js @@ -1,11 +1,10 @@ -import abiDecoder from 'abi-decoder' - import * as ethUtils from '../../../lib/eth-utils' import { FetchStatus, INCREASE_FEE_MULTIPLIER } from '@/lib/constants' import EthContract from 'web3-eth-contract' import Erc20 from './erc20.abi.json' import createActions from '../eth-base/eth-base-actions' import getEndpointUrl from '@/lib/getEndpointUrl' +import abiDecoder from '@/lib/abi/abi-decoder' /** Timestamp of the most recent status update */ let lastStatusUpdate = 0 From d9966f68540bb6e84e0476c6162ce3c7d4a39621 Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 24 Oct 2023 21:43:36 +0100 Subject: [PATCH 07/12] feat(abi-decoder): add types --- package-lock.json | 3 +- package.json | 3 +- src/lib/abi/abi-decoder.ts | 266 ++++++++--------------- src/store/modules/erc20/erc20-actions.js | 4 +- 4 files changed, 99 insertions(+), 177 deletions(-) diff --git a/package-lock.json b/package-lock.json index d62a79bab..1c042a804 100644 --- a/package-lock.json +++ b/package-lock.json @@ -116,7 +116,8 @@ "vue-cli-plugin-vuetify": "~2.5.8", "vue-eslint-parser": "^9.3.1", "vue-template-compiler": "^2.7.14", - "vue-tsc": "^1.8.13" + "vue-tsc": "^1.8.13", + "web3-types": "^1.3.0" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package.json b/package.json index 7c11d8070..308b69da7 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,8 @@ "vue-cli-plugin-vuetify": "~2.5.8", "vue-eslint-parser": "^9.3.1", "vue-template-compiler": "^2.7.14", - "vue-tsc": "^1.8.13" + "vue-tsc": "^1.8.13", + "web3-types": "^1.3.0" }, "main": "dist-electron/main.js", "keywords": [ diff --git a/src/lib/abi/abi-decoder.ts b/src/lib/abi/abi-decoder.ts index fc2c454b1..75eda8bff 100644 --- a/src/lib/abi/abi-decoder.ts +++ b/src/lib/abi/abi-decoder.ts @@ -1,213 +1,133 @@ -import BigNumber from 'bignumber.js' +import type { Components, JsonEventInterface, JsonFunctionInterface } from 'web3-types' import { sha3 } from 'web3-utils' import { decodeParameters } from 'web3-eth-abi' +import BigNumber from 'bignumber.js' -const state = { - savedABIs: [], - methodIDs: {}, - keepNonDecodedLogs: false +type Method = { + name: string + params: MethodsParams[] } -function _getABIs() { - return state.savedABIs +type MethodsParams = { + name: string + type: string + value: string | string[] } -function _typeToString(input): string { +function componentType(input: Components): string { if (input.type === 'tuple') { - return '(' + input.components!.map(_typeToString).join(',') + ')' + const tupleTypes = input.components!.map(componentType) + + return '(' + tupleTypes.join(',') + ')' } + return input.type } -function _addABI(abiArray) { - if (Array.isArray(abiArray)) { - // Iterate new abi to generate method id"s - abiArray.map(function (abi) { - if (abi.name) { - const signature = sha3(abi.name + '(' + abi.inputs.map(_typeToString).join(',') + ')') - if (abi.type === 'event') { - state.methodIDs[signature.slice(2)] = abi - } else { - state.methodIDs[signature.slice(2, 10)] = abi - } - } - }) - - state.savedABIs = state.savedABIs.concat(abiArray) - } else { - throw new Error('Expected ABI array, got ' + typeof abiArray) - } +/** + * Returns `true` if the input type is one of: + * uint, uint8, uint16, uint32, uint64, uint128, uint256 + */ +function isUint(input: Components) { + return input.type.startsWith('uint') } -function _removeABI(abiArray) { - if (Array.isArray(abiArray)) { - // Iterate new abi to generate method id"s - abiArray.map(function (abi) { - if (abi.name) { - const signature = sha3( - abi.name + - '(' + - abi.inputs - .map(function (input) { - return input.type - }) - .join(',') + - ')' - ) - if (abi.type === 'event') { - if (state.methodIDs[signature.slice(2)]) { - delete state.methodIDs[signature.slice(2)] - } - } else { - if (state.methodIDs[signature.slice(2, 10)]) { - delete state.methodIDs[signature.slice(2, 10)] - } - } - } - }) - } else { - throw new Error('Expected ABI array, got ' + typeof abiArray) - } +/** + * Returns `true` if the input type is one of: + * int, int8, int16, int32, int64, int128, int256 + */ +function isInt(input: Components) { + return input.type.startsWith('int') } -function _getMethodIDs() { - return state.methodIDs +/** + * Returns `true` if the input is an ETH address + */ +function isAddress(input: Components) { + return input.type === 'address' } -function _decodeMethod(data) { - const methodID = data.slice(2, 10) - const abiItem = state.methodIDs[methodID] - if (abiItem) { - let decoded = decodeParameters(abiItem.inputs, data.slice(10)) - - let retData = { - name: abiItem.name, - params: [] - } +export class AbiDecoder { + readonly schema: Array + readonly methods: Record - for (let i = 0; i < decoded.__length__; i++) { - let param = decoded[i] - let parsedParam = param - const isUint = abiItem.inputs[i].type.indexOf('uint') === 0 - const isInt = abiItem.inputs[i].type.indexOf('int') === 0 - const isAddress = abiItem.inputs[i].type.indexOf('address') === 0 + constructor(schema: Array) { + this.schema = schema + this.methods = this.parseMethods() + } - if (isUint || isInt) { - const isArray = Array.isArray(param) + decodeMethod(data: string) { + const methodId = data.slice(2, 10) + const abiItem = this.methods[methodId] + if (abiItem) { + const decodedParams = decodeParameters(abiItem.inputs, data.slice(10)) - if (isArray) { - parsedParam = param.map((val) => new BigNumber(val).toString()) - } else { - parsedParam = new BigNumber(param).toString() - } + const retData: Method = { + name: abiItem.name, + params: [] } - // Addresses returned by web3 are randomly cased so we need to standardize and lowercase all - if (isAddress) { - const isArray = Array.isArray(param) + for (let i = 0; i < decodedParams.__length__; i++) { + const param = decodedParams[i] as string | string[] + let parsedParam = param - if (isArray) { - parsedParam = param.map((_) => _.toLowerCase()) - } else { - parsedParam = param.toLowerCase() - } - } - - retData.params.push({ - name: abiItem.inputs[i].name, - value: parsedParam, - type: abiItem.inputs[i].type - }) - } + const input = abiItem.inputs[i] - return retData - } -} + if (isInt(input) || isUint(input)) { + const isArray = Array.isArray(param) -function _decodeLogs(logs) { - return logs - .filter((log) => log.topics.length > 0) - .map((logItem) => { - const methodID = logItem.topics[0].slice(2) - const method = state.methodIDs[methodID] - if (method) { - const logData = logItem.data - let decodedParams = [] - let dataIndex = 0 - let topicsIndex = 1 - - let dataTypes = [] - method.inputs.map(function (input) { - if (!input.indexed) { - dataTypes.push(input.type) + if (isArray) { + parsedParam = param.map((number) => new BigNumber(number).toString()) + } else { + parsedParam = new BigNumber(param).toString() } - }) - - const decodedData = decodeParameters(dataTypes, logData.slice(2)) + } - // Loop topic and data to get the params - method.inputs.map(function (param) { - let decodedP = { - name: param.name, - type: param.type - } + // Addresses returned by web3 are randomly cased, so we need to standardize and lowercase all + if (isAddress(input)) { + const isArray = Array.isArray(param) - if (param.indexed) { - decodedP.value = logItem.topics[topicsIndex] - topicsIndex++ + if (isArray) { + parsedParam = param.map((address) => address.toLowerCase()) } else { - decodedP.value = decodedData[dataIndex] - dataIndex++ + parsedParam = param.toLowerCase() } + } - if (param.type === 'address') { - decodedP.value = decodedP.value.toLowerCase() - // 42 because len(0x) + 40 - if (decodedP.value.length > 42) { - let toRemove = decodedP.value.length - 42 - let temp = decodedP.value.split('') - temp.splice(2, toRemove) - decodedP.value = temp.join('') - } - } + retData.params.push({ + name: input.name, + value: parsedParam, + type: input.type + }) + } - if (param.type === 'uint256' || param.type === 'uint8' || param.type === 'int') { - // ensure to remove leading 0x for hex numbers - if (typeof decodedP.value === 'string' && decodedP.value.startsWith('0x')) { - decodedP.value = new BigNumber(decodedP.value.slice(2), 16).toString(10) - } else { - decodedP.value = new BigNumber(decodedP.value).toString(10) - } - } + return retData + } + } - decodedParams.push(decodedP) - }) + methodName(data: string): string | null { + const methodId = data.slice(2, 10) + const method = this.methods[methodId] - return { - name: method.name, - events: decodedParams, - address: logItem.address - } + return method ? method.name : null + } + + private parseMethods(): Record { + const methods: Record = {} + + for (const abi of this.schema) { + if (!abi.name) { + continue } - }) - .filter((decoded) => state.keepNonDecodedLogs || decoded) -} -function _keepNonDecodedLogs() { - state.keepNonDecodedLogs = true -} + const inputTypes = abi.inputs.map(componentType) + const signature = sha3(abi.name + '(' + inputTypes.join(',') + ')') -function _discardNonDecodedLogs() { - state.keepNonDecodedLogs = false -} + const methodId = abi.type === 'event' ? signature!.slice(2) : signature!.slice(2, 10) // event | function -export default { - getABIs: _getABIs, - addABI: _addABI, - getMethodIDs: _getMethodIDs, - decodeMethod: _decodeMethod, - decodeLogs: _decodeLogs, - removeABI: _removeABI, - keepNonDecodedLogs: _keepNonDecodedLogs, - discardNonDecodedLogs: _discardNonDecodedLogs + methods[methodId] = abi + } + + return methods + } } diff --git a/src/store/modules/erc20/erc20-actions.js b/src/store/modules/erc20/erc20-actions.js index d0c0ad870..d7f0b98f7 100644 --- a/src/store/modules/erc20/erc20-actions.js +++ b/src/store/modules/erc20/erc20-actions.js @@ -4,7 +4,7 @@ import EthContract from 'web3-eth-contract' import Erc20 from './erc20.abi.json' import createActions from '../eth-base/eth-base-actions' import getEndpointUrl from '@/lib/getEndpointUrl' -import abiDecoder from '@/lib/abi/abi-decoder' +import { AbiDecoder } from '@/lib/abi/abi-decoder' /** Timestamp of the most recent status update */ let lastStatusUpdate = 0 @@ -12,7 +12,7 @@ let lastStatusUpdate = 0 const STATUS_INTERVAL = 25000 // Setup decoder -abiDecoder.addABI(Erc20) +const abiDecoder = new AbiDecoder(Erc20) const initTransaction = (api, context, ethAddress, amount, increaseFee) => { const contract = new EthContract(Erc20, context.state.contractAddress) From 86ef2eaa5551826030707cdf542a95f8210f98b7 Mon Sep 17 00:00:00 2001 From: bludnic Date: Wed, 25 Oct 2023 14:02:44 +0100 Subject: [PATCH 08/12] refactor(abi-decoder): mark as string --- src/lib/abi/abi-decoder.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/abi/abi-decoder.ts b/src/lib/abi/abi-decoder.ts index 75eda8bff..6c697ddfa 100644 --- a/src/lib/abi/abi-decoder.ts +++ b/src/lib/abi/abi-decoder.ts @@ -121,9 +121,9 @@ export class AbiDecoder { } const inputTypes = abi.inputs.map(componentType) - const signature = sha3(abi.name + '(' + inputTypes.join(',') + ')') + const signature = sha3(abi.name + '(' + inputTypes.join(',') + ')') as string - const methodId = abi.type === 'event' ? signature!.slice(2) : signature!.slice(2, 10) // event | function + const methodId = abi.type === 'event' ? signature.slice(2) : signature.slice(2, 10) // event | function methods[methodId] = abi } From 1312fc091cedb1ab230ab8e82b81927e6570b461 Mon Sep 17 00:00:00 2001 From: bludnic Date: Wed, 25 Oct 2023 14:05:34 +0100 Subject: [PATCH 09/12] refactor(eth-base-actions): use optional chaining operator --- src/store/modules/eth-base/eth-base-actions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/modules/eth-base/eth-base-actions.js b/src/store/modules/eth-base/eth-base-actions.js index 60d298907..a3e5ed198 100644 --- a/src/store/modules/eth-base/eth-base-actions.js +++ b/src/store/modules/eth-base/eth-base-actions.js @@ -202,7 +202,7 @@ export default function createActions(config) { } void api.getTransaction(payload.hash).then((tx) => { - if (tx && tx.input) { + if (tx?.input) { const transaction = parseTransaction(context, tx) const status = existing ? existing.status : 'REGISTERED' if (transaction) { @@ -223,12 +223,12 @@ export default function createActions(config) { const attempt = payload.attempt || 0 const retryCount = tf.getPendingTxRetryCount( - payload.timestamp || (existing && existing.timestamp), + payload.timestamp || existing?.timestamp, context.state.crypto ) const retry = attempt < retryCount const retryTimeout = tf.getPendingTxRetryTimeout( - payload.timestamp || (existing && existing.timestamp), + payload.timestamp || existing?.timestamp, context.state.crypto ) From e49dedcd50da0f0bf1fceedc5c59057f1f60f6c8 Mon Sep 17 00:00:00 2001 From: bludnic Date: Wed, 25 Oct 2023 14:36:57 +0100 Subject: [PATCH 10/12] fix(eth/actions, estimateGas): BigNumber -> Number --- src/store/modules/eth/actions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/store/modules/eth/actions.js b/src/store/modules/eth/actions.js index d87840c5f..1909f45bb 100644 --- a/src/store/modules/eth/actions.js +++ b/src/store/modules/eth/actions.js @@ -1,3 +1,4 @@ +import BigNumber from 'bignumber.js' import * as utils from '../../../lib/eth-utils' import createActions from '../eth-base/eth-base-actions' @@ -28,7 +29,10 @@ const initTransaction = (api, context, ethAddress, amount, increaseFee) => { } return api.estimateGas(transaction).then((gasLimit) => { - gasLimit = increaseFee ? gasLimit * INCREASE_FEE_MULTIPLIER : gasLimit + gasLimit = increaseFee + ? BigNumber(gasLimit).times(INCREASE_FEE_MULTIPLIER).toNumber() + : gasLimit + transaction.gas = gasLimit return transaction }) From 4c69eac813b0b64b8876bceb82f65178158aafa5 Mon Sep 17 00:00:00 2001 From: bludnic Date: Wed, 25 Oct 2023 14:54:22 +0100 Subject: [PATCH 11/12] docs(abi-decoder): add reference to the lib author --- src/lib/abi/abi-decoder.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/abi/abi-decoder.ts b/src/lib/abi/abi-decoder.ts index 6c697ddfa..8fe456836 100644 --- a/src/lib/abi/abi-decoder.ts +++ b/src/lib/abi/abi-decoder.ts @@ -1,3 +1,6 @@ +/** + * The code is based on https://github.com/Consensys/abi-decoder + */ import type { Components, JsonEventInterface, JsonFunctionInterface } from 'web3-types' import { sha3 } from 'web3-utils' import { decodeParameters } from 'web3-eth-abi' From d7bc161e7549aed43084e007f0a279ba20685e55 Mon Sep 17 00:00:00 2001 From: bludnic Date: Fri, 27 Oct 2023 18:13:49 +0100 Subject: [PATCH 12/12] fix(erc20-actions): fix merge --- src/store/modules/erc20/erc20-actions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/modules/erc20/erc20-actions.js b/src/store/modules/erc20/erc20-actions.js index d7f0b98f7..4bf2a60e7 100644 --- a/src/store/modules/erc20/erc20-actions.js +++ b/src/store/modules/erc20/erc20-actions.js @@ -3,7 +3,7 @@ import { FetchStatus, INCREASE_FEE_MULTIPLIER } from '@/lib/constants' import EthContract from 'web3-eth-contract' import Erc20 from './erc20.abi.json' import createActions from '../eth-base/eth-base-actions' -import getEndpointUrl from '@/lib/getEndpointUrl' +import { getRandomNodeUrl } from '@/config/utils' import { AbiDecoder } from '@/lib/abi/abi-decoder' /** Timestamp of the most recent status update */ @@ -73,7 +73,7 @@ const createSpecificActions = (api) => ({ try { const contract = new EthContract(Erc20, state.contractAddress) - const endpoint = getEndpointUrl('ETH') + const endpoint = getRandomNodeUrl('eth') contract.setProvider(endpoint) const rawBalance = await contract.methods.balanceOf(state.address).call() const balance = Number(ethUtils.toFraction(rawBalance, state.decimals)) @@ -92,7 +92,7 @@ const createSpecificActions = (api) => ({ if (!context.state.address) return const contract = new EthContract(Erc20, context.state.contractAddress) - const endpoint = getEndpointUrl('ETH') + const endpoint = getRandomNodeUrl('eth') contract.setProvider(endpoint) contract.methods