@snapshot-labs/snapshot.js 0.12.4 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapshot-labs/snapshot.js",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "repository": "snapshot-labs/snapshot.js",
5
5
  "license": "MIT",
6
6
  "main": "dist/snapshot.cjs.js",
package/src/utils.ts CHANGED
@@ -254,6 +254,8 @@ export async function multicall(
254
254
  }
255
255
 
256
256
  export async function subgraphRequest(url: string, query, options: any = {}) {
257
+ const body: Record<string, any> = { query: jsonToGraphQLQuery({ query }) };
258
+ if (options.variables) body.variables = options.variables;
257
259
  const res = await fetch(url, {
258
260
  method: 'POST',
259
261
  headers: {
@@ -261,7 +263,7 @@ export async function subgraphRequest(url: string, query, options: any = {}) {
261
263
  'Content-Type': 'application/json',
262
264
  ...options?.headers
263
265
  },
264
- body: JSON.stringify({ query: jsonToGraphQLQuery({ query }) })
266
+ body: JSON.stringify(body)
265
267
  });
266
268
  let responseData: any = await res.text();
267
269
  try {