@meteora-ag/cp-amm-sdk 1.0.7 → 1.0.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.mjs CHANGED
@@ -9926,6 +9926,70 @@ var CpAmm = class {
9926
9926
  return transaction;
9927
9927
  });
9928
9928
  }
9929
+ /**
9930
+ * Builds a transaction to claim position fee rewards.
9931
+ * @param {ClaimPositionFeeParams} params - Parameters for claiming position fee.
9932
+ * @returns Transaction builder.
9933
+ */
9934
+ claimPositionFee2(params) {
9935
+ return __async(this, null, function* () {
9936
+ const {
9937
+ receiver,
9938
+ feePayer,
9939
+ owner,
9940
+ pool,
9941
+ position,
9942
+ positionNftAccount,
9943
+ tokenAVault,
9944
+ tokenBVault,
9945
+ tokenAMint,
9946
+ tokenBMint,
9947
+ tokenAProgram,
9948
+ tokenBProgram
9949
+ } = params;
9950
+ const payer = feePayer != null ? feePayer : owner;
9951
+ const {
9952
+ tokenAAta: tokenAAccount,
9953
+ tokenBAta: tokenBAccount,
9954
+ instructions: preInstruction
9955
+ } = yield this.prepareTokenAccounts({
9956
+ payer,
9957
+ tokenAOwner: owner,
9958
+ tokenBOwner: owner,
9959
+ tokenAMint,
9960
+ tokenBMint,
9961
+ tokenAProgram,
9962
+ tokenBProgram
9963
+ });
9964
+ const postInstructions = [];
9965
+ if (tokenAMint.equals(NATIVE_MINT2) || tokenBMint.equals(NATIVE_MINT2)) {
9966
+ const closeWrappedSOLIx = yield unwrapSOLInstruction(owner, receiver);
9967
+ closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
9968
+ }
9969
+ const claimPositionFeeInstruction = yield this.buildClaimPositionFeeInstruction({
9970
+ owner,
9971
+ poolAuthority: this.poolAuthority,
9972
+ pool,
9973
+ position,
9974
+ positionNftAccount,
9975
+ tokenAAccount,
9976
+ tokenBAccount,
9977
+ tokenAVault,
9978
+ tokenBVault,
9979
+ tokenAMint,
9980
+ tokenBMint,
9981
+ tokenAProgram,
9982
+ tokenBProgram
9983
+ });
9984
+ const transaction = new Transaction();
9985
+ transaction.add(
9986
+ ...preInstruction.length > 0 ? preInstruction : [],
9987
+ claimPositionFeeInstruction,
9988
+ ...postInstructions.length > 0 ? postInstructions : []
9989
+ );
9990
+ return transaction;
9991
+ });
9992
+ }
9929
9993
  /**
9930
9994
  * Builds a transaction to claim reward from a position.
9931
9995
  * @param {ClaimRewardParams} params - Parameters for claiming reward.