@aurigami/sdk 1.4.2 → 1.4.4

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,5 +1,5 @@
1
1
  {
2
- "version": "1.4.2",
2
+ "version": "1.4.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,13 +1,17 @@
1
- import fetch from 'node-fetch';
1
+ import fetch, { Headers, Request, Response } from 'node-fetch';
2
2
 
3
3
  const AURORA_API_BASE_URL = 'https://api.aurorascan.dev/api';
4
4
 
5
5
  export async function getQuery(
6
6
  module: string, action: string, params: Record<string, any> = {},
7
7
  ): Promise<any> {
8
+ if (!globalThis.fetch) {
9
+ Object.assign(globalThis, { fetch, Headers, Request, Response })
10
+ }
11
+
8
12
  params = {...params, 'module': module, 'action': action};
9
13
 
10
- let resp = await fetch(AURORA_API_BASE_URL + '?' + new URLSearchParams(params), {
14
+ let resp = await globalThis.fetch(AURORA_API_BASE_URL + '?' + new URLSearchParams(params), {
11
15
  headers: { 'Content-Type': 'application/json' },
12
16
  method: 'GET'
13
17
  });