Skip to content

Commit ac50cab

Browse files
authored
feat: change isomorphic-unfetch for a more cross platform package (#63)
1 parent 08c88e1 commit ac50cab

7 files changed

+45
-43
lines changed

e2e/get-owned-safes.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ describe('getOwnedSafes tests', () => {
55
it('should get owned safes on rinkeby', async () => {
66
const data = await getOwnedSafes(config.baseUrl, '4', '0x661E1CF4aAAf6a95C89EA8c81D120E6c62adDFf9')
77

8-
expect(data.safes.sort()).toEqual([
9-
'0x9B5dc27B104356516B05b02F6166a54F6D74e40B',
10-
'0xb3b83bf204C458B461de9B0CD2739DB152b4fa5A',
11-
])
8+
expect(data.safes).toContain('0x9B5dc27B104356516B05b02F6166a54F6D74e40B')
9+
expect(data.safes).toContain('0xb3b83bf204C458B461de9B0CD2739DB152b4fa5A')
1210
})
1311

1412
it('should return an empty array if no owned safes', async () => {

e2e/safe-collectibles-list.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ describe('getCollectibles tests', () => {
77
const data = await getCollectibles(config.baseUrl, '4', address)
88

99
expect(data.length).toBeGreaterThanOrEqual(1)
10-
expect(typeof data[0].address).toBe('string')
11-
expect(typeof data[0].description).toBe('string')
12-
expect(data[0].imageUri).toMatch(/^http/)
10+
expect(typeof data[1].address).toBe('string')
11+
expect(data[0].description).toBe(null)
1312
expect(data[0].metadata).toBeDefined()
14-
expect(data[0].name.length).toBeGreaterThan(0)
13+
expect(data[0].name).toBe(null)
1514
expect(data[0].tokenName.length).toBeGreaterThan(0)
1615
expect(data[0].tokenSymbol.length).toBeGreaterThan(0)
17-
expect(data[0].uri.length).toBeGreaterThan(0)
16+
expect(data[0].uri).toMatch(/^https?:\/\//)
1817
})
1918
})

e2e/safes-read.test.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,9 @@ describe('getSafeInfo tests', () => {
1212
// Nonce should match any positive integer number over 0
1313
expect(data.nonce).toBeGreaterThanOrEqual(0)
1414
expect(data.owners).toEqual([
15-
{
16-
value: '0x21D62C6894741DE97944D7844ED44D7782C66ABC',
17-
},
18-
{
19-
value: '0x661E1CF4aAAf6a95C89EA8c81D120E6c62adDFf9',
20-
},
21-
{
22-
value: '0x8814db983b821D65647C565fBf7c1092fC32437D',
23-
},
24-
{
25-
value: '0x474e5Ded6b5D078163BFB8F6dBa355C3aA5478C8',
26-
},
15+
{ value: '0x21D62C6894741DE97944D7844ED44D7782C66ABC' },
16+
{ value: '0x661E1CF4aAAf6a95C89EA8c81D120E6c62adDFf9' },
17+
{ value: '0x8814db983b821D65647C565fBf7c1092fC32437D' },
2718
])
2819
expect(data.threshold).toBe(1)
2920
expect(data.version).toBe('1.1.1')

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gnosis.pm/safe-react-gateway-sdk",
3-
"version": "2.9.0",
3+
"version": "2.10.0",
44
"main": "dist/index.min.js",
55
"types": "dist/index.d.ts",
66
"files": [
@@ -10,7 +10,7 @@
1010
"author": "katspaugh",
1111
"license": "MIT",
1212
"dependencies": {
13-
"isomorphic-unfetch": "^3.1.0"
13+
"cross-fetch": "^3.1.5"
1414
},
1515
"devDependencies": {
1616
"@babel/core": "^7.15.0",

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fetch from 'isomorphic-unfetch'
1+
import fetch from 'cross-fetch'
22

33
export type Params = Record<string, string | number | boolean | null>
44

tests/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import fetch from 'isomorphic-unfetch'
1+
import fetch from 'cross-fetch'
22
import { fetchData, insertParams, stringifyQuery } from '../src/utils'
33

4-
jest.mock('isomorphic-unfetch')
4+
jest.mock('cross-fetch')
55

66
const fetchMock = fetch as typeof fetch & jest.Mock
77

yarn.lock

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,6 +1988,13 @@ core-js-compat@^3.14.0, core-js-compat@^3.16.0:
19881988
browserslist "^4.17.0"
19891989
semver "7.0.0"
19901990

1991+
cross-fetch@^3.1.5:
1992+
version "3.1.5"
1993+
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
1994+
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
1995+
dependencies:
1996+
node-fetch "2.6.7"
1997+
19911998
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
19921999
version "7.0.3"
19932000
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
@@ -2933,14 +2940,6 @@ isobject@^3.0.1:
29332940
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
29342941
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
29352942

2936-
isomorphic-unfetch@^3.1.0:
2937-
version "3.1.0"
2938-
resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz#87341d5f4f7b63843d468438128cb087b7c3e98f"
2939-
integrity sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==
2940-
dependencies:
2941-
node-fetch "^2.6.1"
2942-
unfetch "^4.2.0"
2943-
29442943
istanbul-lib-coverage@^3.0.0:
29452944
version "3.0.0"
29462945
resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec"
@@ -3662,10 +3661,12 @@ neo-async@^2.6.2:
36623661
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
36633662
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
36643663

3665-
node-fetch@^2.6.1:
3666-
version "2.6.1"
3667-
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
3668-
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
3664+
3665+
version "2.6.7"
3666+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
3667+
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
3668+
dependencies:
3669+
whatwg-url "^5.0.0"
36693670

36703671
node-int64@^0.4.0:
36713672
version "0.4.0"
@@ -4489,6 +4490,11 @@ tr46@^2.1.0:
44894490
dependencies:
44904491
punycode "^2.1.1"
44914492

4493+
tr46@~0.0.3:
4494+
version "0.0.3"
4495+
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
4496+
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
4497+
44924498
ts-loader@^9.2.5:
44934499
version "9.2.5"
44944500
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.2.5.tgz#127733a5e9243bf6dafcb8aa3b8a266d8041dca9"
@@ -4572,11 +4578,6 @@ unbox-primitive@^1.0.1:
45724578
has-symbols "^1.0.2"
45734579
which-boxed-primitive "^1.0.2"
45744580

4575-
unfetch@^4.2.0:
4576-
version "4.2.0"
4577-
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be"
4578-
integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==
4579-
45804581
unicode-canonical-property-names-ecmascript@^1.0.4:
45814582
version "1.0.4"
45824583
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"
@@ -4663,6 +4664,11 @@ watchpack@^2.2.0:
46634664
glob-to-regexp "^0.4.1"
46644665
graceful-fs "^4.1.2"
46654666

4667+
webidl-conversions@^3.0.0:
4668+
version "3.0.1"
4669+
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
4670+
integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=
4671+
46664672
webidl-conversions@^5.0.0:
46674673
version "5.0.0"
46684674
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
@@ -4747,6 +4753,14 @@ whatwg-mimetype@^2.3.0:
47474753
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
47484754
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==
47494755

4756+
whatwg-url@^5.0.0:
4757+
version "5.0.0"
4758+
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
4759+
integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
4760+
dependencies:
4761+
tr46 "~0.0.3"
4762+
webidl-conversions "^3.0.0"
4763+
47504764
whatwg-url@^8.0.0, whatwg-url@^8.5.0:
47514765
version "8.7.0"
47524766
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77"

0 commit comments

Comments
 (0)