diff --git a/package.json b/package.json index 197e8ee6c..ccea37924 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@snapshot-labs/snapshot.js", - "version": "0.12.4", + "version": "0.12.5", "repository": "snapshot-labs/snapshot.js", "license": "MIT", "main": "dist/snapshot.cjs.js", diff --git a/src/utils.ts b/src/utils.ts index 75337cf00..a3115c826 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 (options.variables) 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 {