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

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
@@ -6097,10 +6097,10 @@ function getDynamicFeeNumerator(volatilityAccumulator, binStep, variableFeeContr
6097
6097
  return vFee.add(new BN5(99999999999)).div(new BN5(1e11));
6098
6098
  }
6099
6099
  function getFeeNumerator(currentPoint, activationPoint, numberOfPeriod, periodFrequency, feeSchedulerMode, cliffFeeNumerator, reductionFactor, dynamicFeeParams) {
6100
- if (Number(periodFrequency) == 0 || new BN5(currentPoint).lt(activationPoint)) {
6100
+ if (Number(periodFrequency) == 0) {
6101
6101
  return cliffFeeNumerator;
6102
6102
  }
6103
- const period = BN5.min(
6103
+ const period = new BN5(currentPoint).lt(activationPoint) ? new BN5(numberOfPeriod) : BN5.min(
6104
6104
  new BN5(numberOfPeriod),
6105
6105
  new BN5(currentPoint).sub(activationPoint).div(periodFrequency)
6106
6106
  );
@@ -8544,6 +8544,44 @@ var CpAmm = class {
8544
8544
  }).transaction();
8545
8545
  });
8546
8546
  }
8547
+ /**
8548
+ * Builds a transaction to initialize reward and fund reward
8549
+ * @param {InitializeAndFundReward} params
8550
+ * @returns Transaction builder.
8551
+ */
8552
+ initializeAndFundReward(params) {
8553
+ return __async(this, null, function* () {
8554
+ const {
8555
+ rewardIndex,
8556
+ rewardDuration,
8557
+ pool,
8558
+ creator,
8559
+ payer,
8560
+ rewardMint,
8561
+ carryForward,
8562
+ amount,
8563
+ rewardMintProgram
8564
+ } = params;
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
+ });
8582
+ return new Transaction().add(initializeRewardTx).add(fundRewardTx);
8583
+ });
8584
+ }
8547
8585
  /**
8548
8586
  * Builds a transaction to update reward duration.
8549
8587
  * @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.