@cowprotocol/sdk-order-book 3.0.0 → 3.1.0

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/dist/index.js CHANGED
@@ -490,11 +490,14 @@ var OrderBookApi = class {
490
490
  */
491
491
  fetch(params, contextOverride = {}) {
492
492
  const context = this.getContextWithOverride(contextOverride);
493
- const { chainId, backoffOpts: _backoffOpts, apiKey } = context;
493
+ const { chainId, backoffOpts: _backoffOpts, apiKey, bearerToken } = context;
494
494
  const baseUrl = this.getApiBaseUrls(context)[chainId];
495
495
  const backoffOpts = _backoffOpts || DEFAULT_BACKOFF_OPTIONS;
496
496
  const rateLimiter = contextOverride.limiterOpts ? new import_limiter.RateLimiter(contextOverride.limiterOpts) : this.rateLimiter;
497
- const additionalHeaders = apiKey ? { "X-API-Key": apiKey } : void 0;
497
+ const additionalHeaders = {
498
+ ...bearerToken ? { Authorization: `Bearer ${bearerToken}` } : void 0,
499
+ ...apiKey ? { "X-API-Key": apiKey } : void 0
500
+ };
498
501
  (0, import_sdk_common.log)(`Fetching OrderBook API: ${baseUrl}${params.path}. Params: ${JSON.stringify(params, import_sdk_common.jsonWithBigintReplacer)}`);
499
502
  return request(baseUrl, params, rateLimiter, backoffOpts, additionalHeaders);
500
503
  }
package/dist/index.mjs CHANGED
@@ -441,11 +441,14 @@ var OrderBookApi = class {
441
441
  */
442
442
  fetch(params, contextOverride = {}) {
443
443
  const context = this.getContextWithOverride(contextOverride);
444
- const { chainId, backoffOpts: _backoffOpts, apiKey } = context;
444
+ const { chainId, backoffOpts: _backoffOpts, apiKey, bearerToken } = context;
445
445
  const baseUrl = this.getApiBaseUrls(context)[chainId];
446
446
  const backoffOpts = _backoffOpts || DEFAULT_BACKOFF_OPTIONS;
447
447
  const rateLimiter = contextOverride.limiterOpts ? new RateLimiter(contextOverride.limiterOpts) : this.rateLimiter;
448
- const additionalHeaders = apiKey ? { "X-API-Key": apiKey } : void 0;
448
+ const additionalHeaders = {
449
+ ...bearerToken ? { Authorization: `Bearer ${bearerToken}` } : void 0,
450
+ ...apiKey ? { "X-API-Key": apiKey } : void 0
451
+ };
449
452
  log(`Fetching OrderBook API: ${baseUrl}${params.path}. Params: ${JSON.stringify(params, jsonWithBigintReplacer)}`);
450
453
  return request(baseUrl, params, rateLimiter, backoffOpts, additionalHeaders);
451
454
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-order-book",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "CowProtocol Order Book package",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,8 +36,8 @@
36
36
  "cross-fetch": "^3.2.0",
37
37
  "exponential-backoff": "^3.1.2",
38
38
  "limiter": "^3.0.0",
39
- "@cowprotocol/sdk-config": "2.0.0",
40
- "@cowprotocol/sdk-common": "0.10.2"
39
+ "@cowprotocol/sdk-common": "0.10.3",
40
+ "@cowprotocol/sdk-config": "2.1.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsup src/index.ts --format esm,cjs --dts",