Skip to content

Commit fb59f01

Browse files
authored
fix: use fetch from snapshot.js (#1036)
1 parent 89a3440 commit fb59f01

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/graphql/helpers.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import graphqlFields from 'graphql-fields';
33
import castArray from 'lodash/castArray';
44
import intersection from 'lodash/intersection';
55
import uniq from 'lodash/uniq';
6-
import fetch from 'node-fetch';
76
import db from '../helpers/mysql';
87
import { spacesMetadata } from '../helpers/spaces';
98
import { jsonParse } from '../helpers/utils';
@@ -531,18 +530,21 @@ async function getControllerDomains(address: string): Promise<string[]> {
531530
};
532531

533532
try {
534-
const response = await fetch(process.env.STAMP_URL ?? 'https://stamp.fyi', {
535-
method: 'POST',
536-
headers: {
537-
Accept: 'application/json',
538-
'Content-Type': 'application/json'
539-
},
540-
body: JSON.stringify({
541-
method: 'lookup_domains',
542-
params: address,
543-
network: network === 'testnet' ? ['11155111', '157'] : ['1', '109']
544-
})
545-
});
533+
const response = await snapshot.utils.fetch(
534+
process.env.STAMP_URL ?? 'https://stamp.fyi',
535+
{
536+
method: 'POST',
537+
headers: {
538+
Accept: 'application/json',
539+
'Content-Type': 'application/json'
540+
},
541+
body: JSON.stringify({
542+
method: 'lookup_domains',
543+
params: address,
544+
network: network === 'testnet' ? ['11155111', '157'] : ['1', '109']
545+
})
546+
} as any
547+
);
546548
const { result, error } = (await response.json()) as JsonRpcResponse;
547549

548550
if (error) throw new PublicError("Failed to resolve controller's domains");

0 commit comments

Comments
 (0)