@0xsequence/api 0.43.15 → 0.43.17

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.
@@ -582,9 +582,10 @@ const buildResponse = res => {
582
582
  });
583
583
  };
584
584
 
585
+ const fetch = global.fetch ;
585
586
  class SequenceAPIClient extends API {
586
587
  constructor(hostname, jwtAuth) {
587
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
588
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
588
589
  this.jwtAuth = jwtAuth;
589
590
  this._fetch = (input, init) => {
590
591
  // automatically include jwt auth header to requests
@@ -596,7 +597,7 @@ class SequenceAPIClient extends API {
596
597
 
597
598
  // before the request is made
598
599
  init.headers = _extends({}, init.headers, headers);
599
- return global.fetch(input, init);
600
+ return fetch(input, init);
600
601
  };
601
602
  this.fetch = this._fetch;
602
603
  }
@@ -582,9 +582,10 @@ const buildResponse = res => {
582
582
  });
583
583
  };
584
584
 
585
+ const fetch = global.fetch ;
585
586
  class SequenceAPIClient extends API {
586
587
  constructor(hostname, jwtAuth) {
587
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
588
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
588
589
  this.jwtAuth = jwtAuth;
589
590
  this._fetch = (input, init) => {
590
591
  // automatically include jwt auth header to requests
@@ -596,7 +597,7 @@ class SequenceAPIClient extends API {
596
597
 
597
598
  // before the request is made
598
599
  init.headers = _extends({}, init.headers, headers);
599
- return global.fetch(input, init);
600
+ return fetch(input, init);
600
601
  };
601
602
  this.fetch = this._fetch;
602
603
  }
@@ -578,9 +578,10 @@ const buildResponse = res => {
578
578
  });
579
579
  };
580
580
 
581
+ const fetch = global.fetch ;
581
582
  class SequenceAPIClient extends API {
582
583
  constructor(hostname, jwtAuth) {
583
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
584
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
584
585
  this.jwtAuth = jwtAuth;
585
586
  this._fetch = (input, init) => {
586
587
  // automatically include jwt auth header to requests
@@ -592,7 +593,7 @@ class SequenceAPIClient extends API {
592
593
 
593
594
  // before the request is made
594
595
  init.headers = _extends({}, init.headers, headers);
595
- return global.fetch(input, init);
596
+ return fetch(input, init);
596
597
  };
597
598
  this.fetch = this._fetch;
598
599
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/api",
3
- "version": "0.43.15",
3
+ "version": "0.43.17",
4
4
  "description": "api sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/api",
6
6
  "source": "src/index.ts",
package/src/index.ts CHANGED
@@ -2,9 +2,11 @@ export * from './api.gen'
2
2
 
3
3
  import { API as ApiRpc } from './api.gen'
4
4
 
5
+ const fetch = typeof 'global' !== undefined ? global.fetch : window.fetch
6
+
5
7
  export class SequenceAPIClient extends ApiRpc {
6
8
  constructor(hostname: string, public jwtAuth?: string) {
7
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch)
9
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
8
10
  this.fetch = this._fetch
9
11
  }
10
12
 
@@ -19,6 +21,6 @@ export class SequenceAPIClient extends ApiRpc {
19
21
  // before the request is made
20
22
  init!.headers = { ...init!.headers, ...headers }
21
23
 
22
- return global.fetch(input, init)
24
+ return fetch(input, init)
23
25
  }
24
26
  }