@meteora-ag/dlmm 1.6.0-rc.19 → 1.6.0-rc.21

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
@@ -13044,8 +13044,9 @@ function getAutoFillAmountByRebalancedPosition(rebalancePosition, strategyType)
13044
13044
  new (0, _bnjs2.default)(maxDeltaId),
13045
13045
  liquidityInAskSide
13046
13046
  );
13047
+ const [_, positionAmountY] = rebalancePosition.totalAmounts();
13047
13048
  return {
13048
- amount: amountY,
13049
+ amount: _bnjs2.default.max(amountY.sub(positionAmountY), new (0, _bnjs2.default)(0)),
13049
13050
  isBidSide: true
13050
13051
  };
13051
13052
  } else if (liquidityInAskSide.lt(liquidityInBidSide)) {
@@ -13056,8 +13057,8 @@ function getAutoFillAmountByRebalancedPosition(rebalancePosition, strategyType)
13056
13057
  } else {
13057
13058
  minBinId = rebalancePosition.rebalancePositionBinData[favorXInActiveBin ? activeIdIndex - 1 : activeIdIndex].binId;
13058
13059
  }
13059
- const minDeltaId = lbPair.activeId - minBinId;
13060
- const maxDeltaId = lbPair.activeId - maxBinId;
13060
+ const minDeltaId = minBinId - lbPair.activeId;
13061
+ const maxDeltaId = maxBinId - lbPair.activeId;
13061
13062
  const { amountX } = builder.suggestBalancedXParametersFromY(
13062
13063
  new (0, _bnjs2.default)(lbPair.activeId),
13063
13064
  new (0, _bnjs2.default)(lbPair.binStep),
@@ -13066,8 +13067,9 @@ function getAutoFillAmountByRebalancedPosition(rebalancePosition, strategyType)
13066
13067
  new (0, _bnjs2.default)(maxDeltaId),
13067
13068
  liquidityInBidSide
13068
13069
  );
13070
+ const [positionAmountX] = rebalancePosition.totalAmounts();
13069
13071
  return {
13070
- amount: amountX,
13072
+ amount: _bnjs2.default.max(amountX.sub(positionAmountX), new (0, _bnjs2.default)(0)),
13071
13073
  isBidSide: false
13072
13074
  };
13073
13075
  } else {