@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.
- package/dist/cjs/execution/utils.js +5 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/execution/utils.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/sdk";
|
|
2
|
-
export declare const version = "2.0.
|
|
2
|
+
export declare const version = "2.0.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/execution/utils.js
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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.
|
|
2
|
+
export const version = '2.0.1';
|