@meteora-ag/cp-amm-sdk 1.0.11-rc.0 → 1.0.11-rc.2

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
@@ -6018,7 +6018,18 @@ type InitializeRewardParams = {
6018
6018
  funder: PublicKey;
6019
6019
  payer: PublicKey;
6020
6020
  creator: PublicKey;
6021
- rewardMintProgram?: PublicKey;
6021
+ rewardMintProgram: PublicKey;
6022
+ };
6023
+ type InitializeAndFundReward = {
6024
+ rewardIndex: number;
6025
+ rewardDuration: BN;
6026
+ pool: PublicKey;
6027
+ creator: PublicKey;
6028
+ payer: PublicKey;
6029
+ rewardMint: PublicKey;
6030
+ carryForward: boolean;
6031
+ amount: BN;
6032
+ rewardMintProgram: PublicKey;
6022
6033
  };
6023
6034
  type UpdateRewardDurationParams = {
6024
6035
  pool: PublicKey;
@@ -6038,6 +6049,9 @@ type FundRewardParams = {
6038
6049
  pool: PublicKey;
6039
6050
  carryForward: boolean;
6040
6051
  amount: BN;
6052
+ rewardMint: PublicKey;
6053
+ rewardVault: PublicKey;
6054
+ rewardMintProgram: PublicKey;
6041
6055
  };
6042
6056
  type WithdrawIneligibleRewardParams = {
6043
6057
  rewardIndex: number;
@@ -6476,6 +6490,12 @@ declare class CpAmm {
6476
6490
  */
6477
6491
  mergePosition(params: MergePositionParams): TxBuilder;
6478
6492
  initializeReward(params: InitializeRewardParams): TxBuilder;
6493
+ /**
6494
+ * Builds a transaction to initialize reward and fund reward
6495
+ * @param {InitializeAndFundReward} params
6496
+ * @returns Transaction builder.
6497
+ */
6498
+ initializeAndFundReward(params: InitializeAndFundReward): TxBuilder;
6479
6499
  /**
6480
6500
  * Builds a transaction to update reward duration.
6481
6501
  * @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.
@@ -13655,4 +13675,4 @@ var CpAmmIDL = {
13655
13675
  types: types
13656
13676
  };
13657
13677
 
13658
- 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 };
13678
+ 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 InitializeAndFundReward, 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
@@ -6018,7 +6018,18 @@ type InitializeRewardParams = {
6018
6018
  funder: PublicKey;
6019
6019
  payer: PublicKey;
6020
6020
  creator: PublicKey;
6021
- rewardMintProgram?: PublicKey;
6021
+ rewardMintProgram: PublicKey;
6022
+ };
6023
+ type InitializeAndFundReward = {
6024
+ rewardIndex: number;
6025
+ rewardDuration: BN;
6026
+ pool: PublicKey;
6027
+ creator: PublicKey;
6028
+ payer: PublicKey;
6029
+ rewardMint: PublicKey;
6030
+ carryForward: boolean;
6031
+ amount: BN;
6032
+ rewardMintProgram: PublicKey;
6022
6033
  };
6023
6034
  type UpdateRewardDurationParams = {
6024
6035
  pool: PublicKey;
@@ -6038,6 +6049,9 @@ type FundRewardParams = {
6038
6049
  pool: PublicKey;
6039
6050
  carryForward: boolean;
6040
6051
  amount: BN;
6052
+ rewardMint: PublicKey;
6053
+ rewardVault: PublicKey;
6054
+ rewardMintProgram: PublicKey;
6041
6055
  };
6042
6056
  type WithdrawIneligibleRewardParams = {
6043
6057
  rewardIndex: number;
@@ -6476,6 +6490,12 @@ declare class CpAmm {
6476
6490
  */
6477
6491
  mergePosition(params: MergePositionParams): TxBuilder;
6478
6492
  initializeReward(params: InitializeRewardParams): TxBuilder;
6493
+ /**
6494
+ * Builds a transaction to initialize reward and fund reward
6495
+ * @param {InitializeAndFundReward} params
6496
+ * @returns Transaction builder.
6497
+ */
6498
+ initializeAndFundReward(params: InitializeAndFundReward): TxBuilder;
6479
6499
  /**
6480
6500
  * Builds a transaction to update reward duration.
6481
6501
  * @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.
@@ -13655,4 +13675,4 @@ var CpAmmIDL = {
13655
13675
  types: types
13656
13676
  };
13657
13677
 
13658
- 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 };
13678
+ 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 InitializeAndFundReward, 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
@@ -6097,10 +6097,10 @@ function getDynamicFeeNumerator(volatilityAccumulator, binStep, variableFeeContr
6097
6097
  return vFee.add(new (0, _anchor.BN)(99999999999)).div(new (0, _anchor.BN)(1e11));
6098
6098
  }
6099
6099
  function getFeeNumerator(currentPoint, activationPoint, numberOfPeriod, periodFrequency, feeSchedulerMode, cliffFeeNumerator, reductionFactor, dynamicFeeParams) {
6100
- if (Number(periodFrequency) == 0 || new (0, _anchor.BN)(currentPoint).lt(activationPoint)) {
6100
+ if (Number(periodFrequency) == 0) {
6101
6101
  return cliffFeeNumerator;
6102
6102
  }
6103
- const period = _anchor.BN.min(
6103
+ const period = new (0, _anchor.BN)(currentPoint).lt(activationPoint) ? new (0, _anchor.BN)(numberOfPeriod) : _anchor.BN.min(
6104
6104
  new (0, _anchor.BN)(numberOfPeriod),
6105
6105
  new (0, _anchor.BN)(currentPoint).sub(activationPoint).div(periodFrequency)
6106
6106
  );
@@ -8532,7 +8532,6 @@ var CpAmm = class {
8532
8532
  rewardMintProgram
8533
8533
  } = params;
8534
8534
  const rewardVault = deriveRewardVaultAddress(pool, rewardIndex);
8535
- const tokenProgram = rewardMintProgram ? rewardMintProgram : (yield this._program.provider.connection.getAccountInfo(rewardMint)).owner;
8536
8535
  return yield this._program.methods.initializeReward(rewardIndex, rewardDuration, funder).accountsPartial({
8537
8536
  poolAuthority: this.poolAuthority,
8538
8537
  pool,
@@ -8540,10 +8539,52 @@ var CpAmm = class {
8540
8539
  rewardMint,
8541
8540
  signer: creator,
8542
8541
  payer,
8543
- tokenProgram
8542
+ tokenProgram: rewardMintProgram
8544
8543
  }).transaction();
8545
8544
  });
8546
8545
  }
8546
+ /**
8547
+ * Builds a transaction to initialize reward and fund reward
8548
+ * @param {InitializeAndFundReward} params
8549
+ * @returns Transaction builder.
8550
+ */
8551
+ initializeAndFundReward(params) {
8552
+ return __async(this, null, function* () {
8553
+ const {
8554
+ rewardIndex,
8555
+ rewardDuration,
8556
+ pool,
8557
+ creator,
8558
+ payer,
8559
+ rewardMint,
8560
+ carryForward,
8561
+ amount,
8562
+ rewardMintProgram
8563
+ } = params;
8564
+ const rewardVault = deriveRewardVaultAddress(pool, rewardIndex);
8565
+ const initializeRewardTx = yield this.initializeReward({
8566
+ rewardIndex,
8567
+ rewardDuration,
8568
+ funder: payer,
8569
+ pool,
8570
+ creator,
8571
+ payer,
8572
+ rewardMint,
8573
+ rewardMintProgram
8574
+ });
8575
+ const fundRewardTx = yield this.fundReward({
8576
+ rewardIndex,
8577
+ carryForward,
8578
+ pool,
8579
+ funder: payer,
8580
+ amount,
8581
+ rewardMint,
8582
+ rewardVault,
8583
+ rewardMintProgram
8584
+ });
8585
+ return new (0, _web3js.Transaction)().add(initializeRewardTx).add(fundRewardTx);
8586
+ });
8587
+ }
8547
8588
  /**
8548
8589
  * Builds a transaction to update reward duration.
8549
8590
  * @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.
@@ -8579,22 +8620,27 @@ var CpAmm = class {
8579
8620
  */
8580
8621
  fundReward(params) {
8581
8622
  return __async(this, null, function* () {
8582
- const { rewardIndex, carryForward, pool, funder, amount } = params;
8583
- const poolState = yield this.fetchPoolState(pool);
8584
- const rewardInfo = poolState.rewardInfos[rewardIndex];
8585
- const { vault, mint } = rewardInfo;
8586
- const tokenProgram = getTokenProgram(rewardIndex);
8623
+ const {
8624
+ rewardIndex,
8625
+ carryForward,
8626
+ pool,
8627
+ funder,
8628
+ amount,
8629
+ rewardMint,
8630
+ rewardVault,
8631
+ rewardMintProgram
8632
+ } = params;
8587
8633
  const preInstructions = [];
8588
8634
  const { ataPubkey: funderTokenAccount, ix: createFunderTokenAccountIx } = yield getOrCreateATAInstruction(
8589
8635
  this._program.provider.connection,
8590
- mint,
8636
+ rewardMint,
8591
8637
  funder,
8592
8638
  funder,
8593
8639
  true,
8594
- tokenProgram
8640
+ rewardMintProgram
8595
8641
  );
8596
8642
  createFunderTokenAccountIx && preInstructions.push(createFunderTokenAccountIx);
8597
- if (mint.equals(_spltoken.NATIVE_MINT) && !amount.isZero()) {
8643
+ if (rewardMint.equals(_spltoken.NATIVE_MINT) && !amount.isZero()) {
8598
8644
  const wrapSOLIx = wrapSOLInstruction(
8599
8645
  funder,
8600
8646
  funderTokenAccount,
@@ -8604,11 +8650,11 @@ var CpAmm = class {
8604
8650
  }
8605
8651
  return yield this._program.methods.fundReward(rewardIndex, amount, carryForward).accountsPartial({
8606
8652
  pool,
8607
- rewardVault: vault,
8608
- rewardMint: mint,
8653
+ rewardVault,
8654
+ rewardMint,
8609
8655
  funderTokenAccount,
8610
8656
  funder,
8611
- tokenProgram
8657
+ tokenProgram: rewardMintProgram
8612
8658
  }).transaction();
8613
8659
  });
8614
8660
  }