impermax-sdk 2.1.418 → 2.1.419

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.
@@ -342,8 +342,8 @@ class GenericPosition {
342
342
  getLeveragedApr() { return (0, index_1.toAPR)(this.getLeveragedRate()); }
343
343
  getOptimalWithdraw(amountX, amountY, withdrawAtLeast = true) {
344
344
  let percentageToRemove;
345
- const percentageToRemoveX = amountX / this.getInitialDepositedX();
346
- const percentageToRemoveY = amountY / this.getInitialDepositedY();
345
+ const percentageToRemoveX = this.getInitialDepositedX() > 0 ? amountX / this.getInitialDepositedX() : 0;
346
+ const percentageToRemoveY = this.getInitialDepositedY() > 0 ? amountY / this.getInitialDepositedY() : 0;
347
347
  // Withdraw at least amountX and amountY
348
348
  if (withdrawAtLeast)
349
349
  percentageToRemove = Math.min(Math.max(percentageToRemoveX, percentageToRemoveY), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.418",
3
+ "version": "2.1.419",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",