Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed May 22, 2024
1 parent b8c61c5 commit 92db09e
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 53 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 18 additions & 18 deletions packages/assets-controllers/src/assetsUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,83 +254,83 @@ 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' });
});
});

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,
),
).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,
),
).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,
),
).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,
),
).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,
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/src/assetsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/profile-sync-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-package/package-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
50 changes: 23 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2400,19 +2400,35 @@ __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
superstruct: ^1.0.3
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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand All @@ -12199,16 +12205,6 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@~4.9.5#~builtin<compat/typescript>":
version: 4.9.5
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::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<compat/typescript>":
version: 5.0.4
resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin<compat/typescript>::version=5.0.4&hash=d73830"
Expand Down

0 comments on commit 92db09e

Please sign in to comment.