@meteora-ag/cp-amm-sdk 1.0.0-rc.6 → 1.0.0-rc.8

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
@@ -8906,13 +8906,6 @@ var CpAmm = class {
8906
8906
  tokenAProgram,
8907
8907
  tokenBProgram
8908
8908
  );
8909
- const postInstructions = [];
8910
- if ([tokenAMint.toBase58(), tokenBMint.toBase58()].includes(
8911
- _spltoken.NATIVE_MINT.toBase58()
8912
- )) {
8913
- const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
8914
- closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
8915
- }
8916
8909
  let positionBLiquidityDelta = positionBState.unlockedLiquidity;
8917
8910
  if (positionBVestings.length > 0) {
8918
8911
  const totalAvailableVestingLiquidity = positionBVestings.reduce(
@@ -8938,6 +8931,14 @@ var CpAmm = class {
8938
8931
  refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
8939
8932
  }
8940
8933
  const transaction = new (0, _web3js.Transaction)();
8934
+ if (poolState.tokenAMint.equals(_spltoken.NATIVE_MINT)) {
8935
+ const wrapSOLIx = wrapSOLInstruction(owner, tokenAAccount, BigInt(1));
8936
+ preInstructions.push(...wrapSOLIx);
8937
+ }
8938
+ if (poolState.tokenBMint.equals(_spltoken.NATIVE_MINT)) {
8939
+ const wrapSOLIx = wrapSOLInstruction(owner, tokenBAccount, BigInt(1));
8940
+ preInstructions.push(...wrapSOLIx);
8941
+ }
8941
8942
  if (preInstructions.length > 0) {
8942
8943
  transaction.add(...preInstructions);
8943
8944
  }
@@ -8971,8 +8972,11 @@ var CpAmm = class {
8971
8972
  tokenBAmountThreshold: tokenBAmountAddLiquidityThreshold
8972
8973
  });
8973
8974
  transaction.add(addLiquidityInstruction);
8974
- if (postInstructions.length > 0) {
8975
- transaction.add(...postInstructions);
8975
+ if ([tokenAMint.toBase58(), tokenBMint.toBase58()].includes(
8976
+ _spltoken.NATIVE_MINT.toBase58()
8977
+ )) {
8978
+ const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
8979
+ closeWrappedSOLIx && transaction.add(closeWrappedSOLIx);
8976
8980
  }
8977
8981
  return transaction;
8978
8982
  });