@meteora-ag/cp-amm-sdk 1.2.7 → 1.2.8
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 +7 -29
- package/dist/index.d.ts +7 -29
- package/dist/index.js +5 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8824,11 +8824,8 @@ function getTotalFeeNumerator(poolFees, baseFeeNumerator, maxFeeNumerator) {
|
|
|
8824
8824
|
const totalFeeNumerator = dynamicFeeNumerator.add(baseFeeNumerator);
|
|
8825
8825
|
return BN6.min(totalFeeNumerator, maxFeeNumerator);
|
|
8826
8826
|
}
|
|
8827
|
-
function getTotalTradingFeeFromIncludedFeeAmount(
|
|
8828
|
-
const baseFeeHandler = getBaseFeeHandler(
|
|
8829
|
-
program,
|
|
8830
|
-
poolFees.baseFee.baseFeeInfo.data
|
|
8831
|
-
);
|
|
8827
|
+
function getTotalTradingFeeFromIncludedFeeAmount(poolFees, currentPoint, activationPoint, includedFeeAmount, tradeDirection, maxFeeNumerator, initSqrtPrice, currentSqrtPrice) {
|
|
8828
|
+
const baseFeeHandler = getBaseFeeHandler(poolFees.baseFee.baseFeeInfo.data);
|
|
8832
8829
|
const baseFeeNumerator = baseFeeHandler.getBaseFeeNumeratorFromIncludedFeeAmount(
|
|
8833
8830
|
currentPoint,
|
|
8834
8831
|
activationPoint,
|
|
@@ -8839,11 +8836,8 @@ function getTotalTradingFeeFromIncludedFeeAmount(program, poolFees, currentPoint
|
|
|
8839
8836
|
);
|
|
8840
8837
|
return getTotalFeeNumerator(poolFees, baseFeeNumerator, maxFeeNumerator);
|
|
8841
8838
|
}
|
|
8842
|
-
function getTotalTradingFeeFromExcludedFeeAmount(
|
|
8843
|
-
const baseFeeHandler = getBaseFeeHandler(
|
|
8844
|
-
program,
|
|
8845
|
-
poolFees.baseFee.baseFeeInfo.data
|
|
8846
|
-
);
|
|
8839
|
+
function getTotalTradingFeeFromExcludedFeeAmount(poolFees, currentPoint, activationPoint, excludedFeeAmount, tradeDirection, maxFeeNumerator, initSqrtPrice, currentSqrtPrice) {
|
|
8840
|
+
const baseFeeHandler = getBaseFeeHandler(poolFees.baseFee.baseFeeInfo.data);
|
|
8847
8841
|
const baseFeeNumerator = baseFeeHandler.getBaseFeeNumeratorFromExcludedFeeAmount(
|
|
8848
8842
|
currentPoint,
|
|
8849
8843
|
activationPoint,
|
|
@@ -9536,7 +9530,7 @@ var FeeMarketCapScheduler = class {
|
|
|
9536
9530
|
);
|
|
9537
9531
|
}
|
|
9538
9532
|
};
|
|
9539
|
-
function getBaseFeeHandler(
|
|
9533
|
+
function getBaseFeeHandler(rawData) {
|
|
9540
9534
|
const data = Buffer.from(rawData);
|
|
9541
9535
|
const modeIndex = data.readUInt8(8);
|
|
9542
9536
|
const baseFeeMode = modeIndex;
|
|
@@ -9731,7 +9725,6 @@ function getSwapResultFromExactInput(program, poolState, amountIn, feeMode, trad
|
|
|
9731
9725
|
let actualPartnerFee = new BN14(0);
|
|
9732
9726
|
const maxFeeNumerator = getMaxFeeNumerator(poolState.version);
|
|
9733
9727
|
const tradeFeeNumerator = getTotalTradingFeeFromIncludedFeeAmount(
|
|
9734
|
-
program,
|
|
9735
9728
|
poolState.poolFees,
|
|
9736
9729
|
currentPoint,
|
|
9737
9730
|
poolState.activationPoint,
|
|
@@ -9845,7 +9838,6 @@ function getSwapResultFromPartialInput(program, poolState, amountIn, feeMode, tr
|
|
|
9845
9838
|
let actualPartnerFee = new BN14(0);
|
|
9846
9839
|
const maxFeeNumerator = getMaxFeeNumerator(poolState.version);
|
|
9847
9840
|
const tradeFeeNumerator = getTotalTradingFeeFromIncludedFeeAmount(
|
|
9848
|
-
program,
|
|
9849
9841
|
poolState.poolFees,
|
|
9850
9842
|
currentPoint,
|
|
9851
9843
|
poolState.activationPoint,
|
|
@@ -9890,7 +9882,6 @@ function getSwapResultFromPartialInput(program, poolState, amountIn, feeMode, tr
|
|
|
9890
9882
|
actualAmountIn = actualAmountIn.sub(amountLeft);
|
|
9891
9883
|
if (feeMode.feesOnInput) {
|
|
9892
9884
|
const tradeFeeNumerator2 = getTotalTradingFeeFromExcludedFeeAmount(
|
|
9893
|
-
program,
|
|
9894
9885
|
poolState.poolFees,
|
|
9895
9886
|
currentPoint,
|
|
9896
9887
|
poolState.activationPoint,
|
|
@@ -10029,7 +10020,6 @@ function getSwapResultFromExactOutput(program, poolState, amountOut, feeMode, tr
|
|
|
10029
10020
|
includedFeeAmountOut = amountOut;
|
|
10030
10021
|
} else {
|
|
10031
10022
|
const tradeFeeNumerator = getTotalTradingFeeFromExcludedFeeAmount(
|
|
10032
|
-
program,
|
|
10033
10023
|
poolState.poolFees,
|
|
10034
10024
|
currentPoint,
|
|
10035
10025
|
poolState.activationPoint,
|
|
@@ -10071,7 +10061,6 @@ function getSwapResultFromExactOutput(program, poolState, amountOut, feeMode, tr
|
|
|
10071
10061
|
let includedFeeInputAmount;
|
|
10072
10062
|
if (feeMode.feesOnInput) {
|
|
10073
10063
|
const tradeFeeNumerator = getTotalTradingFeeFromExcludedFeeAmount(
|
|
10074
|
-
program,
|
|
10075
10064
|
poolState.poolFees,
|
|
10076
10065
|
currentPoint,
|
|
10077
10066
|
poolState.activationPoint,
|