@meteora-ag/cp-amm-sdk 1.4.2 → 1.4.3

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
@@ -8190,11 +8190,11 @@ var BaseFeeMode = /* @__PURE__ */ ((BaseFeeMode3) => {
8190
8190
  BaseFeeMode3[BaseFeeMode3["FeeMarketCapSchedulerExponential"] = 4] = "FeeMarketCapSchedulerExponential";
8191
8191
  return BaseFeeMode3;
8192
8192
  })(BaseFeeMode || {});
8193
- var CollectFeeMode = /* @__PURE__ */ ((CollectFeeMode4) => {
8194
- CollectFeeMode4[CollectFeeMode4["BothToken"] = 0] = "BothToken";
8195
- CollectFeeMode4[CollectFeeMode4["OnlyB"] = 1] = "OnlyB";
8196
- CollectFeeMode4[CollectFeeMode4["Compounding"] = 2] = "Compounding";
8197
- return CollectFeeMode4;
8193
+ var CollectFeeMode = /* @__PURE__ */ ((CollectFeeMode3) => {
8194
+ CollectFeeMode3[CollectFeeMode3["BothToken"] = 0] = "BothToken";
8195
+ CollectFeeMode3[CollectFeeMode3["OnlyB"] = 1] = "OnlyB";
8196
+ CollectFeeMode3[CollectFeeMode3["Compounding"] = 2] = "Compounding";
8197
+ return CollectFeeMode3;
8198
8198
  })(CollectFeeMode || {});
8199
8199
  var TradeDirection = /* @__PURE__ */ ((TradeDirection3) => {
8200
8200
  TradeDirection3[TradeDirection3["AtoB"] = 0] = "AtoB";
@@ -13286,7 +13286,9 @@ var CpAmm = class {
13286
13286
  });
13287
13287
  const postInstruction = [];
13288
13288
  if (isLockLiquidity) {
13289
- const permanentLockIx = yield this._program.methods.permanentLockPosition(liquidityDelta).accountsPartial({
13289
+ const configState = yield this.fetchConfigState(config);
13290
+ const lockLiquidity = configState.collectFeeMode === 2 /* Compounding */ ? liquidityDelta.sub(DEAD_LIQUIDITY) : liquidityDelta;
13291
+ const permanentLockIx = yield this._program.methods.permanentLockPosition(lockLiquidity).accountsPartial({
13290
13292
  position,
13291
13293
  positionNftAccount,
13292
13294
  pool,
@@ -13385,7 +13387,8 @@ var CpAmm = class {
13385
13387
  });
13386
13388
  const postInstruction = [];
13387
13389
  if (isLockLiquidity) {
13388
- const permanentLockIx = yield this._program.methods.permanentLockPosition(liquidityDelta).accountsPartial({
13390
+ const lockLiquidity = collectFeeMode === 2 /* Compounding */ ? liquidityDelta.sub(DEAD_LIQUIDITY) : liquidityDelta;
13391
+ const permanentLockIx = yield this._program.methods.permanentLockPosition(lockLiquidity).accountsPartial({
13389
13392
  position,
13390
13393
  positionNftAccount,
13391
13394
  pool,
@@ -13491,7 +13494,8 @@ var CpAmm = class {
13491
13494
  });
13492
13495
  const postInstruction = [];
13493
13496
  if (isLockLiquidity) {
13494
- const permanentLockIx = yield this._program.methods.permanentLockPosition(liquidityDelta).accountsPartial({
13497
+ const lockLiquidity = collectFeeMode === 2 /* Compounding */ ? liquidityDelta.sub(DEAD_LIQUIDITY) : liquidityDelta;
13498
+ const permanentLockIx = yield this._program.methods.permanentLockPosition(lockLiquidity).accountsPartial({
13495
13499
  position,
13496
13500
  positionNftAccount,
13497
13501
  pool,