From 12df7de6fd7b6d5d0ae4fce6a6cd4c4ef7af82ed Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Wed, 8 Nov 2023 02:16:31 +0000 Subject: [PATCH 1/3] deps: nonce-tracker@^1.1.0->^2.0.0 --- packages/transaction-controller/package.json | 2 +- yarn.lock | 172 +++---------------- 2 files changed, 26 insertions(+), 148 deletions(-) diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index f566ff089b..af4fd29d4c 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -47,7 +47,7 @@ "ethereumjs-util": "^7.0.10", "fast-json-patch": "^3.1.1", "lodash": "^4.17.21", - "nonce-tracker": "^1.1.0", + "nonce-tracker": "^2.0.0", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 979e4b237b..3497126c54 100644 --- a/yarn.lock +++ b/yarn.lock @@ -725,7 +725,7 @@ __metadata: languageName: node linkType: hard -"@ethersproject/providers@npm:^5.7.0": +"@ethersproject/providers@npm:^5.7.0, @ethersproject/providers@npm:^5.7.2": version: 5.7.2 resolution: "@ethersproject/providers@npm:5.7.2" dependencies: @@ -2433,40 +2433,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/snaps-controllers@npm:^3.0.0, @metamask/snaps-controllers@npm:^3.1.0": - version: 3.1.1 - resolution: "@metamask/snaps-controllers@npm:3.1.1" - dependencies: - "@metamask/approval-controller": ^4.0.0 - "@metamask/base-controller": ^3.2.0 - "@metamask/json-rpc-engine": ^7.1.1 - "@metamask/object-multiplex": ^1.2.0 - "@metamask/permission-controller": ^5.0.0 - "@metamask/post-message-stream": ^7.0.0 - "@metamask/rpc-errors": ^6.1.0 - "@metamask/snaps-registry": ^2.1.0 - "@metamask/snaps-rpc-methods": ^3.1.0 - "@metamask/snaps-utils": ^3.1.0 - "@metamask/utils": ^8.1.0 - "@xstate/fsm": ^2.0.0 - concat-stream: ^2.0.0 - get-npm-tarball-url: ^2.0.3 - gunzip-maybe: ^1.4.2 - immer: ^9.0.6 - json-rpc-middleware-stream: ^5.0.0 - nanoid: ^3.1.31 - readable-web-to-node-stream: ^3.0.2 - tar-stream: ^3.1.6 - peerDependencies: - "@metamask/snaps-execution-environments": ^3.1.0 - peerDependenciesMeta: - "@metamask/snaps-execution-environments": - optional: true - checksum: a4fb339916481111c8c68c043e0633141583ae3128ccb78dc08b824791a1de394e293b5c2909b0d18af2858e8cc1963e4afc3f43abd75b62ed43845f2c0ece3f - languageName: node - linkType: hard - -"@metamask/snaps-controllers@npm:^3.2.0": +"@metamask/snaps-controllers@npm:^3.0.0, @metamask/snaps-controllers@npm:^3.1.0, @metamask/snaps-controllers@npm:^3.2.0": version: 3.2.0 resolution: "@metamask/snaps-controllers@npm:3.2.0" dependencies: @@ -2512,23 +2479,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-rpc-methods@npm:^3.1.0": - version: 3.1.0 - resolution: "@metamask/snaps-rpc-methods@npm:3.1.0" - dependencies: - "@metamask/key-tree": ^9.0.0 - "@metamask/permission-controller": ^5.0.0 - "@metamask/rpc-errors": ^6.1.0 - "@metamask/snaps-ui": ^3.0.1 - "@metamask/snaps-utils": ^3.1.0 - "@metamask/utils": ^8.1.0 - "@noble/hashes": ^1.3.1 - superstruct: ^1.0.3 - checksum: 4ba535c970db72dad65d9d303c3def57c4130b620fb1276f855e73a59535e587535cfa869088f07b59967c9fe30beadddd25acfb28d2986db820a6a92f2d0d68 - languageName: node - linkType: hard - -"@metamask/snaps-rpc-methods@npm:^3.2.0": +"@metamask/snaps-rpc-methods@npm:^3.1.0, @metamask/snaps-rpc-methods@npm:^3.2.0": version: 3.2.1 resolution: "@metamask/snaps-rpc-methods@npm:3.2.1" dependencies: @@ -2544,7 +2495,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-ui@npm:^3.0.1, @metamask/snaps-ui@npm:^3.1.0": +"@metamask/snaps-ui@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/snaps-ui@npm:3.1.0" dependencies: @@ -2555,36 +2506,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils@npm:^3.0.0, @metamask/snaps-utils@npm:^3.1.0": - version: 3.1.0 - resolution: "@metamask/snaps-utils@npm:3.1.0" - dependencies: - "@babel/core": ^7.23.2 - "@babel/types": ^7.23.0 - "@metamask/base-controller": ^3.2.0 - "@metamask/key-tree": ^9.0.0 - "@metamask/permission-controller": ^5.0.0 - "@metamask/rpc-errors": ^6.1.0 - "@metamask/snaps-registry": ^2.1.0 - "@metamask/snaps-ui": ^3.0.1 - "@metamask/utils": ^8.1.0 - "@noble/hashes": ^1.3.1 - "@scure/base": ^1.1.1 - chalk: ^4.1.2 - cron-parser: ^4.5.0 - fast-deep-equal: ^3.1.3 - fast-json-stable-stringify: ^2.1.0 - is-svg: ^4.4.0 - rfdc: ^1.3.0 - semver: ^7.5.4 - ses: ^0.18.8 - superstruct: ^1.0.3 - validate-npm-package-name: ^5.0.0 - checksum: 82f675e4eaf0ef928851450742b3378ce815ed6e7bdc77d6c20da21b6a95e5ea2627c9979e6a3655e91b04fa5565f78baa8b952826139d1485a22d0c81e10447 - languageName: node - linkType: hard - -"@metamask/snaps-utils@npm:^3.2.0": +"@metamask/snaps-utils@npm:^3.0.0, @metamask/snaps-utils@npm:^3.2.0": version: 3.2.0 resolution: "@metamask/snaps-utils@npm:3.2.0" dependencies: @@ -2648,7 +2570,7 @@ __metadata: fast-json-patch: ^3.1.1 jest: ^27.5.1 lodash: ^4.17.21 - nonce-tracker: ^1.1.0 + nonce-tracker: ^2.0.0 sinon: ^9.2.4 ts-jest: ^27.1.4 typedoc: ^0.24.8 @@ -3796,16 +3718,6 @@ __metadata: languageName: node linkType: hard -"assert@npm:^1.4.1": - version: 1.5.0 - resolution: "assert@npm:1.5.0" - dependencies: - object-assign: ^4.1.1 - util: 0.10.3 - checksum: 9be48435f726029ae7020c5888a3566bf4d617687aab280827f2e4029644b6515a9519ea10d018b342147c02faf73d9e9419e780e8937b3786ee4945a0ca71e5 - languageName: node - linkType: hard - "assert@npm:^2.0.0": version: 2.0.0 resolution: "assert@npm:2.0.0" @@ -3827,6 +3739,15 @@ __metadata: languageName: node linkType: hard +"async-mutex@npm:^0.3.1": + version: 0.3.2 + resolution: "async-mutex@npm:0.3.2" + dependencies: + tslib: ^2.3.1 + checksum: 620b771dfdea1cad0a6b712915c31a1e3ca880a8cf1eae92b4590f435995e0260929c6ebaae0b9126b1456790ea498064b5bb9a506948cda760f48d3d0dcc4c8 + languageName: node + linkType: hard + "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -3841,13 +3762,6 @@ __metadata: languageName: node linkType: hard -"await-semaphore@npm:^0.1.3": - version: 0.1.3 - resolution: "await-semaphore@npm:0.1.3" - checksum: 334c86541e446378dd832168de431327a77146f70cd80b57c99cd483ce5996e3bfdadea9d795e36f0b4faacb5121f5f7a99d94297ac2bdafbc690e5b0aa5cc32 - languageName: node - linkType: hard - "b4a@npm:^1.6.4": version: 1.6.4 resolution: "b4a@npm:1.6.4" @@ -5666,18 +5580,6 @@ __metadata: languageName: node linkType: hard -"ethjs-query@npm:^0.3.8": - version: 0.3.8 - resolution: "ethjs-query@npm:0.3.8" - dependencies: - babel-runtime: ^6.26.0 - ethjs-format: 0.2.7 - ethjs-rpc: 0.2.0 - promise-to-callback: ^1.0.0 - checksum: 6673167101e793dfdbb212f3ee2e7449a7c1eb7f4d72aba04a1c504eb36d9148f18c42a702839ebce7534709d821f32adcca84c56b7900788b2875cba8a371f1 - languageName: node - linkType: hard - "ethjs-rpc@npm:0.2.0": version: 0.2.0 resolution: "ethjs-rpc@npm:0.2.0" @@ -6653,13 +6555,6 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2.0.1": - version: 2.0.1 - resolution: "inherits@npm:2.0.1" - checksum: 6536b9377296d4ce8ee89c5c543cb75030934e61af42dba98a428e7d026938c5985ea4d1e3b87743a5b834f40ed1187f89c2d7479e9d59e41d2d1051aefba07b - languageName: node - linkType: hard - "ini@npm:^1.3.4": version: 1.3.8 resolution: "ini@npm:1.3.8" @@ -8529,14 +8424,13 @@ __metadata: languageName: node linkType: hard -"nonce-tracker@npm:^1.1.0": - version: 1.1.0 - resolution: "nonce-tracker@npm:1.1.0" +"nonce-tracker@npm:^2.0.0": + version: 2.0.0 + resolution: "nonce-tracker@npm:2.0.0" dependencies: - assert: ^1.4.1 - await-semaphore: ^0.1.3 - ethjs-query: ^0.3.8 - checksum: fbed4eac51a5df3922a9ee93f2d40f700d3c86e03ac02acc5c7983e9fd5c9d97278f1f5d8422f2dad0f0108c09a2d880145906cae19604717cc898d385bbdff9 + "@ethersproject/providers": ^5.7.2 + async-mutex: ^0.3.1 + checksum: 7fc901b7a5e5f3b1c6431864780ab47c69aed096f1bcc0903242e7c9189b78612fe04d076cf451ea63aa646858fb3bd834fc707223295ad8e04a3d847e5d703e languageName: node linkType: hard @@ -8612,13 +8506,6 @@ __metadata: languageName: node linkType: hard -"object-assign@npm:^4.1.1": - version: 4.1.1 - resolution: "object-assign@npm:4.1.1" - checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f - languageName: node - linkType: hard - "object-inspect@npm:^1.12.3, object-inspect@npm:^1.9.0": version: 1.12.3 resolution: "object-inspect@npm:1.12.3" @@ -10264,10 +10151,10 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.0, tslib@npm:^2.3.0, tslib@npm:^2.5.0, tslib@npm:^2.6.0": - version: 2.6.0 - resolution: "tslib@npm:2.6.0" - checksum: c01066038f950016a18106ddeca4649b4d76caa76ec5a31e2a26e10586a59fceb4ee45e96719bf6c715648e7c14085a81fee5c62f7e9ebee68e77a5396e5538f +"tslib@npm:^2.0.0, tslib@npm:^2.3.0, tslib@npm:^2.3.1, tslib@npm:^2.5.0, tslib@npm:^2.6.0": + version: 2.6.2 + resolution: "tslib@npm:2.6.2" + checksum: 329ea56123005922f39642318e3d1f0f8265d1e7fcb92c633e0809521da75eeaca28d2cf96d7248229deb40e5c19adf408259f4b9640afd20d13aecc1430f3ad languageName: node linkType: hard @@ -10525,15 +10412,6 @@ __metadata: languageName: node linkType: hard -"util@npm:0.10.3": - version: 0.10.3 - resolution: "util@npm:0.10.3" - dependencies: - inherits: 2.0.1 - checksum: bd800f5d237a82caddb61723a6cbe45297d25dd258651a31335a4d5d981fd033cb4771f82db3d5d59b582b187cb69cfe727dc6f4d8d7826f686ee6c07ce611e0 - languageName: node - linkType: hard - "util@npm:^0.12.0": version: 0.12.5 resolution: "util@npm:0.12.5" From a3714681161d0fbbb8d035f15187b47afb74e68b Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Wed, 15 Nov 2023 09:09:15 +0000 Subject: [PATCH 2/3] deps: nonce-tracker@^2.0.0->^3.0.0 --- packages/transaction-controller/package.json | 2 +- .../src/TransactionController.test.ts | 2 +- .../src/TransactionController.ts | 5 +++-- .../src/helpers/PendingTransactionTracker.test.ts | 2 +- .../src/helpers/PendingTransactionTracker.ts | 2 +- .../transaction-controller/src/utils/utils.test.ts | 2 +- packages/transaction-controller/src/utils/utils.ts | 2 +- yarn.lock | 10 +++++----- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index af4fd29d4c..86e38c53b4 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -47,7 +47,7 @@ "ethereumjs-util": "^7.0.10", "fast-json-patch": "^3.1.1", "lodash": "^4.17.21", - "nonce-tracker": "^2.0.0", + "nonce-tracker": "^3.0.0", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/packages/transaction-controller/src/TransactionController.test.ts b/packages/transaction-controller/src/TransactionController.test.ts index 4618514ff2..f0b4f489ee 100644 --- a/packages/transaction-controller/src/TransactionController.test.ts +++ b/packages/transaction-controller/src/TransactionController.test.ts @@ -20,7 +20,7 @@ import type { import { NetworkClientType, NetworkStatus } from '@metamask/network-controller'; import { errorCodes, providerErrors, rpcErrors } from '@metamask/rpc-errors'; import HttpProvider from 'ethjs-provider-http'; -import NonceTracker from 'nonce-tracker'; +import { NonceTracker } from 'nonce-tracker'; import { FakeBlockTracker } from '../../../tests/fake-block-tracker'; import { mockNetwork } from '../../../tests/mock-network'; diff --git a/packages/transaction-controller/src/TransactionController.ts b/packages/transaction-controller/src/TransactionController.ts index 7212cdf9cf..05dcd984df 100644 --- a/packages/transaction-controller/src/TransactionController.ts +++ b/packages/transaction-controller/src/TransactionController.ts @@ -34,8 +34,8 @@ import MethodRegistry from 'eth-method-registry'; import { addHexPrefix, bufferToHex } from 'ethereumjs-util'; import { EventEmitter } from 'events'; import { merge, pickBy } from 'lodash'; -import NonceTracker from 'nonce-tracker'; -import type { NonceLock } from 'nonce-tracker/dist/NonceTracker'; +import { NonceTracker } from 'nonce-tracker'; +import type { NonceLock } from 'nonce-tracker'; import { v1 as random } from 'uuid'; import { EtherscanRemoteTransactionSource } from './helpers/EtherscanRemoteTransactionSource'; @@ -462,6 +462,7 @@ export class TransactionController extends BaseController< hooks?.getAdditionalSignArguments ?? (() => []); this.nonceTracker = new NonceTracker({ + // @ts-expect-error provider types misaligned: SafeEventEmitterProvider vs Record provider, blockTracker, getPendingTransactions: (address) => diff --git a/packages/transaction-controller/src/helpers/PendingTransactionTracker.test.ts b/packages/transaction-controller/src/helpers/PendingTransactionTracker.test.ts index f5bdff56bb..3055e0c682 100644 --- a/packages/transaction-controller/src/helpers/PendingTransactionTracker.test.ts +++ b/packages/transaction-controller/src/helpers/PendingTransactionTracker.test.ts @@ -2,7 +2,7 @@ import { query } from '@metamask/controller-utils'; import type { BlockTracker } from '@metamask/network-controller'; -import type NonceTracker from 'nonce-tracker'; +import type { NonceTracker } from 'nonce-tracker'; import { TransactionStatus } from '../types'; import { PendingTransactionTracker } from './PendingTransactionTracker'; diff --git a/packages/transaction-controller/src/helpers/PendingTransactionTracker.ts b/packages/transaction-controller/src/helpers/PendingTransactionTracker.ts index 9674c87c0a..f90f413b6d 100644 --- a/packages/transaction-controller/src/helpers/PendingTransactionTracker.ts +++ b/packages/transaction-controller/src/helpers/PendingTransactionTracker.ts @@ -3,7 +3,7 @@ import type EthQuery from '@metamask/eth-query'; import type { BlockTracker } from '@metamask/network-controller'; import { createModuleLogger } from '@metamask/utils'; import EventEmitter from 'events'; -import type NonceTracker from 'nonce-tracker'; +import type { NonceTracker } from 'nonce-tracker'; import { projectLogger } from '../logger'; import type { TransactionState } from '../TransactionController'; diff --git a/packages/transaction-controller/src/utils/utils.test.ts b/packages/transaction-controller/src/utils/utils.test.ts index 4971618587..e65f7c69cc 100644 --- a/packages/transaction-controller/src/utils/utils.test.ts +++ b/packages/transaction-controller/src/utils/utils.test.ts @@ -1,4 +1,4 @@ -import type { Transaction as NonceTrackerTransaction } from 'nonce-tracker/dist/NonceTracker'; +import type { Transaction as NonceTrackerTransaction } from 'nonce-tracker'; import type { GasPriceValue, diff --git a/packages/transaction-controller/src/utils/utils.ts b/packages/transaction-controller/src/utils/utils.ts index 1b3f548def..e13fa2972f 100644 --- a/packages/transaction-controller/src/utils/utils.ts +++ b/packages/transaction-controller/src/utils/utils.ts @@ -1,7 +1,7 @@ import { convertHexToDecimal } from '@metamask/controller-utils'; import { getKnownPropertyNames } from '@metamask/utils'; import { addHexPrefix, isHexString } from 'ethereumjs-util'; -import type { Transaction as NonceTrackerTransaction } from 'nonce-tracker/dist/NonceTracker'; +import type { Transaction as NonceTrackerTransaction } from 'nonce-tracker'; import type { GasPriceValue, diff --git a/yarn.lock b/yarn.lock index 3497126c54..7370799ea7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2570,7 +2570,7 @@ __metadata: fast-json-patch: ^3.1.1 jest: ^27.5.1 lodash: ^4.17.21 - nonce-tracker: ^2.0.0 + nonce-tracker: ^3.0.0 sinon: ^9.2.4 ts-jest: ^27.1.4 typedoc: ^0.24.8 @@ -8424,13 +8424,13 @@ __metadata: languageName: node linkType: hard -"nonce-tracker@npm:^2.0.0": - version: 2.0.0 - resolution: "nonce-tracker@npm:2.0.0" +"nonce-tracker@npm:^3.0.0": + version: 3.0.0 + resolution: "nonce-tracker@npm:3.0.0" dependencies: "@ethersproject/providers": ^5.7.2 async-mutex: ^0.3.1 - checksum: 7fc901b7a5e5f3b1c6431864780ab47c69aed096f1bcc0903242e7c9189b78612fe04d076cf451ea63aa646858fb3bd834fc707223295ad8e04a3d847e5d703e + checksum: f679e83359c3d0b1941cb8569057445b5430b7e5645216442c256b2061ffb08ebee07e15011d3d55acf75710e054abd924c1b1bb38847956ef9f3bb7eed622d4 languageName: node linkType: hard From 1a111e6cb2b7f21d38eafbc744cfcd34d9e6b4d0 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Wed, 15 Nov 2023 10:11:52 +0000 Subject: [PATCH 3/3] chore(constraints): remove required peerDependency for nonce-tracker nonce-tracker no longer depends on ethjs-query so the corresponding yarn constraint can be removed --- constraints.pro | 7 ------- 1 file changed, 7 deletions(-) diff --git a/constraints.pro b/constraints.pro index c8aebe901b..59e07bbc09 100644 --- a/constraints.pro +++ b/constraints.pro @@ -350,13 +350,6 @@ gen_enforced_field(WorkspaceCwd, 'publishConfig.registry', 'https://registry.npm gen_enforced_field(WorkspaceCwd, 'publishConfig', null) :- workspace_field(WorkspaceCwd, 'private', true). -% nonce-tracker has an unlisted dependency on babel-runtime (via `ethjs-query`), so that package -% needs to be present if nonce-tracker is present. -gen_enforced_dependency(WorkspaceCwd, 'babel-runtime', '^6.26.0', 'peerDependencies') :- - workspace_has_dependency(WorkspaceCwd, 'nonce-tracker', _, 'dependencies'). -gen_enforced_dependency(WorkspaceCwd, 'babel-runtime', '^6.26.0', 'devDependencies') :- - workspace_has_dependency(WorkspaceCwd, 'nonce-tracker', _, 'dependencies'). - % eth-method-registry has an unlisted dependency on babel-runtime (via `ethjs->ethjs-query`), so % that package needs to be present if eth-method-registry is present. gen_enforced_dependency(WorkspaceCwd, 'babel-runtime', '^6.26.0', 'peerDependencies') :-