@crypticdot/defituna-client 3.1.16 → 3.1.17

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
@@ -10523,7 +10523,7 @@ function getTradableAmount(args) {
10523
10523
  }
10524
10524
  } else {
10525
10525
  const positionAmountInCollateralToken = collateralToken == positionToken ? positionAmount : BigInt(Math.round(Number(positionAmount) * positionToOppositeTokenPrice));
10526
- let positionCollateral = collateralToken == positionToken ? positionAmount - (0, import_fusionamm_core4.swapQuoteByOutputToken)(positionDebt, positionToken == 1 /* B */, 0, fusionPool, tickArrays).tokenEstIn : (0, import_fusionamm_core4.swapQuoteByInputToken)(positionAmount, positionToken == 0 /* A */, 0, fusionPool, tickArrays).tokenEstOut - positionDebt;
10526
+ let positionCollateral = collateralToken == positionToken ? positionAmount - (positionDebt > 0n ? (0, import_fusionamm_core4.swapQuoteByOutputToken)(positionDebt, positionToken == 1 /* B */, 0, fusionPool, tickArrays).tokenEstIn : 0n) : positionAmount > 0n ? (0, import_fusionamm_core4.swapQuoteByInputToken)(positionAmount, positionToken == 0 /* A */, 0, fusionPool, tickArrays).tokenEstOut - positionDebt : 0n;
10527
10527
  if (positionCollateral < 0n) positionCollateral = 0n;
10528
10528
  availableToTrade = positionAmountInCollateralToken + addLeverage(availableBalance + positionCollateral);
10529
10529
  }
package/dist/index.mjs CHANGED
@@ -10693,7 +10693,7 @@ function getTradableAmount(args) {
10693
10693
  }
10694
10694
  } else {
10695
10695
  const positionAmountInCollateralToken = collateralToken == positionToken ? positionAmount : BigInt(Math.round(Number(positionAmount) * positionToOppositeTokenPrice));
10696
- let positionCollateral = collateralToken == positionToken ? positionAmount - swapQuoteByOutputToken(positionDebt, positionToken == 1 /* B */, 0, fusionPool, tickArrays).tokenEstIn : swapQuoteByInputToken(positionAmount, positionToken == 0 /* A */, 0, fusionPool, tickArrays).tokenEstOut - positionDebt;
10696
+ let positionCollateral = collateralToken == positionToken ? positionAmount - (positionDebt > 0n ? swapQuoteByOutputToken(positionDebt, positionToken == 1 /* B */, 0, fusionPool, tickArrays).tokenEstIn : 0n) : positionAmount > 0n ? swapQuoteByInputToken(positionAmount, positionToken == 0 /* A */, 0, fusionPool, tickArrays).tokenEstOut - positionDebt : 0n;
10697
10697
  if (positionCollateral < 0n) positionCollateral = 0n;
10698
10698
  availableToTrade = positionAmountInCollateralToken + addLeverage(availableBalance + positionCollateral);
10699
10699
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-client",
3
3
  "description": "Typescript client to interact with DefiTuna's on-chain program.",
4
- "version": "3.1.16",
4
+ "version": "3.1.17",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "main": "./dist/index.js",