diff --git a/package-lock.json b/package-lock.json index e9ba3ca1..d88aa8e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@ethereumjs/util": "^9.0.3", - "@metamask/rpc-errors": "^6.3.1", + "@metamask/rpc-errors": "6.2.1", "@toruslabs/constants": "^14.0.0", "@toruslabs/eccrypto": "^5.0.4", "@toruslabs/ffjavascript": "^3.0.0", @@ -27,14 +27,13 @@ "elliptic": "^6.5.6", "enc-utils": "^3.0.0", "end-of-stream": "^1.4.4", - "events": "^3.3.0", - "fast-safe-stringify": "^2.1.1", + "eventemitter3": "^5.0.1", + "json-stable-stringify": "^1.1.1", "loglevel": "^1.9.1", "once": "^1.4.0", "pump": "^3.0.0", "readable-stream": "^4.5.2", - "ts-custom-error": "^3.3.1", - "ts-node": "^10.9.2" + "ts-custom-error": "^3.3.1" }, "devDependencies": { "@babel/register": "^7.24.6", @@ -46,6 +45,7 @@ "@types/color": "^3.0.6", "@types/elliptic": "^6.4.18", "@types/end-of-stream": "^1.4.4", + "@types/json-stable-stringify": "^1.0.36", "@types/mocha": "^10.0.7", "@types/node": "^20", "@types/once": "^1.4.4", @@ -1780,24 +1780,6 @@ "node": ">=6.9.0" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "dev": true, @@ -1920,7 +1902,8 @@ }, "node_modules/@ethereumjs/common": { "version": "3.2.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-3.2.0.tgz", + "integrity": "sha512-pksvzI0VyLgmuEF2FA/JR/4/y6hcPq8OUail3/AvycBaW1d5VSauOZzqGvJ3RTmR4MU35lWE8KseKOsEhrFRBA==", "dependencies": { "@ethereumjs/util": "^8.1.0", "crc-32": "^1.2.0" @@ -1941,7 +1924,8 @@ }, "node_modules/@ethereumjs/rlp": { "version": "4.0.1", - "license": "MPL-2.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", "bin": { "rlp": "bin/rlp" }, @@ -1951,7 +1935,8 @@ }, "node_modules/@ethereumjs/tx": { "version": "4.2.0", - "license": "MPL-2.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-4.2.0.tgz", + "integrity": "sha512-1nc6VO4jtFd172BbSnTnDQVr9IYBFl1y4xPzZdtkrkKIncBCkdbgfdRV+MiTkJYAtTxvV12GRZLqBFT1PNK6Yw==", "dependencies": { "@ethereumjs/common": "^3.2.0", "@ethereumjs/rlp": "^4.0.1", @@ -2256,6 +2241,7 @@ }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -2280,6 +2266,7 @@ }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", + "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { @@ -2292,10 +2279,11 @@ } }, "node_modules/@metamask/rpc-errors": { - "version": "6.3.1", - "license": "MIT", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@metamask/rpc-errors/-/rpc-errors-6.2.1.tgz", + "integrity": "sha512-VTgWkjWLzb0nupkFl1duQi9Mk8TGT9rsdnQg6DeRrYEFxtFOh0IF8nAwxM/4GWqDl6uIB06lqUBgUrAVWl62Bw==", "dependencies": { - "@metamask/utils": "^9.0.0", + "@metamask/utils": "^8.3.0", "fast-safe-stringify": "^2.0.6" }, "engines": { @@ -2304,17 +2292,19 @@ }, "node_modules/@metamask/superstruct": { "version": "3.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@metamask/superstruct/-/superstruct-3.1.0.tgz", + "integrity": "sha512-N08M56HdOgBfRKkrgCMZvQppkZGcArEop3kixNEtVbJKm6P9Cfg0YkI6X0s1g78sNrj2fWUwvJADdZuzJgFttA==", "engines": { "node": ">=16.0.0" } }, "node_modules/@metamask/utils": { - "version": "9.1.0", - "license": "ISC", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-8.5.0.tgz", + "integrity": "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ==", "dependencies": { "@ethereumjs/tx": "^4.2.0", - "@metamask/superstruct": "^3.1.0", + "@metamask/superstruct": "^3.0.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", @@ -2329,7 +2319,8 @@ }, "node_modules/@metamask/utils/node_modules/semver": { "version": "7.6.3", - "license": "ISC", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "bin": { "semver": "bin/semver.js" }, @@ -3222,22 +3213,6 @@ "version": "1.0.4", "license": "Unlicense" }, - "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "license": "MIT" - }, "node_modules/@types/bn.js": { "version": "5.1.5", "dev": true, @@ -3269,7 +3244,8 @@ }, "node_modules/@types/debug": { "version": "4.1.12", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", "dependencies": { "@types/ms": "*" } @@ -3344,6 +3320,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-stable-stringify": { + "version": "1.0.36", + "resolved": "https://registry.npmjs.org/@types/json-stable-stringify/-/json-stable-stringify-1.0.36.tgz", + "integrity": "sha512-b7bq23s4fgBB76n34m2b3RBf6M369B0Z9uRR8aHTMd8kZISRkmDEpPD8hhpYvDFzr3bJCPES96cm3Q6qRNDbQw==", + "dev": true + }, "node_modules/@types/json5": { "version": "0.0.29", "dev": true, @@ -3356,10 +3338,12 @@ }, "node_modules/@types/ms": { "version": "0.7.34", - "license": "MIT" + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" }, "node_modules/@types/node": { "version": "20.11.16", + "dev": true, "license": "MIT", "dependencies": { "undici-types": "~5.26.4" @@ -3797,6 +3781,7 @@ }, "node_modules/acorn": { "version": "8.11.3", + "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -3823,6 +3808,7 @@ }, "node_modules/acorn-walk": { "version": "8.3.3", + "dev": true, "license": "MIT", "dependencies": { "acorn": "^8.11.0" @@ -3962,10 +3948,6 @@ "node": ">= 8" } }, - "node_modules/arg": { - "version": "4.1.3", - "license": "MIT" - }, "node_modules/argparse": { "version": "2.0.1", "dev": true, @@ -5243,7 +5225,8 @@ }, "node_modules/crc-32": { "version": "1.2.2", - "license": "Apache-2.0", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", "bin": { "crc32": "bin/crc32.njs" }, @@ -5290,10 +5273,6 @@ "sha.js": "^2.4.8" } }, - "node_modules/create-require": { - "version": "1.1.1", - "license": "MIT" - }, "node_modules/cross-env": { "version": "7.0.3", "dev": true, @@ -6744,7 +6723,6 @@ }, "node_modules/eventemitter3": { "version": "5.0.1", - "dev": true, "license": "MIT" }, "node_modules/events": { @@ -9501,10 +9479,6 @@ "semver": "bin/semver" } }, - "node_modules/make-error": { - "version": "1.3.6", - "license": "ISC" - }, "node_modules/md5.js": { "version": "1.3.5", "dev": true, @@ -10429,7 +10403,8 @@ }, "node_modules/pony-cause": { "version": "2.1.11", - "license": "0BSD", + "resolved": "https://registry.npmjs.org/pony-cause/-/pony-cause-2.1.11.tgz", + "integrity": "sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg==", "engines": { "node": ">=12.0.0" } @@ -12752,54 +12727,6 @@ "node": ">=14.0.0" } }, - "node_modules/ts-node": { - "version": "10.9.2", - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/tsconfig-paths": { "version": "4.2.0", "dev": true, @@ -13022,6 +12949,7 @@ }, "node_modules/typescript": { "version": "5.5.4", + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -13047,6 +12975,7 @@ }, "node_modules/undici-types": { "version": "5.26.5", + "dev": true, "license": "MIT" }, "node_modules/unicode-canonical-property-names-ecmascript": { @@ -13256,19 +13185,16 @@ }, "node_modules/uuid": { "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], - "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "license": "MIT" - }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "dev": true, @@ -13992,13 +13918,6 @@ "node": ">=8" } }, - "node_modules/yn": { - "version": "3.1.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "dev": true, diff --git a/package.json b/package.json index 456c5782..f767d661 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@types/color": "^3.0.6", "@types/elliptic": "^6.4.18", "@types/end-of-stream": "^1.4.4", + "@types/json-stable-stringify": "^1.0.36", "@types/mocha": "^10.0.7", "@types/node": "^20", "@types/once": "^1.4.4", @@ -78,7 +79,7 @@ }, "dependencies": { "@ethereumjs/util": "^9.0.3", - "@metamask/rpc-errors": "^6.3.1", + "@metamask/rpc-errors": "6.2.1", "@toruslabs/constants": "^14.0.0", "@toruslabs/eccrypto": "^5.0.4", "@toruslabs/ffjavascript": "^3.0.0", @@ -95,13 +96,12 @@ "elliptic": "^6.5.6", "enc-utils": "^3.0.0", "end-of-stream": "^1.4.4", - "events": "^3.3.0", - "fast-safe-stringify": "^2.1.1", + "eventemitter3": "^5.0.1", + "json-stable-stringify": "^1.1.1", "loglevel": "^1.9.1", "once": "^1.4.0", "pump": "^3.0.0", "readable-stream": "^4.5.2", - "ts-custom-error": "^3.3.1", - "ts-node": "^10.9.2" + "ts-custom-error": "^3.3.1" } } diff --git a/src/core/PopupHandler.ts b/src/core/PopupHandler.ts index 12e9a55a..b574421a 100644 --- a/src/core/PopupHandler.ts +++ b/src/core/PopupHandler.ts @@ -1,5 +1,5 @@ import { SecurePubSub } from "@toruslabs/secure-pub-sub"; -import { EventEmitter } from "events"; +import { EventEmitter } from "eventemitter3"; import { LoginError } from "./errors"; import { getPopupFeatures } from "./utils"; diff --git a/src/jrpc/safeEventEmitter.ts b/src/jrpc/safeEventEmitter.ts index 0dd7c46f..53c98587 100644 --- a/src/jrpc/safeEventEmitter.ts +++ b/src/jrpc/safeEventEmitter.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { EventEmitter } from "events"; +import { EventEmitter } from "eventemitter3"; type Handler = (...args: any[]) => void; interface EventMap { diff --git a/src/jrpc/serializableError.ts b/src/jrpc/serializableError.ts index 517f4608..a01bc43f 100644 --- a/src/jrpc/serializableError.ts +++ b/src/jrpc/serializableError.ts @@ -1,4 +1,4 @@ -import stringify from "fast-safe-stringify"; +import stringify from "json-stable-stringify"; export default class SerializableError extends Error { public code: number;