@meteora-ag/cp-amm-sdk 1.1.7 → 1.1.9
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6445,6 +6445,7 @@ type SwapParams = {
|
|
|
6445
6445
|
tokenAProgram: PublicKey;
|
|
6446
6446
|
tokenBProgram: PublicKey;
|
|
6447
6447
|
referralTokenAccount: PublicKey | null;
|
|
6448
|
+
poolState?: PoolState;
|
|
6448
6449
|
};
|
|
6449
6450
|
type Swap2Params = {
|
|
6450
6451
|
payer: PublicKey;
|
|
@@ -6458,6 +6459,7 @@ type Swap2Params = {
|
|
|
6458
6459
|
tokenAProgram: PublicKey;
|
|
6459
6460
|
tokenBProgram: PublicKey;
|
|
6460
6461
|
referralTokenAccount: PublicKey | null;
|
|
6462
|
+
poolState?: PoolState;
|
|
6461
6463
|
} & ({
|
|
6462
6464
|
swapMode: SwapMode.ExactIn;
|
|
6463
6465
|
amountIn: BN;
|
|
@@ -7752,7 +7754,7 @@ declare function getMaxBaseFeeNumerator(cliffFeeNumerator: BN$1): BN$1;
|
|
|
7752
7754
|
* @param feeSchedulerMode - The fee scheduler mode.
|
|
7753
7755
|
* @returns The min base fee numerator.
|
|
7754
7756
|
*/
|
|
7755
|
-
declare function getMinBaseFeeNumerator(cliffFeeNumerator: BN$1, numberOfPeriod: number,
|
|
7757
|
+
declare function getMinBaseFeeNumerator(cliffFeeNumerator: BN$1, numberOfPeriod: number, reductionFactor: BN$1, feeSchedulerMode: BaseFeeMode): BN$1;
|
|
7756
7758
|
/**
|
|
7757
7759
|
* Gets the base fee numerator by period.
|
|
7758
7760
|
* @param cliffFeeNumerator - The cliff fee numerator.
|
package/dist/index.d.ts
CHANGED
|
@@ -6445,6 +6445,7 @@ type SwapParams = {
|
|
|
6445
6445
|
tokenAProgram: PublicKey;
|
|
6446
6446
|
tokenBProgram: PublicKey;
|
|
6447
6447
|
referralTokenAccount: PublicKey | null;
|
|
6448
|
+
poolState?: PoolState;
|
|
6448
6449
|
};
|
|
6449
6450
|
type Swap2Params = {
|
|
6450
6451
|
payer: PublicKey;
|
|
@@ -6458,6 +6459,7 @@ type Swap2Params = {
|
|
|
6458
6459
|
tokenAProgram: PublicKey;
|
|
6459
6460
|
tokenBProgram: PublicKey;
|
|
6460
6461
|
referralTokenAccount: PublicKey | null;
|
|
6462
|
+
poolState?: PoolState;
|
|
6461
6463
|
} & ({
|
|
6462
6464
|
swapMode: SwapMode.ExactIn;
|
|
6463
6465
|
amountIn: BN;
|
|
@@ -7752,7 +7754,7 @@ declare function getMaxBaseFeeNumerator(cliffFeeNumerator: BN$1): BN$1;
|
|
|
7752
7754
|
* @param feeSchedulerMode - The fee scheduler mode.
|
|
7753
7755
|
* @returns The min base fee numerator.
|
|
7754
7756
|
*/
|
|
7755
|
-
declare function getMinBaseFeeNumerator(cliffFeeNumerator: BN$1, numberOfPeriod: number,
|
|
7757
|
+
declare function getMinBaseFeeNumerator(cliffFeeNumerator: BN$1, numberOfPeriod: number, reductionFactor: BN$1, feeSchedulerMode: BaseFeeMode): BN$1;
|
|
7756
7758
|
/**
|
|
7757
7759
|
* Gets the base fee numerator by period.
|
|
7758
7760
|
* @param cliffFeeNumerator - The cliff fee numerator.
|
package/dist/index.js
CHANGED
|
@@ -8664,11 +8664,11 @@ function getFeeNumeratorFromExcludedFeeAmount(excludedFeeAmount, referenceAmount
|
|
|
8664
8664
|
function getMaxBaseFeeNumerator(cliffFeeNumerator) {
|
|
8665
8665
|
return cliffFeeNumerator;
|
|
8666
8666
|
}
|
|
8667
|
-
function getMinBaseFeeNumerator(cliffFeeNumerator, numberOfPeriod,
|
|
8667
|
+
function getMinBaseFeeNumerator(cliffFeeNumerator, numberOfPeriod, reductionFactor, feeSchedulerMode) {
|
|
8668
8668
|
return getBaseFeeNumeratorByPeriod(
|
|
8669
8669
|
cliffFeeNumerator,
|
|
8670
8670
|
numberOfPeriod,
|
|
8671
|
-
|
|
8671
|
+
new (0, _bnjs2.default)(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
|
-
|
|
8721
|
+
let period;
|
|
8722
|
+
if (currentPoint.lt(activationPoint)) {
|
|
8723
|
+
period = new (0, _bnjs2.default)(numberOfPeriod);
|
|
8724
|
+
} else {
|
|
8725
|
+
period = currentPoint.sub(activationPoint).div(periodFrequency);
|
|
8726
|
+
if (period.gt(new (0, _bnjs2.default)(numberOfPeriod))) {
|
|
8727
|
+
period = new (0, _bnjs2.default)(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
|
-
|
|
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
|
-
|
|
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
|