@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.d.mts CHANGED
@@ -5904,6 +5904,20 @@ type ClaimPositionFeeParams = {
5904
5904
  feePayer?: PublicKey;
5905
5905
  tempWSolAccount?: PublicKey;
5906
5906
  };
5907
+ type ClaimPositionFeeParams2 = {
5908
+ owner: PublicKey;
5909
+ position: PublicKey;
5910
+ pool: PublicKey;
5911
+ positionNftAccount: PublicKey;
5912
+ tokenAMint: PublicKey;
5913
+ tokenBMint: PublicKey;
5914
+ tokenAVault: PublicKey;
5915
+ tokenBVault: PublicKey;
5916
+ tokenAProgram: PublicKey;
5917
+ tokenBProgram: PublicKey;
5918
+ receiver: PublicKey;
5919
+ feePayer?: PublicKey;
5920
+ };
5907
5921
  type ClosePositionInstructionParams = {
5908
5922
  owner: PublicKey;
5909
5923
  poolAuthority: PublicKey;
@@ -6409,6 +6423,12 @@ declare class CpAmm {
6409
6423
  * @returns Transaction builder.
6410
6424
  */
6411
6425
  claimPositionFee(params: ClaimPositionFeeParams): TxBuilder;
6426
+ /**
6427
+ * Builds a transaction to claim position fee rewards.
6428
+ * @param {ClaimPositionFeeParams} params - Parameters for claiming position fee.
6429
+ * @returns Transaction builder.
6430
+ */
6431
+ claimPositionFee2(params: ClaimPositionFeeParams2): TxBuilder;
6412
6432
  /**
6413
6433
  * Builds a transaction to claim reward from a position.
6414
6434
  * @param {ClaimRewardParams} params - Parameters for claiming reward.
@@ -13451,4 +13471,4 @@ var CpAmmIDL = {
13451
13471
  types: types
13452
13472
  };
13453
13473
 
13454
- export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
13474
+ export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimPositionFeeParams2, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
package/dist/index.d.ts CHANGED
@@ -5904,6 +5904,20 @@ type ClaimPositionFeeParams = {
5904
5904
  feePayer?: PublicKey;
5905
5905
  tempWSolAccount?: PublicKey;
5906
5906
  };
5907
+ type ClaimPositionFeeParams2 = {
5908
+ owner: PublicKey;
5909
+ position: PublicKey;
5910
+ pool: PublicKey;
5911
+ positionNftAccount: PublicKey;
5912
+ tokenAMint: PublicKey;
5913
+ tokenBMint: PublicKey;
5914
+ tokenAVault: PublicKey;
5915
+ tokenBVault: PublicKey;
5916
+ tokenAProgram: PublicKey;
5917
+ tokenBProgram: PublicKey;
5918
+ receiver: PublicKey;
5919
+ feePayer?: PublicKey;
5920
+ };
5907
5921
  type ClosePositionInstructionParams = {
5908
5922
  owner: PublicKey;
5909
5923
  poolAuthority: PublicKey;
@@ -6409,6 +6423,12 @@ declare class CpAmm {
6409
6423
  * @returns Transaction builder.
6410
6424
  */
6411
6425
  claimPositionFee(params: ClaimPositionFeeParams): TxBuilder;
6426
+ /**
6427
+ * Builds a transaction to claim position fee rewards.
6428
+ * @param {ClaimPositionFeeParams} params - Parameters for claiming position fee.
6429
+ * @returns Transaction builder.
6430
+ */
6431
+ claimPositionFee2(params: ClaimPositionFeeParams2): TxBuilder;
6412
6432
  /**
6413
6433
  * Builds a transaction to claim reward from a position.
6414
6434
  * @param {ClaimRewardParams} params - Parameters for claiming reward.
@@ -13451,4 +13471,4 @@ var CpAmmIDL = {
13451
13471
  types: types
13452
13472
  };
13453
13473
 
13454
- export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
13474
+ export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimPositionFeeParams2, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
package/dist/index.js 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(_spltoken.NATIVE_MINT) || tokenBMint.equals(_spltoken.NATIVE_MINT)) {
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 (0, _web3js.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.