diff --git a/package.json b/package.json index b572068d55..c5e87ab123 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "resolutions": { "@metamask/keyring-api@^6.0.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", "@metamask/keyring-api@^6.1.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", + "@metamask/keyring-api@^6.1.1": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index 5e3481adc2..7f455471e7 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controllers", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/assets-controllers", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethereumjs/util": "^8.1.0", diff --git a/packages/assets-controllers/src/assetsUtil.test.ts b/packages/assets-controllers/src/assetsUtil.test.ts index 6c3d106e51..81061e2e05 100644 --- a/packages/assets-controllers/src/assetsUtil.test.ts +++ b/packages/assets-controllers/src/assetsUtil.test.ts @@ -254,33 +254,33 @@ describe('assetsUtil', () => { }); describe('getIpfsCIDv1AndPath', () => { - it('should return content identifier from default ipfs url format', () => { + it('should return content identifier from default ipfs url format', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V0}`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: undefined }); }); - it('should return content identifier from alternative ipfs url format', () => { + it('should return content identifier from alternative ipfs url format', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${ALTERNATIVE_IPFS_URL_FORMAT}${IPFS_CID_V0}`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: undefined }); }); - it('should return unchanged content identifier if already v1', () => { + it('should return unchanged content identifier if already v1', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: undefined }); }); - it('should return a path when url contains one', () => { + it('should return a path when url contains one', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test/test/test`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: '/test/test/test' }); @@ -288,9 +288,9 @@ describe('assetsUtil', () => { }); describe('getFormattedIpfsUrl', () => { - it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway without protocol prefix, no path and subdomainSupported argument set to true', () => { + it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway without protocol prefix, no path and subdomainSupported argument set to true', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( IFPS_GATEWAY, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}`, true, @@ -298,9 +298,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IPFS_CID_V1}.ipfs.${IFPS_GATEWAY}`); }); - it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a cidv0 and no path and subdomainSupported argument set to true', () => { + it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a cidv0 and no path and subdomainSupported argument set to true', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V0}`, true, @@ -308,9 +308,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IPFS_CID_V1}.ipfs.${IFPS_GATEWAY}`); }); - it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a path at the end of the url, and subdomainSupported argument set to true', () => { + it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a path at the end of the url, and subdomainSupported argument set to true', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test`, true, @@ -318,9 +318,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IPFS_CID_V1}.ipfs.${IFPS_GATEWAY}/test`); }); - it('should return a correctly formatted non-subdomained ipfs url when passed ipfsGateway with no "/ipfs/" appended, a path at the end of the url, and subdomainSupported argument set to false', () => { + it('should return a correctly formatted non-subdomained ipfs url when passed ipfsGateway with no "/ipfs/" appended, a path at the end of the url, and subdomainSupported argument set to false', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test`, false, @@ -328,9 +328,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IFPS_GATEWAY}/ipfs/${IPFS_CID_V1}/test`); }); - it('should return a correctly formatted non-subdomained ipfs url when passed an ipfsGateway with "/ipfs/" appended, a path at the end of the url, subdomainSupported argument set to false', () => { + it('should return a correctly formatted non-subdomained ipfs url when passed an ipfsGateway with "/ipfs/" appended, a path at the end of the url, subdomainSupported argument set to false', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}/ipfs/`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test`, false, diff --git a/packages/assets-controllers/src/assetsUtil.ts b/packages/assets-controllers/src/assetsUtil.ts index 1d7930b4a5..c1554a397b 100644 --- a/packages/assets-controllers/src/assetsUtil.ts +++ b/packages/assets-controllers/src/assetsUtil.ts @@ -190,7 +190,7 @@ export async function getIpfsCIDv1AndPath(ipfsUrl: string): Promise<{ const cid = index !== -1 ? url.substring(0, index) : url; const path = index !== -1 ? url.substring(index) : undefined; - const { CID } = await import('multiformats/cid'); + const { CID } = await import('multiformats'); // We want to ensure that the CID is v1 (https://docs.ipfs.io/concepts/content-addressing/#identifier-formats) // because most cid v0s appear to be incompatible with IPFS subdomains return { diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 115469530e..64dd8a062c 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -59,7 +59,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": ">=16.0.0" diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 20a0289d30..b955da1497 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -56,7 +56,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": ">=16.0.0" diff --git a/scripts/create-package/package-template/package.json b/scripts/create-package/package-template/package.json index a29504c50b..f132df5942 100644 --- a/scripts/create-package/package-template/package.json +++ b/scripts/create-package/package-template/package.json @@ -46,7 +46,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "NODE_VERSIONS" diff --git a/yarn.lock b/yarn.lock index 3116db5dde..56859f2d44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1877,7 +1877,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -2400,11 +2400,11 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-api@npm:^6.1.1": - version: 6.1.1 - resolution: "@metamask/keyring-api@npm:6.1.1" +"@metamask/keyring-api@npm:6.1.0": + version: 6.1.0 + resolution: "@metamask/keyring-api@npm:6.1.0" dependencies: - "@metamask/snaps-sdk": ^4.2.0 + "@metamask/snaps-sdk": ^4.0.0 "@metamask/utils": ^8.3.0 "@types/uuid": ^9.0.1 bech32: ^2.0.0 @@ -2412,7 +2412,23 @@ __metadata: uuid: ^9.0.0 peerDependencies: "@metamask/providers": ">=15 <17" - checksum: 5a9ed008e19062c84ec8fd019ad29f9ebb7d8d8464bbe5da70ad26e6aceb57e4d98a9762e7cd9fea4ac7de0cdc08bfc0a5bf598770749aa9abdbe6d1840fb627 + checksum: 493aff0569b2f62a9cbbda82e5b9df709562f5f11d32f5d97224a7d29be1bbd7139e23f1384d9d888e2e90d3858e64ff499c03780b3664d31724a054722b4e0a + languageName: node + linkType: hard + +"@metamask/keyring-api@patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": + version: 6.1.0 + resolution: "@metamask/keyring-api@patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch::version=6.1.0&hash=b59588&locator=%40metamask%2Fcore-monorepo%40workspace%3A." + dependencies: + "@metamask/snaps-sdk": ^4.0.0 + "@metamask/utils": ^8.3.0 + "@types/uuid": ^9.0.1 + bech32: ^2.0.0 + superstruct: ^1.0.3 + uuid: ^9.0.0 + peerDependencies: + "@metamask/providers": ">=15 <17" + checksum: 91cd853cc4c2c35c322a896491a8992a61aea786871181dbf41e3e5c06aa476c8ca2f9e9b046f722927b219b8201791b28f382315e728c46d0381885b953f195 languageName: node linkType: hard @@ -2745,7 +2761,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -12179,16 +12195,6 @@ __metadata: languageName: node linkType: hard -"typescript@npm:~4.9.5": - version: 4.9.5 - resolution: "typescript@npm:4.9.5" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: ee000bc26848147ad423b581bd250075662a354d84f0e06eb76d3b892328d8d4440b7487b5a83e851b12b255f55d71835b008a66cbf8f255a11e4400159237db - languageName: node - linkType: hard - "typescript@npm:~5.0.4": version: 5.0.4 resolution: "typescript@npm:5.0.4" @@ -12199,16 +12205,6 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@~4.9.5#~builtin": - version: 4.9.5 - resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin::version=4.9.5&hash=d73830" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20 - languageName: node - linkType: hard - "typescript@patch:typescript@~5.0.4#~builtin": version: 5.0.4 resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=d73830"