@cowprotocol/sdk-order-book 0.6.1 → 0.6.2

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
@@ -185,8 +185,7 @@ var ORDER_BOOK_PROD_CONFIG = {
185
185
  [import_sdk_config2.SupportedChainId.LENS]: `${PROD_BASE_URL}/lens`,
186
186
  [import_sdk_config2.SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb`,
187
187
  [import_sdk_config2.SupportedChainId.LINEA]: `${PROD_BASE_URL}/linea`,
188
- [import_sdk_config2.SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`,
189
- [import_sdk_config2.SupportedChainId.INK]: `${PROD_BASE_URL}/ink`
188
+ [import_sdk_config2.SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`
190
189
  };
191
190
  var ORDER_BOOK_STAGING_CONFIG = {
192
191
  [import_sdk_config2.SupportedChainId.MAINNET]: `${STAGING_BASE_URL}/mainnet`,
@@ -199,8 +198,7 @@ var ORDER_BOOK_STAGING_CONFIG = {
199
198
  [import_sdk_config2.SupportedChainId.LENS]: `${STAGING_BASE_URL}/lens`,
200
199
  [import_sdk_config2.SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb`,
201
200
  [import_sdk_config2.SupportedChainId.LINEA]: `${STAGING_BASE_URL}/linea`,
202
- [import_sdk_config2.SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`,
203
- [import_sdk_config2.SupportedChainId.INK]: `${STAGING_BASE_URL}/ink`
201
+ [import_sdk_config2.SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`
204
202
  };
205
203
  function cleanObjectFromUndefinedValues(obj) {
206
204
  return Object.keys(obj).reduce(
@@ -630,6 +628,7 @@ var SigningScheme = /* @__PURE__ */ ((SigningScheme2) => {
630
628
  })(SigningScheme || {});
631
629
 
632
630
  // src/quoteAmountsAndCostsUtils.ts
631
+ var HUNDRED_THOUSANDS = 1e5;
633
632
  var ONE_HUNDRED_BPS = BigInt(100 * 100);
634
633
  function getQuoteAmountsWithCosts(params) {
635
634
  const { sellDecimals, buyDecimals, orderParams, protocolFeeBps = 0 } = params;
@@ -719,12 +718,13 @@ function getProtocolFeeAmount(params) {
719
718
  const sellAmount = BigInt(sellAmountStr);
720
719
  const buyAmount = BigInt(buyAmountStr);
721
720
  const feeAmount = BigInt(feeAmountStr);
722
- const protocolFeeBpsBig = BigInt(protocolFeeBps);
721
+ const protocolFeeScale = BigInt(HUNDRED_THOUSANDS);
722
+ const protocolFeeBpsBig = BigInt(protocolFeeBps * HUNDRED_THOUSANDS);
723
723
  if (isSell) {
724
- const denominator = ONE_HUNDRED_BPS - protocolFeeBpsBig;
724
+ const denominator = ONE_HUNDRED_BPS * protocolFeeScale - protocolFeeBpsBig;
725
725
  return buyAmount * protocolFeeBpsBig / denominator;
726
726
  } else {
727
- const denominator = ONE_HUNDRED_BPS + protocolFeeBpsBig;
727
+ const denominator = ONE_HUNDRED_BPS * protocolFeeScale + protocolFeeBpsBig;
728
728
  return (sellAmount + feeAmount) * protocolFeeBpsBig / denominator;
729
729
  }
730
730
  }
package/dist/index.mjs CHANGED
@@ -139,8 +139,7 @@ var ORDER_BOOK_PROD_CONFIG = {
139
139
  [SupportedChainId.LENS]: `${PROD_BASE_URL}/lens`,
140
140
  [SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb`,
141
141
  [SupportedChainId.LINEA]: `${PROD_BASE_URL}/linea`,
142
- [SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`,
143
- [SupportedChainId.INK]: `${PROD_BASE_URL}/ink`
142
+ [SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`
144
143
  };
145
144
  var ORDER_BOOK_STAGING_CONFIG = {
146
145
  [SupportedChainId.MAINNET]: `${STAGING_BASE_URL}/mainnet`,
@@ -153,8 +152,7 @@ var ORDER_BOOK_STAGING_CONFIG = {
153
152
  [SupportedChainId.LENS]: `${STAGING_BASE_URL}/lens`,
154
153
  [SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb`,
155
154
  [SupportedChainId.LINEA]: `${STAGING_BASE_URL}/linea`,
156
- [SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`,
157
- [SupportedChainId.INK]: `${STAGING_BASE_URL}/ink`
155
+ [SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`
158
156
  };
159
157
  function cleanObjectFromUndefinedValues(obj) {
160
158
  return Object.keys(obj).reduce(
@@ -584,6 +582,7 @@ var SigningScheme = /* @__PURE__ */ ((SigningScheme2) => {
584
582
  })(SigningScheme || {});
585
583
 
586
584
  // src/quoteAmountsAndCostsUtils.ts
585
+ var HUNDRED_THOUSANDS = 1e5;
587
586
  var ONE_HUNDRED_BPS = BigInt(100 * 100);
588
587
  function getQuoteAmountsWithCosts(params) {
589
588
  const { sellDecimals, buyDecimals, orderParams, protocolFeeBps = 0 } = params;
@@ -673,12 +672,13 @@ function getProtocolFeeAmount(params) {
673
672
  const sellAmount = BigInt(sellAmountStr);
674
673
  const buyAmount = BigInt(buyAmountStr);
675
674
  const feeAmount = BigInt(feeAmountStr);
676
- const protocolFeeBpsBig = BigInt(protocolFeeBps);
675
+ const protocolFeeScale = BigInt(HUNDRED_THOUSANDS);
676
+ const protocolFeeBpsBig = BigInt(protocolFeeBps * HUNDRED_THOUSANDS);
677
677
  if (isSell) {
678
- const denominator = ONE_HUNDRED_BPS - protocolFeeBpsBig;
678
+ const denominator = ONE_HUNDRED_BPS * protocolFeeScale - protocolFeeBpsBig;
679
679
  return buyAmount * protocolFeeBpsBig / denominator;
680
680
  } else {
681
- const denominator = ONE_HUNDRED_BPS + protocolFeeBpsBig;
681
+ const denominator = ONE_HUNDRED_BPS * protocolFeeScale + protocolFeeBpsBig;
682
682
  return (sellAmount + feeAmount) * protocolFeeBpsBig / denominator;
683
683
  }
684
684
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-order-book",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "CowProtocol Order Book package",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -31,8 +31,8 @@
31
31
  "cross-fetch": "^3.2.0",
32
32
  "exponential-backoff": "^3.1.2",
33
33
  "limiter": "^3.0.0",
34
- "@cowprotocol/sdk-config": "0.7.1",
35
- "@cowprotocol/sdk-common": "0.5.2"
34
+ "@cowprotocol/sdk-config": "0.7.2",
35
+ "@cowprotocol/sdk-common": "0.5.3"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup src/index.ts --format esm,cjs --dts",