@lifi/sdk 2.0.0 → 2.0.1

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.
@@ -123,7 +123,11 @@ function checkStepSlippageThreshold(oldStep, newStep) {
123
123
  const oldEstimatedToAmount = new bignumber_js_1.default(oldStep.estimate.toAmountMin);
124
124
  const newEstimatedToAmount = new bignumber_js_1.default(newStep.estimate.toAmountMin);
125
125
  const amountDifference = oldEstimatedToAmount.minus(newEstimatedToAmount);
126
- const actualSlippage = amountDifference.dividedBy(oldEstimatedToAmount);
126
+ // oldEstimatedToAmount can be 0 when we use conract calls
127
+ let actualSlippage = new bignumber_js_1.default(0);
128
+ if (oldEstimatedToAmount.gt(0)) {
129
+ actualSlippage = amountDifference.dividedBy(oldEstimatedToAmount);
130
+ }
127
131
  return (newEstimatedToAmount.gte(oldEstimatedToAmount) &&
128
132
  actualSlippage.lte(setSlippage));
129
133
  }
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.0.0";
2
+ export declare const version = "2.0.1";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/sdk';
5
- exports.version = '2.0.0';
5
+ exports.version = '2.0.1';
@@ -114,7 +114,11 @@ export function checkStepSlippageThreshold(oldStep, newStep) {
114
114
  const oldEstimatedToAmount = new BigNumber(oldStep.estimate.toAmountMin);
115
115
  const newEstimatedToAmount = new BigNumber(newStep.estimate.toAmountMin);
116
116
  const amountDifference = oldEstimatedToAmount.minus(newEstimatedToAmount);
117
- const actualSlippage = amountDifference.dividedBy(oldEstimatedToAmount);
117
+ // oldEstimatedToAmount can be 0 when we use conract calls
118
+ let actualSlippage = new BigNumber(0);
119
+ if (oldEstimatedToAmount.gt(0)) {
120
+ actualSlippage = amountDifference.dividedBy(oldEstimatedToAmount);
121
+ }
118
122
  return (newEstimatedToAmount.gte(oldEstimatedToAmount) &&
119
123
  actualSlippage.lte(setSlippage));
120
124
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "2.0.0";
2
+ export declare const version = "2.0.1";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk';
2
- export const version = '2.0.0';
2
+ export const version = '2.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",