From dca55dd9aa46d8635b30ee2254f2be3193cb6fa0 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Wed, 22 Jan 2025 11:09:10 +0100 Subject: [PATCH] Remove cross-fetch --- package.json | 2 -- setupTests.js | 3 --- src/api/fetchDocFromCid.ts | 1 - src/api/uploadMetadataDocToIpfsLegacy.ts | 2 -- yarn.lock | 2 +- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/package.json b/package.json index b126701..55882ca 100644 --- a/package.json +++ b/package.json @@ -52,13 +52,11 @@ }, "dependencies": { "ajv": "^8.11.0", - "cross-fetch": "^3.1.5", "ipfs-only-hash": "^4.0.0", "json-stringify-deterministic": "^1.0.8", "multiformats": "^9.6.4" }, "peerDependencies": { - "cross-fetch": "^3.x", "ethers": "^5.0.0", "ipfs-only-hash": "^4.x", "multiformats": "^9.x" diff --git a/setupTests.js b/setupTests.js index 2360fc5..dd3e916 100644 --- a/setupTests.js +++ b/setupTests.js @@ -3,6 +3,3 @@ import fetchMock from 'jest-fetch-mock' global.window = global fetchMock.enableMocks() - -jest.setMock('cross-fetch', fetchMock) - diff --git a/src/api/fetchDocFromCid.ts b/src/api/fetchDocFromCid.ts index 832c850..f3e2936 100644 --- a/src/api/fetchDocFromCid.ts +++ b/src/api/fetchDocFromCid.ts @@ -9,7 +9,6 @@ import { DEFAULT_IPFS_READ_URI } from '../consts' * @returns */ export async function fetchDocFromCid(cid: string, ipfsUri = DEFAULT_IPFS_READ_URI): Promise { - const { default: fetch } = await import('cross-fetch') const response = await fetch(`${ipfsUri}/${cid}`) return await response.json() diff --git a/src/api/uploadMetadataDocToIpfsLegacy.ts b/src/api/uploadMetadataDocToIpfsLegacy.ts index 46e9196..f8ec66b 100644 --- a/src/api/uploadMetadataDocToIpfsLegacy.ts +++ b/src/api/uploadMetadataDocToIpfsLegacy.ts @@ -42,8 +42,6 @@ export async function _pinJsonInPinataIpfs( file: unknown, { writeUri = DEFAULT_IPFS_WRITE_URI, pinataApiKey = '', pinataApiSecret = '' }: Ipfs ): Promise { - const { default: fetch } = await import('cross-fetch') - if (!pinataApiKey || !pinataApiSecret) { throw new MetaDataError('You need to pass IPFS api credentials.') } diff --git a/yarn.lock b/yarn.lock index 59d2a9e..55341b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3118,7 +3118,7 @@ create-require@^1.1.0: resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-fetch@^3.0.4, cross-fetch@^3.1.5: +cross-fetch@^3.0.4: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==