@meteora-ag/cp-amm-sdk 1.4.1 → 1.4.3
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 +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8190,11 +8190,11 @@ var BaseFeeMode = /* @__PURE__ */ ((BaseFeeMode3) => {
|
|
|
8190
8190
|
BaseFeeMode3[BaseFeeMode3["FeeMarketCapSchedulerExponential"] = 4] = "FeeMarketCapSchedulerExponential";
|
|
8191
8191
|
return BaseFeeMode3;
|
|
8192
8192
|
})(BaseFeeMode || {});
|
|
8193
|
-
var CollectFeeMode = /* @__PURE__ */ ((
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
return
|
|
8193
|
+
var CollectFeeMode = /* @__PURE__ */ ((CollectFeeMode3) => {
|
|
8194
|
+
CollectFeeMode3[CollectFeeMode3["BothToken"] = 0] = "BothToken";
|
|
8195
|
+
CollectFeeMode3[CollectFeeMode3["OnlyB"] = 1] = "OnlyB";
|
|
8196
|
+
CollectFeeMode3[CollectFeeMode3["Compounding"] = 2] = "Compounding";
|
|
8197
|
+
return CollectFeeMode3;
|
|
8198
8198
|
})(CollectFeeMode || {});
|
|
8199
8199
|
var TradeDirection = /* @__PURE__ */ ((TradeDirection3) => {
|
|
8200
8200
|
TradeDirection3[TradeDirection3["AtoB"] = 0] = "AtoB";
|
|
@@ -11848,12 +11848,12 @@ function computeSqrtPriceStepBps(priceMultiple, numberOfPeriod) {
|
|
|
11848
11848
|
}
|
|
11849
11849
|
return sqrtPriceStepBps;
|
|
11850
11850
|
}
|
|
11851
|
-
function getFeeMarketCapSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, baseFeeMode, numberOfPeriod,
|
|
11851
|
+
function getFeeMarketCapSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, baseFeeMode, numberOfPeriod, priceMultiple, schedulerExpirationDuration) {
|
|
11852
11852
|
if (numberOfPeriod <= 0) {
|
|
11853
11853
|
throw new Error("Total periods must be greater than zero");
|
|
11854
11854
|
}
|
|
11855
|
-
if (
|
|
11856
|
-
throw new Error("
|
|
11855
|
+
if (priceMultiple <= 1) {
|
|
11856
|
+
throw new Error("priceMultiple must be greater than 1");
|
|
11857
11857
|
}
|
|
11858
11858
|
const poolMaxFeeBps = getMaxFeeBps(CURRENT_POOL_VERSION);
|
|
11859
11859
|
if (startingBaseFeeBps <= endingBaseFeeBps) {
|
|
@@ -11869,7 +11869,6 @@ function getFeeMarketCapSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, ba
|
|
|
11869
11869
|
if (schedulerExpirationDuration == 0) {
|
|
11870
11870
|
throw new Error("schedulerExpirationDuration must be greater than zero");
|
|
11871
11871
|
}
|
|
11872
|
-
const priceMultiple = endingMarketCap / startingMarketCap;
|
|
11873
11872
|
const sqrtPriceStepBps = computeSqrtPriceStepBps(
|
|
11874
11873
|
priceMultiple,
|
|
11875
11874
|
numberOfPeriod
|
|
@@ -12006,8 +12005,7 @@ function getBaseFeeParams(baseFeeParams, tokenBDecimal, activationType) {
|
|
|
12006
12005
|
startingFeeBps,
|
|
12007
12006
|
endingFeeBps,
|
|
12008
12007
|
numberOfPeriod,
|
|
12009
|
-
|
|
12010
|
-
endingMarketCap,
|
|
12008
|
+
priceMultiple,
|
|
12011
12009
|
schedulerExpirationDuration
|
|
12012
12010
|
} = baseFeeParams.feeMarketCapSchedulerParam;
|
|
12013
12011
|
return getFeeMarketCapSchedulerParams(
|
|
@@ -12015,8 +12013,7 @@ function getBaseFeeParams(baseFeeParams, tokenBDecimal, activationType) {
|
|
|
12015
12013
|
endingFeeBps,
|
|
12016
12014
|
baseFeeParams.baseFeeMode,
|
|
12017
12015
|
numberOfPeriod,
|
|
12018
|
-
|
|
12019
|
-
endingMarketCap,
|
|
12016
|
+
priceMultiple,
|
|
12020
12017
|
schedulerExpirationDuration
|
|
12021
12018
|
);
|
|
12022
12019
|
}
|
|
@@ -13289,7 +13286,9 @@ var CpAmm = class {
|
|
|
13289
13286
|
});
|
|
13290
13287
|
const postInstruction = [];
|
|
13291
13288
|
if (isLockLiquidity) {
|
|
13292
|
-
const
|
|
13289
|
+
const configState = yield this.fetchConfigState(config);
|
|
13290
|
+
const lockLiquidity = configState.collectFeeMode === 2 /* Compounding */ ? liquidityDelta.sub(DEAD_LIQUIDITY) : liquidityDelta;
|
|
13291
|
+
const permanentLockIx = yield this._program.methods.permanentLockPosition(lockLiquidity).accountsPartial({
|
|
13293
13292
|
position,
|
|
13294
13293
|
positionNftAccount,
|
|
13295
13294
|
pool,
|
|
@@ -13388,7 +13387,8 @@ var CpAmm = class {
|
|
|
13388
13387
|
});
|
|
13389
13388
|
const postInstruction = [];
|
|
13390
13389
|
if (isLockLiquidity) {
|
|
13391
|
-
const
|
|
13390
|
+
const lockLiquidity = collectFeeMode === 2 /* Compounding */ ? liquidityDelta.sub(DEAD_LIQUIDITY) : liquidityDelta;
|
|
13391
|
+
const permanentLockIx = yield this._program.methods.permanentLockPosition(lockLiquidity).accountsPartial({
|
|
13392
13392
|
position,
|
|
13393
13393
|
positionNftAccount,
|
|
13394
13394
|
pool,
|
|
@@ -13494,7 +13494,8 @@ var CpAmm = class {
|
|
|
13494
13494
|
});
|
|
13495
13495
|
const postInstruction = [];
|
|
13496
13496
|
if (isLockLiquidity) {
|
|
13497
|
-
const
|
|
13497
|
+
const lockLiquidity = collectFeeMode === 2 /* Compounding */ ? liquidityDelta.sub(DEAD_LIQUIDITY) : liquidityDelta;
|
|
13498
|
+
const permanentLockIx = yield this._program.methods.permanentLockPosition(lockLiquidity).accountsPartial({
|
|
13498
13499
|
position,
|
|
13499
13500
|
positionNftAccount,
|
|
13500
13501
|
pool,
|