@cowprotocol/sdk-order-book 3.0.0 → 3.2.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 +13 -6
- package/dist/index.mjs +13 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -191,7 +191,8 @@ var ORDER_BOOK_PROD_CONFIG = {
|
|
|
191
191
|
[import_sdk_config2.SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb`,
|
|
192
192
|
[import_sdk_config2.SupportedChainId.LINEA]: `${PROD_BASE_URL}/linea`,
|
|
193
193
|
[import_sdk_config2.SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`,
|
|
194
|
-
[import_sdk_config2.SupportedChainId.INK]: `${PROD_BASE_URL}/ink
|
|
194
|
+
[import_sdk_config2.SupportedChainId.INK]: `${PROD_BASE_URL}/ink`,
|
|
195
|
+
[import_sdk_config2.SupportedChainId.SOLANA]: `${PROD_BASE_URL}/solana`
|
|
195
196
|
};
|
|
196
197
|
var ORDER_BOOK_STAGING_CONFIG = {
|
|
197
198
|
[import_sdk_config2.SupportedChainId.MAINNET]: `${STAGING_BASE_URL}/mainnet`,
|
|
@@ -204,7 +205,8 @@ var ORDER_BOOK_STAGING_CONFIG = {
|
|
|
204
205
|
[import_sdk_config2.SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb`,
|
|
205
206
|
[import_sdk_config2.SupportedChainId.LINEA]: `${STAGING_BASE_URL}/linea`,
|
|
206
207
|
[import_sdk_config2.SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`,
|
|
207
|
-
[import_sdk_config2.SupportedChainId.INK]: `${STAGING_BASE_URL}/ink
|
|
208
|
+
[import_sdk_config2.SupportedChainId.INK]: `${STAGING_BASE_URL}/ink`,
|
|
209
|
+
[import_sdk_config2.SupportedChainId.SOLANA]: `${STAGING_BASE_URL}/solana`
|
|
208
210
|
};
|
|
209
211
|
var ORDER_BOOK_PARTNER_PROD_CONFIG = {
|
|
210
212
|
[import_sdk_config2.SupportedChainId.MAINNET]: `${PARTNER_PROD_BASE_URL}/mainnet`,
|
|
@@ -217,7 +219,8 @@ var ORDER_BOOK_PARTNER_PROD_CONFIG = {
|
|
|
217
219
|
[import_sdk_config2.SupportedChainId.BNB]: `${PARTNER_PROD_BASE_URL}/bnb`,
|
|
218
220
|
[import_sdk_config2.SupportedChainId.LINEA]: `${PARTNER_PROD_BASE_URL}/linea`,
|
|
219
221
|
[import_sdk_config2.SupportedChainId.PLASMA]: `${PARTNER_PROD_BASE_URL}/plasma`,
|
|
220
|
-
[import_sdk_config2.SupportedChainId.INK]: `${PARTNER_PROD_BASE_URL}/ink
|
|
222
|
+
[import_sdk_config2.SupportedChainId.INK]: `${PARTNER_PROD_BASE_URL}/ink`,
|
|
223
|
+
[import_sdk_config2.SupportedChainId.SOLANA]: `${PARTNER_PROD_BASE_URL}/solana`
|
|
221
224
|
};
|
|
222
225
|
var ORDER_BOOK_PARTNER_STAGING_CONFIG = {
|
|
223
226
|
[import_sdk_config2.SupportedChainId.MAINNET]: `${PARTNER_STAGING_BASE_URL}/mainnet`,
|
|
@@ -230,7 +233,8 @@ var ORDER_BOOK_PARTNER_STAGING_CONFIG = {
|
|
|
230
233
|
[import_sdk_config2.SupportedChainId.BNB]: `${PARTNER_STAGING_BASE_URL}/bnb`,
|
|
231
234
|
[import_sdk_config2.SupportedChainId.LINEA]: `${PARTNER_STAGING_BASE_URL}/linea`,
|
|
232
235
|
[import_sdk_config2.SupportedChainId.PLASMA]: `${PARTNER_STAGING_BASE_URL}/plasma`,
|
|
233
|
-
[import_sdk_config2.SupportedChainId.INK]: `${PARTNER_STAGING_BASE_URL}/ink
|
|
236
|
+
[import_sdk_config2.SupportedChainId.INK]: `${PARTNER_STAGING_BASE_URL}/ink`,
|
|
237
|
+
[import_sdk_config2.SupportedChainId.SOLANA]: `${PARTNER_STAGING_BASE_URL}/solana`
|
|
234
238
|
};
|
|
235
239
|
function cleanObjectFromUndefinedValues(obj) {
|
|
236
240
|
return Object.keys(obj).reduce(
|
|
@@ -490,11 +494,14 @@ var OrderBookApi = class {
|
|
|
490
494
|
*/
|
|
491
495
|
fetch(params, contextOverride = {}) {
|
|
492
496
|
const context = this.getContextWithOverride(contextOverride);
|
|
493
|
-
const { chainId, backoffOpts: _backoffOpts, apiKey } = context;
|
|
497
|
+
const { chainId, backoffOpts: _backoffOpts, apiKey, bearerToken } = context;
|
|
494
498
|
const baseUrl = this.getApiBaseUrls(context)[chainId];
|
|
495
499
|
const backoffOpts = _backoffOpts || DEFAULT_BACKOFF_OPTIONS;
|
|
496
500
|
const rateLimiter = contextOverride.limiterOpts ? new import_limiter.RateLimiter(contextOverride.limiterOpts) : this.rateLimiter;
|
|
497
|
-
const additionalHeaders =
|
|
501
|
+
const additionalHeaders = {
|
|
502
|
+
...bearerToken ? { Authorization: `Bearer ${bearerToken}` } : void 0,
|
|
503
|
+
...apiKey ? { "X-API-Key": apiKey } : void 0
|
|
504
|
+
};
|
|
498
505
|
(0, import_sdk_common.log)(`Fetching OrderBook API: ${baseUrl}${params.path}. Params: ${JSON.stringify(params, import_sdk_common.jsonWithBigintReplacer)}`);
|
|
499
506
|
return request(baseUrl, params, rateLimiter, backoffOpts, additionalHeaders);
|
|
500
507
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -142,7 +142,8 @@ var ORDER_BOOK_PROD_CONFIG = {
|
|
|
142
142
|
[SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb`,
|
|
143
143
|
[SupportedChainId.LINEA]: `${PROD_BASE_URL}/linea`,
|
|
144
144
|
[SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`,
|
|
145
|
-
[SupportedChainId.INK]: `${PROD_BASE_URL}/ink
|
|
145
|
+
[SupportedChainId.INK]: `${PROD_BASE_URL}/ink`,
|
|
146
|
+
[SupportedChainId.SOLANA]: `${PROD_BASE_URL}/solana`
|
|
146
147
|
};
|
|
147
148
|
var ORDER_BOOK_STAGING_CONFIG = {
|
|
148
149
|
[SupportedChainId.MAINNET]: `${STAGING_BASE_URL}/mainnet`,
|
|
@@ -155,7 +156,8 @@ var ORDER_BOOK_STAGING_CONFIG = {
|
|
|
155
156
|
[SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb`,
|
|
156
157
|
[SupportedChainId.LINEA]: `${STAGING_BASE_URL}/linea`,
|
|
157
158
|
[SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`,
|
|
158
|
-
[SupportedChainId.INK]: `${STAGING_BASE_URL}/ink
|
|
159
|
+
[SupportedChainId.INK]: `${STAGING_BASE_URL}/ink`,
|
|
160
|
+
[SupportedChainId.SOLANA]: `${STAGING_BASE_URL}/solana`
|
|
159
161
|
};
|
|
160
162
|
var ORDER_BOOK_PARTNER_PROD_CONFIG = {
|
|
161
163
|
[SupportedChainId.MAINNET]: `${PARTNER_PROD_BASE_URL}/mainnet`,
|
|
@@ -168,7 +170,8 @@ var ORDER_BOOK_PARTNER_PROD_CONFIG = {
|
|
|
168
170
|
[SupportedChainId.BNB]: `${PARTNER_PROD_BASE_URL}/bnb`,
|
|
169
171
|
[SupportedChainId.LINEA]: `${PARTNER_PROD_BASE_URL}/linea`,
|
|
170
172
|
[SupportedChainId.PLASMA]: `${PARTNER_PROD_BASE_URL}/plasma`,
|
|
171
|
-
[SupportedChainId.INK]: `${PARTNER_PROD_BASE_URL}/ink
|
|
173
|
+
[SupportedChainId.INK]: `${PARTNER_PROD_BASE_URL}/ink`,
|
|
174
|
+
[SupportedChainId.SOLANA]: `${PARTNER_PROD_BASE_URL}/solana`
|
|
172
175
|
};
|
|
173
176
|
var ORDER_BOOK_PARTNER_STAGING_CONFIG = {
|
|
174
177
|
[SupportedChainId.MAINNET]: `${PARTNER_STAGING_BASE_URL}/mainnet`,
|
|
@@ -181,7 +184,8 @@ var ORDER_BOOK_PARTNER_STAGING_CONFIG = {
|
|
|
181
184
|
[SupportedChainId.BNB]: `${PARTNER_STAGING_BASE_URL}/bnb`,
|
|
182
185
|
[SupportedChainId.LINEA]: `${PARTNER_STAGING_BASE_URL}/linea`,
|
|
183
186
|
[SupportedChainId.PLASMA]: `${PARTNER_STAGING_BASE_URL}/plasma`,
|
|
184
|
-
[SupportedChainId.INK]: `${PARTNER_STAGING_BASE_URL}/ink
|
|
187
|
+
[SupportedChainId.INK]: `${PARTNER_STAGING_BASE_URL}/ink`,
|
|
188
|
+
[SupportedChainId.SOLANA]: `${PARTNER_STAGING_BASE_URL}/solana`
|
|
185
189
|
};
|
|
186
190
|
function cleanObjectFromUndefinedValues(obj) {
|
|
187
191
|
return Object.keys(obj).reduce(
|
|
@@ -441,11 +445,14 @@ var OrderBookApi = class {
|
|
|
441
445
|
*/
|
|
442
446
|
fetch(params, contextOverride = {}) {
|
|
443
447
|
const context = this.getContextWithOverride(contextOverride);
|
|
444
|
-
const { chainId, backoffOpts: _backoffOpts, apiKey } = context;
|
|
448
|
+
const { chainId, backoffOpts: _backoffOpts, apiKey, bearerToken } = context;
|
|
445
449
|
const baseUrl = this.getApiBaseUrls(context)[chainId];
|
|
446
450
|
const backoffOpts = _backoffOpts || DEFAULT_BACKOFF_OPTIONS;
|
|
447
451
|
const rateLimiter = contextOverride.limiterOpts ? new RateLimiter(contextOverride.limiterOpts) : this.rateLimiter;
|
|
448
|
-
const additionalHeaders =
|
|
452
|
+
const additionalHeaders = {
|
|
453
|
+
...bearerToken ? { Authorization: `Bearer ${bearerToken}` } : void 0,
|
|
454
|
+
...apiKey ? { "X-API-Key": apiKey } : void 0
|
|
455
|
+
};
|
|
449
456
|
log(`Fetching OrderBook API: ${baseUrl}${params.path}. Params: ${JSON.stringify(params, jsonWithBigintReplacer)}`);
|
|
450
457
|
return request(baseUrl, params, rateLimiter, backoffOpts, additionalHeaders);
|
|
451
458
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-order-book",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.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.
|
|
40
|
-
"@cowprotocol/sdk-common": "0.
|
|
39
|
+
"@cowprotocol/sdk-config": "2.2.0",
|
|
40
|
+
"@cowprotocol/sdk-common": "0.11.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|