From b6a4c2f66e53372268bd28f0aff9891c26cc6b09 Mon Sep 17 00:00:00 2001 From: Petar Penovic Date: Tue, 7 Jan 2025 14:44:45 +0100 Subject: [PATCH 1/2] fix: limit fetch dependencies to patch versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b8360221e..05d72fbb8 100644 --- a/package.json +++ b/package.json @@ -101,8 +101,8 @@ "@scure/base": "1.2.1", "@scure/starknet": "1.1.0", "abi-wan-kanabi": "^2.2.3", - "fetch-cookie": "^3.0.0", - "isomorphic-fetch": "^3.0.0", + "fetch-cookie": "~3.0.0", + "isomorphic-fetch": "~3.0.0", "lossless-json": "^4.0.1", "pako": "^2.0.4", "starknet-types-07": "npm:@starknet-io/types-js@^0.7.10", From 49f02ee1a3380d0c938af4c5a67df5ea7706f548 Mon Sep 17 00:00:00 2001 From: Petar Penovic Date: Tue, 7 Jan 2025 14:46:04 +0100 Subject: [PATCH 2/2] fix: bind window in fetch utility for browser environments --- src/utils/fetchPonyfill.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/fetchPonyfill.ts b/src/utils/fetchPonyfill.ts index 02888b3a6..0bf2bfae6 100644 --- a/src/utils/fetchPonyfill.ts +++ b/src/utils/fetchPonyfill.ts @@ -5,6 +5,6 @@ import isomorphicFetch from 'isomorphic-fetch'; import { IS_BROWSER } from './encode'; import { isUndefined } from './typed'; -export default (IS_BROWSER && window.fetch) || // use built-in fetch in browser if available +export default (IS_BROWSER && window.fetch.bind(window)) || // use built-in fetch in browser if available (!isUndefined(global) && makeFetchCookie(global.fetch)) || // use built-in fetch in node, react-native and service worker if available isomorphicFetch; // ponyfill fetch in node and browsers that don't have it