@0xsequence/api 0.0.0-20231107191824 → 0.0.0-20231108174744

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.
@@ -600,28 +600,21 @@ const buildResponse = res => {
600
600
 
601
601
  const fetch = typeof global === 'object' ? global.fetch : window.fetch;
602
602
  class SequenceAPIClient extends API {
603
- constructor(hostname, authorization) {
603
+ constructor(hostname, jwtAuth) {
604
604
  super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
605
605
  this._fetch = (input, init) => {
606
606
  // automatically include jwt auth header to requests
607
607
  // if its been set on the api client
608
608
  const headers = {};
609
- const {
610
- jwtAuth,
611
- accessKey
612
- } = this.authorization || {};
613
- if (jwtAuth && jwtAuth.length > 0) {
614
- headers['Authorization'] = `BEARER ${jwtAuth}`;
615
- }
616
- if (accessKey && accessKey.length > 0) {
617
- headers['X-Access-Key'] = `${accessKey}`;
609
+ if (this.jwtAuth && this.jwtAuth.length > 0) {
610
+ headers['Authorization'] = `BEARER ${this.jwtAuth}`;
618
611
  }
619
612
 
620
613
  // before the request is made
621
614
  init.headers = _extends({}, init.headers, headers);
622
615
  return fetch(input, init);
623
616
  };
624
- this.authorization = authorization;
617
+ this.jwtAuth = jwtAuth;
625
618
  this.fetch = this._fetch;
626
619
  }
627
620
  }
@@ -600,28 +600,21 @@ const buildResponse = res => {
600
600
 
601
601
  const fetch = typeof global === 'object' ? global.fetch : window.fetch;
602
602
  class SequenceAPIClient extends API {
603
- constructor(hostname, authorization) {
603
+ constructor(hostname, jwtAuth) {
604
604
  super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
605
605
  this._fetch = (input, init) => {
606
606
  // automatically include jwt auth header to requests
607
607
  // if its been set on the api client
608
608
  const headers = {};
609
- const {
610
- jwtAuth,
611
- accessKey
612
- } = this.authorization || {};
613
- if (jwtAuth && jwtAuth.length > 0) {
614
- headers['Authorization'] = `BEARER ${jwtAuth}`;
615
- }
616
- if (accessKey && accessKey.length > 0) {
617
- headers['X-Access-Key'] = `${accessKey}`;
609
+ if (this.jwtAuth && this.jwtAuth.length > 0) {
610
+ headers['Authorization'] = `BEARER ${this.jwtAuth}`;
618
611
  }
619
612
 
620
613
  // before the request is made
621
614
  init.headers = _extends({}, init.headers, headers);
622
615
  return fetch(input, init);
623
616
  };
624
- this.authorization = authorization;
617
+ this.jwtAuth = jwtAuth;
625
618
  this.fetch = this._fetch;
626
619
  }
627
620
  }
@@ -596,28 +596,21 @@ const buildResponse = res => {
596
596
 
597
597
  const fetch = typeof global === 'object' ? global.fetch : window.fetch;
598
598
  class SequenceAPIClient extends API {
599
- constructor(hostname, authorization) {
599
+ constructor(hostname, jwtAuth) {
600
600
  super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
601
601
  this._fetch = (input, init) => {
602
602
  // automatically include jwt auth header to requests
603
603
  // if its been set on the api client
604
604
  const headers = {};
605
- const {
606
- jwtAuth,
607
- accessKey
608
- } = this.authorization || {};
609
- if (jwtAuth && jwtAuth.length > 0) {
610
- headers['Authorization'] = `BEARER ${jwtAuth}`;
611
- }
612
- if (accessKey && accessKey.length > 0) {
613
- headers['X-Access-Key'] = `${accessKey}`;
605
+ if (this.jwtAuth && this.jwtAuth.length > 0) {
606
+ headers['Authorization'] = `BEARER ${this.jwtAuth}`;
614
607
  }
615
608
 
616
609
  // before the request is made
617
610
  init.headers = _extends({}, init.headers, headers);
618
611
  return fetch(input, init);
619
612
  };
620
- this.authorization = authorization;
613
+ this.jwtAuth = jwtAuth;
621
614
  this.fetch = this._fetch;
622
615
  }
623
616
  }
@@ -1,13 +1,7 @@
1
1
  export * from "./api.gen.js";
2
2
  import { API as ApiRpc } from "./api.gen.js";
3
3
  export declare class SequenceAPIClient extends ApiRpc {
4
- authorization?: {
5
- jwtAuth?: string | undefined;
6
- accessKey?: string | undefined;
7
- } | undefined;
8
- constructor(hostname: string, authorization?: {
9
- jwtAuth?: string | undefined;
10
- accessKey?: string | undefined;
11
- } | undefined);
4
+ jwtAuth?: string | undefined;
5
+ constructor(hostname: string, jwtAuth?: string | undefined);
12
6
  _fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
13
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/api",
3
- "version": "0.0.0-20231107191824",
3
+ "version": "0.0.0-20231108174744",
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
@@ -7,10 +7,7 @@ const fetch = typeof global === 'object' ? global.fetch : window.fetch
7
7
  export class SequenceAPIClient extends ApiRpc {
8
8
  constructor(
9
9
  hostname: string,
10
- public authorization?: {
11
- jwtAuth?: string
12
- accessKey?: string
13
- }
10
+ public jwtAuth?: string
14
11
  ) {
15
12
  super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
16
13
  this.fetch = this._fetch
@@ -20,15 +17,8 @@ export class SequenceAPIClient extends ApiRpc {
20
17
  // automatically include jwt auth header to requests
21
18
  // if its been set on the api client
22
19
  const headers: { [key: string]: any } = {}
23
-
24
- const { jwtAuth, accessKey } = this.authorization || {}
25
-
26
- if (jwtAuth && jwtAuth.length > 0) {
27
- headers['Authorization'] = `BEARER ${jwtAuth}`
28
- }
29
-
30
- if (accessKey && accessKey.length > 0) {
31
- headers['X-Access-Key'] = `${accessKey}`
20
+ if (this.jwtAuth && this.jwtAuth.length > 0) {
21
+ headers['Authorization'] = `BEARER ${this.jwtAuth}`
32
22
  }
33
23
 
34
24
  // before the request is made