@0xsequence/indexer 0.43.15 → 0.43.16

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.
@@ -232,9 +232,10 @@ exports.SequenceIndexerServices = void 0;
232
232
  SequenceIndexerServices["BSC_TESTNET"] = "https://bsc-testnet-indexer.sequence.app";
233
233
  SequenceIndexerServices["GOERLI"] = "https://goerli-indexer.sequence.app";
234
234
  })(exports.SequenceIndexerServices || (exports.SequenceIndexerServices = {}));
235
+ const fetch = global ? global.fetch : window.fetch;
235
236
  class SequenceIndexerClient extends Indexer {
236
237
  constructor(hostname, jwtAuth) {
237
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
238
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
238
239
  this.jwtAuth = jwtAuth;
239
240
  this._fetch = (input, init) => {
240
241
  // automatically include jwt auth header to requests
@@ -246,7 +247,7 @@ class SequenceIndexerClient extends Indexer {
246
247
 
247
248
  // before the request is made
248
249
  init.headers = _extends({}, init.headers, headers);
249
- return global.fetch(input, init);
250
+ return fetch(input, init);
250
251
  };
251
252
  this.fetch = this._fetch;
252
253
  }
@@ -232,9 +232,10 @@ exports.SequenceIndexerServices = void 0;
232
232
  SequenceIndexerServices["BSC_TESTNET"] = "https://bsc-testnet-indexer.sequence.app";
233
233
  SequenceIndexerServices["GOERLI"] = "https://goerli-indexer.sequence.app";
234
234
  })(exports.SequenceIndexerServices || (exports.SequenceIndexerServices = {}));
235
+ const fetch = global ? global.fetch : window.fetch;
235
236
  class SequenceIndexerClient extends Indexer {
236
237
  constructor(hostname, jwtAuth) {
237
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
238
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
238
239
  this.jwtAuth = jwtAuth;
239
240
  this._fetch = (input, init) => {
240
241
  // automatically include jwt auth header to requests
@@ -246,7 +247,7 @@ class SequenceIndexerClient extends Indexer {
246
247
 
247
248
  // before the request is made
248
249
  init.headers = _extends({}, init.headers, headers);
249
- return global.fetch(input, init);
250
+ return fetch(input, init);
250
251
  };
251
252
  this.fetch = this._fetch;
252
253
  }
@@ -228,9 +228,10 @@ let SequenceIndexerServices;
228
228
  SequenceIndexerServices["BSC_TESTNET"] = "https://bsc-testnet-indexer.sequence.app";
229
229
  SequenceIndexerServices["GOERLI"] = "https://goerli-indexer.sequence.app";
230
230
  })(SequenceIndexerServices || (SequenceIndexerServices = {}));
231
+ const fetch = global ? global.fetch : window.fetch;
231
232
  class SequenceIndexerClient extends Indexer {
232
233
  constructor(hostname, jwtAuth) {
233
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
234
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
234
235
  this.jwtAuth = jwtAuth;
235
236
  this._fetch = (input, init) => {
236
237
  // automatically include jwt auth header to requests
@@ -242,7 +243,7 @@ class SequenceIndexerClient extends Indexer {
242
243
 
243
244
  // before the request is made
244
245
  init.headers = _extends({}, init.headers, headers);
245
- return global.fetch(input, init);
246
+ return fetch(input, init);
246
247
  };
247
248
  this.fetch = this._fetch;
248
249
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/indexer",
3
- "version": "0.43.15",
3
+ "version": "0.43.16",
4
4
  "description": "indexer sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/indexer",
6
6
  "source": "src/index.ts",
package/src/index.ts CHANGED
@@ -22,9 +22,11 @@ export enum SequenceIndexerServices {
22
22
  GOERLI = 'https://goerli-indexer.sequence.app'
23
23
  }
24
24
 
25
+ const fetch = global ? global.fetch : window.fetch
26
+
25
27
  export class SequenceIndexerClient extends IndexerRpc {
26
28
  constructor(hostname: string, public jwtAuth?: string) {
27
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch)
29
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
28
30
  this.fetch = this._fetch
29
31
  }
30
32
 
@@ -39,7 +41,7 @@ export class SequenceIndexerClient extends IndexerRpc {
39
41
  // before the request is made
40
42
  init!.headers = { ...init!.headers, ...headers }
41
43
 
42
- return global.fetch(input, init)
44
+ return fetch(input, init)
43
45
  }
44
46
  }
45
47
 
@@ -54,4 +56,4 @@ export class SequenceIndexerClient extends IndexerRpc {
54
56
  // })
55
57
  // }
56
58
 
57
- // export { SequenceIndexerServices }
59
+ // export { SequenceIndexerServices }