@meteora-ag/cp-amm-sdk 1.1.7 → 1.1.9-rc.0

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
@@ -8664,11 +8664,11 @@ import BN8 from "bn.js";
8664
8664
  function getMaxBaseFeeNumerator(cliffFeeNumerator) {
8665
8665
  return cliffFeeNumerator;
8666
8666
  }
8667
- function getMinBaseFeeNumerator(cliffFeeNumerator, numberOfPeriod, periodFrequency, reductionFactor, feeSchedulerMode) {
8667
+ function getMinBaseFeeNumerator(cliffFeeNumerator, numberOfPeriod, reductionFactor, feeSchedulerMode) {
8668
8668
  return getBaseFeeNumeratorByPeriod(
8669
8669
  cliffFeeNumerator,
8670
8670
  numberOfPeriod,
8671
- periodFrequency,
8671
+ new BN8(numberOfPeriod),
8672
8672
  reductionFactor,
8673
8673
  feeSchedulerMode
8674
8674
  );
@@ -8718,7 +8718,15 @@ function getBaseFeeNumerator(cliffFeeNumerator, numberOfPeriod, periodFrequency,
8718
8718
  if (periodFrequency.isZero()) {
8719
8719
  return cliffFeeNumerator;
8720
8720
  }
8721
- const period = currentPoint.sub(activationPoint).div(periodFrequency);
8721
+ let period;
8722
+ if (currentPoint.lt(activationPoint)) {
8723
+ period = new BN8(numberOfPeriod);
8724
+ } else {
8725
+ period = currentPoint.sub(activationPoint).div(periodFrequency);
8726
+ if (period.gt(new BN8(numberOfPeriod))) {
8727
+ period = new BN8(numberOfPeriod);
8728
+ }
8729
+ }
8722
8730
  return getBaseFeeNumeratorByPeriod(
8723
8731
  cliffFeeNumerator,
8724
8732
  numberOfPeriod,
@@ -9626,7 +9634,6 @@ function validateFeeScheduler(numberOfPeriod, periodFrequency, reductionFactor,
9626
9634
  const minFeeNumerator = getMinBaseFeeNumerator(
9627
9635
  cliffFeeNumerator,
9628
9636
  numberOfPeriod,
9629
- periodFrequency,
9630
9637
  reductionFactor,
9631
9638
  baseFeeMode
9632
9639
  );
@@ -11616,7 +11623,8 @@ var CpAmm = class {
11616
11623
  const closeWrappedSOLIx = yield unwrapSOLInstruction(payer);
11617
11624
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
11618
11625
  }
11619
- const poolState = yield this.fetchPoolState(pool);
11626
+ let { poolState } = params;
11627
+ poolState = poolState != null ? poolState : yield this.fetchPoolState(pool);
11620
11628
  const currentPoint = yield getCurrentPoint(
11621
11629
  this._program.provider.connection,
11622
11630
  poolState.activationType
@@ -11717,7 +11725,8 @@ var CpAmm = class {
11717
11725
  const closeWrappedSOLIx = yield unwrapSOLInstruction(payer);
11718
11726
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
11719
11727
  }
11720
- const poolState = yield this.fetchPoolState(pool);
11728
+ let { poolState } = params;
11729
+ poolState = poolState != null ? poolState : yield this.fetchPoolState(pool);
11721
11730
  const currentPoint = yield getCurrentPoint(
11722
11731
  this._program.provider.connection,
11723
11732
  poolState.activationType
@@ -12463,9 +12472,6 @@ var CpAmm = class {
12463
12472
  });
12464
12473
  }
12465
12474
  };
12466
-
12467
- // src/index.ts
12468
- var index_default = cp_amm_default;
12469
12475
  export {
12470
12476
  ActivationPoint,
12471
12477
  ActivationType,
@@ -12477,6 +12483,7 @@ export {
12477
12483
  CURRENT_POOL_VERSION,
12478
12484
  CollectFeeMode,
12479
12485
  CpAmm,
12486
+ cp_amm_default as CpAmmIdl,
12480
12487
  DYNAMIC_FEE_DECAY_PERIOD_DEFAULT,
12481
12488
  DYNAMIC_FEE_FILTER_PERIOD_DEFAULT,
12482
12489
  DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT,
@@ -12526,7 +12533,6 @@ export {
12526
12533
  convertToLamports,
12527
12534
  convertToRateLimiterSecondFactor,
12528
12535
  decimalToQ64,
12529
- index_default as default,
12530
12536
  deriveClaimFeeOperatorAddress,
12531
12537
  deriveConfigAddress,
12532
12538
  deriveCustomizablePoolAddress,