diff --git a/src/utils.ts b/src/utils.ts index 2feda326e..3bebf9d2c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -254,6 +254,8 @@ export async function multicall( } export async function subgraphRequest(url: string, query, options: any = {}) { + const body: Record = { query: jsonToGraphQLQuery({ query }) }; + if (body) body.variables = options.variables; const res = await fetch(url, { method: 'POST', headers: { @@ -261,7 +263,7 @@ export async function subgraphRequest(url: string, query, options: any = {}) { 'Content-Type': 'application/json', ...options?.headers }, - body: JSON.stringify({ query: jsonToGraphQLQuery({ query }) }) + body: JSON.stringify(body) }); let responseData: any = await res.text(); try {