@meteora-ag/cp-amm-sdk 1.0.0-rc.2 → 1.0.0-rc.4
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 +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +173 -207
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -206
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6401,7 +6401,6 @@ var SCALE_OFFSET = 64;
|
|
|
6401
6401
|
var BASIS_POINT_MAX = 1e4;
|
|
6402
6402
|
var MAX_FEE_NUMERATOR = 5e8;
|
|
6403
6403
|
var FEE_DENOMINATOR = 1e9;
|
|
6404
|
-
var PRECISION = 1e6;
|
|
6405
6404
|
var MIN_SQRT_PRICE = new (0, _anchor.BN)("4295048016");
|
|
6406
6405
|
var MAX_SQRT_PRICE = new (0, _anchor.BN)("79226673521066979257578248091");
|
|
6407
6406
|
var MIN_CU_BUFFER = 5e4;
|
|
@@ -6493,12 +6492,6 @@ function derivePositionNftAccount(positionNftMint) {
|
|
|
6493
6492
|
CP_AMM_PROGRAM_ID
|
|
6494
6493
|
)[0];
|
|
6495
6494
|
}
|
|
6496
|
-
function deriveTokenBadge(tokenMint) {
|
|
6497
|
-
return _web3js.PublicKey.findProgramAddressSync(
|
|
6498
|
-
[Buffer.from("token_badge"), tokenMint.toBuffer()],
|
|
6499
|
-
CP_AMM_PROGRAM_ID
|
|
6500
|
-
)[0];
|
|
6501
|
-
}
|
|
6502
6495
|
|
|
6503
6496
|
// src/helpers/token.ts
|
|
6504
6497
|
var _bytes = require('@coral-xyz/anchor/dist/cjs/utils/bytes');
|
|
@@ -6519,7 +6512,6 @@ var _bytes = require('@coral-xyz/anchor/dist/cjs/utils/bytes');
|
|
|
6519
6512
|
|
|
6520
6513
|
|
|
6521
6514
|
|
|
6522
|
-
|
|
6523
6515
|
function getTokenProgram(flag) {
|
|
6524
6516
|
return flag == 0 ? _spltoken.TOKEN_PROGRAM_ID : _spltoken.TOKEN_2022_PROGRAM_ID;
|
|
6525
6517
|
}
|
|
@@ -6590,16 +6582,6 @@ var unwrapSOLInstruction = (owner, allowOwnerOffCurve = true) => __async(void 0,
|
|
|
6590
6582
|
}
|
|
6591
6583
|
return null;
|
|
6592
6584
|
});
|
|
6593
|
-
function getNftOwner(connection, nftMint) {
|
|
6594
|
-
return __async(this, null, function* () {
|
|
6595
|
-
const largesTokenAccount = yield connection.getTokenLargestAccounts(nftMint);
|
|
6596
|
-
const accountInfo = yield connection.getParsedAccountInfo(
|
|
6597
|
-
largesTokenAccount.value[0].address
|
|
6598
|
-
);
|
|
6599
|
-
const owner = new (0, _web3js.PublicKey)(accountInfo.value.data.parsed.info.owner);
|
|
6600
|
-
return new (0, _web3js.PublicKey)(owner);
|
|
6601
|
-
});
|
|
6602
|
-
}
|
|
6603
6585
|
function getAllUserPositionNftAccount(connection, user) {
|
|
6604
6586
|
return __async(this, null, function* () {
|
|
6605
6587
|
const filters = [
|
|
@@ -6752,12 +6734,6 @@ function mulDiv(x, y, denominator, rounding) {
|
|
|
6752
6734
|
}
|
|
6753
6735
|
return div;
|
|
6754
6736
|
}
|
|
6755
|
-
function divCeil(a, b) {
|
|
6756
|
-
if (a.isZero()) {
|
|
6757
|
-
return new (0, _anchor.BN)(0);
|
|
6758
|
-
}
|
|
6759
|
-
return a.add(b.sub(new (0, _anchor.BN)(1))).div(b);
|
|
6760
|
-
}
|
|
6761
6737
|
function q64ToDecimal(num, decimalPlaces) {
|
|
6762
6738
|
return new (0, _decimaljs2.default)(num.toString()).div(_decimaljs2.default.pow(2, 64)).toDecimalPlaces(decimalPlaces);
|
|
6763
6739
|
}
|
|
@@ -6846,10 +6822,10 @@ function getFeeNumerator(currentPoint, activationPoint, numberOfPeriod, periodFr
|
|
|
6846
6822
|
const { volatilityAccumulator, binStep, variableFeeControl } = dynamicFeeParams;
|
|
6847
6823
|
const dynamicFeeNumberator = getDynamicFeeNumerator(
|
|
6848
6824
|
volatilityAccumulator,
|
|
6849
|
-
binStep,
|
|
6850
|
-
variableFeeControl
|
|
6825
|
+
new (0, _anchor.BN)(binStep),
|
|
6826
|
+
new (0, _anchor.BN)(variableFeeControl)
|
|
6851
6827
|
);
|
|
6852
|
-
feeNumerator.add(dynamicFeeNumberator);
|
|
6828
|
+
feeNumerator = feeNumerator.add(dynamicFeeNumberator);
|
|
6853
6829
|
}
|
|
6854
6830
|
return feeNumerator.gt(new (0, _anchor.BN)(MAX_FEE_NUMERATOR)) ? new (0, _anchor.BN)(MAX_FEE_NUMERATOR) : feeNumerator;
|
|
6855
6831
|
}
|
|
@@ -6878,14 +6854,14 @@ function getSwapAmount(inAmount, sqrtPrice, liquidity, tradeFeeNumerator, aToB,
|
|
|
6878
6854
|
actualInAmount = inAmount.sub(totalFee);
|
|
6879
6855
|
}
|
|
6880
6856
|
const outAmount = aToB ? getAmountBFromLiquidityDelta(
|
|
6881
|
-
getNextSqrtPrice(actualInAmount, sqrtPrice, liquidity, true),
|
|
6882
|
-
sqrtPrice,
|
|
6883
6857
|
liquidity,
|
|
6858
|
+
sqrtPrice,
|
|
6859
|
+
getNextSqrtPrice(actualInAmount, sqrtPrice, liquidity, true),
|
|
6884
6860
|
1 /* Down */
|
|
6885
|
-
) :
|
|
6861
|
+
) : getAmountAFromLiquidityDelta(
|
|
6862
|
+
liquidity,
|
|
6886
6863
|
sqrtPrice,
|
|
6887
6864
|
getNextSqrtPrice(actualInAmount, sqrtPrice, liquidity, false),
|
|
6888
|
-
liquidity,
|
|
6889
6865
|
1 /* Down */
|
|
6890
6866
|
);
|
|
6891
6867
|
const amountOut = feeMode.feeOnInput ? outAmount : (totalFee = getTotalFeeOnAmount(outAmount, tradeFeeNumerator), outAmount.sub(totalFee));
|
|
@@ -7164,11 +7140,11 @@ function getAvailableVestingLiquidity(vestingData, currentPoint) {
|
|
|
7164
7140
|
numberOfPeriod,
|
|
7165
7141
|
totalReleasedLiquidity
|
|
7166
7142
|
} = vestingData;
|
|
7167
|
-
if (currentPoint
|
|
7143
|
+
if (currentPoint.lt(cliffPoint)) {
|
|
7168
7144
|
return new (0, _anchor.BN)(0);
|
|
7169
7145
|
}
|
|
7170
7146
|
if (periodFrequency.isZero()) {
|
|
7171
|
-
return cliffUnlockLiquidity
|
|
7147
|
+
return cliffUnlockLiquidity;
|
|
7172
7148
|
}
|
|
7173
7149
|
let passedPeriod = new (0, _anchor.BN)(currentPoint).sub(cliffPoint).div(periodFrequency);
|
|
7174
7150
|
passedPeriod = _bnjs.min.call(void 0, passedPeriod, new (0, _anchor.BN)(numberOfPeriod));
|
|
@@ -7246,12 +7222,12 @@ var CpAmm = class {
|
|
|
7246
7222
|
getTokenBadgeAccounts(tokenAMint, tokenBMint) {
|
|
7247
7223
|
return [
|
|
7248
7224
|
{
|
|
7249
|
-
pubkey:
|
|
7225
|
+
pubkey: deriveTokenBadgeAddress(tokenAMint),
|
|
7250
7226
|
isWritable: false,
|
|
7251
7227
|
isSigner: false
|
|
7252
7228
|
},
|
|
7253
7229
|
{
|
|
7254
|
-
pubkey:
|
|
7230
|
+
pubkey: deriveTokenBadgeAddress(tokenBMint),
|
|
7255
7231
|
isWritable: false,
|
|
7256
7232
|
isSigner: false
|
|
7257
7233
|
}
|
|
@@ -7706,87 +7682,85 @@ var CpAmm = class {
|
|
|
7706
7682
|
* @returns Swap quote including expected output amount, fee, and price impact.
|
|
7707
7683
|
*/
|
|
7708
7684
|
getQuote(params) {
|
|
7709
|
-
|
|
7710
|
-
|
|
7685
|
+
const {
|
|
7686
|
+
inAmount,
|
|
7687
|
+
inputTokenMint,
|
|
7688
|
+
slippage,
|
|
7689
|
+
poolState,
|
|
7690
|
+
currentTime,
|
|
7691
|
+
currentSlot,
|
|
7692
|
+
inputTokenInfo,
|
|
7693
|
+
outputTokenInfo
|
|
7694
|
+
} = params;
|
|
7695
|
+
const {
|
|
7696
|
+
sqrtPrice: sqrtPriceQ64,
|
|
7697
|
+
liquidity: liquidityQ64,
|
|
7698
|
+
activationType,
|
|
7699
|
+
activationPoint,
|
|
7700
|
+
collectFeeMode,
|
|
7701
|
+
poolFees
|
|
7702
|
+
} = poolState;
|
|
7703
|
+
const {
|
|
7704
|
+
feeSchedulerMode,
|
|
7705
|
+
cliffFeeNumerator,
|
|
7706
|
+
numberOfPeriod,
|
|
7707
|
+
reductionFactor,
|
|
7708
|
+
periodFrequency
|
|
7709
|
+
} = poolFees.baseFee;
|
|
7710
|
+
const dynamicFee = poolFees.dynamicFee;
|
|
7711
|
+
let actualAmountIn = inAmount;
|
|
7712
|
+
if (inputTokenInfo) {
|
|
7713
|
+
actualAmountIn = calculateTransferFeeExcludedAmount(
|
|
7711
7714
|
inAmount,
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
const {
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
const { amountOut, totalFee } = getSwapAmount(
|
|
7762
|
-
actualAmountIn,
|
|
7763
|
-
sqrtPriceQ64,
|
|
7764
|
-
liquidityQ64,
|
|
7765
|
-
tradeFeeNumerator,
|
|
7766
|
-
aToB,
|
|
7767
|
-
collectFeeMode
|
|
7768
|
-
);
|
|
7769
|
-
let actualAmountOut = amountOut;
|
|
7770
|
-
if (outputTokenInfo) {
|
|
7771
|
-
actualAmountOut = calculateTransferFeeExcludedAmount(
|
|
7772
|
-
amountOut,
|
|
7773
|
-
outputTokenInfo.mint,
|
|
7774
|
-
outputTokenInfo.currentEpoch
|
|
7775
|
-
).amount;
|
|
7776
|
-
}
|
|
7777
|
-
const minSwapOutAmount = getMinAmountWithSlippage(
|
|
7778
|
-
actualAmountOut,
|
|
7779
|
-
slippage
|
|
7780
|
-
);
|
|
7781
|
-
return {
|
|
7782
|
-
swapInAmount: inAmount,
|
|
7783
|
-
consumedInAmount: actualAmountIn,
|
|
7784
|
-
swapOutAmount: actualAmountOut,
|
|
7785
|
-
minSwapOutAmount,
|
|
7786
|
-
totalFee,
|
|
7787
|
-
priceImpact: getPriceImpact(minSwapOutAmount, actualAmountOut)
|
|
7788
|
-
};
|
|
7789
|
-
});
|
|
7715
|
+
inputTokenInfo.mint,
|
|
7716
|
+
inputTokenInfo.currentEpoch
|
|
7717
|
+
).amount;
|
|
7718
|
+
}
|
|
7719
|
+
const aToB = poolState.tokenAMint.equals(inputTokenMint);
|
|
7720
|
+
const currentPoint = activationType ? currentTime : currentSlot;
|
|
7721
|
+
let dynamicFeeParams;
|
|
7722
|
+
if (dynamicFee.initialized) {
|
|
7723
|
+
const { volatilityAccumulator, binStep, variableFeeControl } = dynamicFee;
|
|
7724
|
+
dynamicFeeParams = { volatilityAccumulator, binStep, variableFeeControl };
|
|
7725
|
+
}
|
|
7726
|
+
const tradeFeeNumerator = getFeeNumerator(
|
|
7727
|
+
currentPoint,
|
|
7728
|
+
activationPoint,
|
|
7729
|
+
numberOfPeriod,
|
|
7730
|
+
periodFrequency,
|
|
7731
|
+
feeSchedulerMode,
|
|
7732
|
+
cliffFeeNumerator,
|
|
7733
|
+
reductionFactor,
|
|
7734
|
+
dynamicFeeParams
|
|
7735
|
+
);
|
|
7736
|
+
const { amountOut, totalFee } = getSwapAmount(
|
|
7737
|
+
actualAmountIn,
|
|
7738
|
+
sqrtPriceQ64,
|
|
7739
|
+
liquidityQ64,
|
|
7740
|
+
tradeFeeNumerator,
|
|
7741
|
+
aToB,
|
|
7742
|
+
collectFeeMode
|
|
7743
|
+
);
|
|
7744
|
+
let actualAmountOut = amountOut;
|
|
7745
|
+
if (outputTokenInfo) {
|
|
7746
|
+
actualAmountOut = calculateTransferFeeExcludedAmount(
|
|
7747
|
+
amountOut,
|
|
7748
|
+
outputTokenInfo.mint,
|
|
7749
|
+
outputTokenInfo.currentEpoch
|
|
7750
|
+
).amount;
|
|
7751
|
+
}
|
|
7752
|
+
const minSwapOutAmount = getMinAmountWithSlippage(
|
|
7753
|
+
actualAmountOut,
|
|
7754
|
+
slippage
|
|
7755
|
+
);
|
|
7756
|
+
return {
|
|
7757
|
+
swapInAmount: inAmount,
|
|
7758
|
+
consumedInAmount: actualAmountIn,
|
|
7759
|
+
swapOutAmount: actualAmountOut,
|
|
7760
|
+
minSwapOutAmount,
|
|
7761
|
+
totalFee,
|
|
7762
|
+
priceImpact: getPriceImpact(minSwapOutAmount, actualAmountOut)
|
|
7763
|
+
};
|
|
7790
7764
|
}
|
|
7791
7765
|
/**
|
|
7792
7766
|
* Calculates the deposit quote for liquidity pool.
|
|
@@ -7799,61 +7773,59 @@ var CpAmm = class {
|
|
|
7799
7773
|
* @returns {BN} returns.liquidityDelta - The amount of liquidity that will be added to the pool.
|
|
7800
7774
|
*/
|
|
7801
7775
|
getDepositQuote(params) {
|
|
7802
|
-
|
|
7803
|
-
|
|
7776
|
+
const {
|
|
7777
|
+
inAmount,
|
|
7778
|
+
isTokenA,
|
|
7779
|
+
inputTokenInfo,
|
|
7780
|
+
outputTokenInfo,
|
|
7781
|
+
minSqrtPrice,
|
|
7782
|
+
maxSqrtPrice,
|
|
7783
|
+
sqrtPrice
|
|
7784
|
+
} = params;
|
|
7785
|
+
const actualAmountIn = inputTokenInfo ? inAmount.sub(
|
|
7786
|
+
calculateTransferFeeIncludedAmount(
|
|
7804
7787
|
inAmount,
|
|
7805
|
-
|
|
7806
|
-
inputTokenInfo
|
|
7807
|
-
|
|
7788
|
+
inputTokenInfo.mint,
|
|
7789
|
+
inputTokenInfo.currentEpoch
|
|
7790
|
+
).transferFee
|
|
7791
|
+
) : inAmount;
|
|
7792
|
+
const { liquidityDelta, rawAmount } = isTokenA ? {
|
|
7793
|
+
liquidityDelta: getLiquidityDeltaFromAmountA(
|
|
7794
|
+
actualAmountIn,
|
|
7795
|
+
sqrtPrice,
|
|
7796
|
+
maxSqrtPrice
|
|
7797
|
+
),
|
|
7798
|
+
rawAmount: (delta) => getAmountBFromLiquidityDelta(
|
|
7799
|
+
delta,
|
|
7800
|
+
sqrtPrice,
|
|
7801
|
+
minSqrtPrice,
|
|
7802
|
+
0 /* Up */
|
|
7803
|
+
)
|
|
7804
|
+
} : {
|
|
7805
|
+
liquidityDelta: getLiquidityDeltaFromAmountB(
|
|
7806
|
+
actualAmountIn,
|
|
7808
7807
|
minSqrtPrice,
|
|
7809
|
-
maxSqrtPrice,
|
|
7810
7808
|
sqrtPrice
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
} : {
|
|
7832
|
-
liquidityDelta: getLiquidityDeltaFromAmountB(
|
|
7833
|
-
actualAmountIn,
|
|
7834
|
-
minSqrtPrice,
|
|
7835
|
-
sqrtPrice
|
|
7836
|
-
),
|
|
7837
|
-
rawAmount: (delta) => getAmountAFromLiquidityDelta(
|
|
7838
|
-
delta,
|
|
7839
|
-
sqrtPrice,
|
|
7840
|
-
maxSqrtPrice,
|
|
7841
|
-
0 /* Up */
|
|
7842
|
-
)
|
|
7843
|
-
};
|
|
7844
|
-
const rawOutputAmount = new (0, _anchor.BN)(rawAmount(liquidityDelta));
|
|
7845
|
-
const outputAmount = outputTokenInfo ? calculateTransferFeeIncludedAmount(
|
|
7846
|
-
rawOutputAmount,
|
|
7847
|
-
outputTokenInfo.mint,
|
|
7848
|
-
outputTokenInfo.currentEpoch
|
|
7849
|
-
).amount : rawOutputAmount;
|
|
7850
|
-
return {
|
|
7851
|
-
actualInputAmount: actualAmountIn,
|
|
7852
|
-
consumedInputAmount: inAmount,
|
|
7853
|
-
liquidityDelta,
|
|
7854
|
-
outputAmount
|
|
7855
|
-
};
|
|
7856
|
-
});
|
|
7809
|
+
),
|
|
7810
|
+
rawAmount: (delta) => getAmountAFromLiquidityDelta(
|
|
7811
|
+
delta,
|
|
7812
|
+
sqrtPrice,
|
|
7813
|
+
maxSqrtPrice,
|
|
7814
|
+
0 /* Up */
|
|
7815
|
+
)
|
|
7816
|
+
};
|
|
7817
|
+
const rawOutputAmount = new (0, _anchor.BN)(rawAmount(liquidityDelta));
|
|
7818
|
+
const outputAmount = outputTokenInfo ? calculateTransferFeeIncludedAmount(
|
|
7819
|
+
rawOutputAmount,
|
|
7820
|
+
outputTokenInfo.mint,
|
|
7821
|
+
outputTokenInfo.currentEpoch
|
|
7822
|
+
).amount : rawOutputAmount;
|
|
7823
|
+
return {
|
|
7824
|
+
actualInputAmount: actualAmountIn,
|
|
7825
|
+
consumedInputAmount: inAmount,
|
|
7826
|
+
liquidityDelta,
|
|
7827
|
+
outputAmount
|
|
7828
|
+
};
|
|
7857
7829
|
}
|
|
7858
7830
|
/**
|
|
7859
7831
|
* Calculates the withdrawal quote for removing liquidity from a concentrated liquidity pool.
|
|
@@ -7869,41 +7841,39 @@ var CpAmm = class {
|
|
|
7869
7841
|
* @returns {BN} returns.outAmountB - The calculated amount of token B to be received (after deducting transfer fees)
|
|
7870
7842
|
*/
|
|
7871
7843
|
getWithdrawQuote(params) {
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
};
|
|
7906
|
-
});
|
|
7844
|
+
const {
|
|
7845
|
+
liquidityDelta,
|
|
7846
|
+
sqrtPrice,
|
|
7847
|
+
maxSqrtPrice,
|
|
7848
|
+
minSqrtPrice,
|
|
7849
|
+
tokenATokenInfo,
|
|
7850
|
+
tokenBTokenInfo
|
|
7851
|
+
} = params;
|
|
7852
|
+
const amountA = getAmountAFromLiquidityDelta(
|
|
7853
|
+
liquidityDelta,
|
|
7854
|
+
sqrtPrice,
|
|
7855
|
+
maxSqrtPrice,
|
|
7856
|
+
1 /* Down */
|
|
7857
|
+
);
|
|
7858
|
+
const amountB = getAmountBFromLiquidityDelta(
|
|
7859
|
+
liquidityDelta,
|
|
7860
|
+
sqrtPrice,
|
|
7861
|
+
minSqrtPrice,
|
|
7862
|
+
1 /* Down */
|
|
7863
|
+
);
|
|
7864
|
+
return {
|
|
7865
|
+
liquidityDelta,
|
|
7866
|
+
outAmountA: tokenATokenInfo ? calculateTransferFeeExcludedAmount(
|
|
7867
|
+
amountA,
|
|
7868
|
+
tokenATokenInfo.mint,
|
|
7869
|
+
tokenATokenInfo.currentEpoch
|
|
7870
|
+
).amount : amountA,
|
|
7871
|
+
outAmountB: tokenBTokenInfo ? calculateTransferFeeExcludedAmount(
|
|
7872
|
+
amountB,
|
|
7873
|
+
tokenBTokenInfo.mint,
|
|
7874
|
+
tokenBTokenInfo.currentEpoch
|
|
7875
|
+
).amount : amountB
|
|
7876
|
+
};
|
|
7907
7877
|
}
|
|
7908
7878
|
/**
|
|
7909
7879
|
* Calculates liquidity and corresponding token amounts for token A single-sided pool creation
|
|
@@ -9124,9 +9094,5 @@ var index_default = cp_amm_default;
|
|
|
9124
9094
|
|
|
9125
9095
|
|
|
9126
9096
|
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
exports.ActivationPoint = ActivationPoint; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.CP_AMM_PROGRAM_ID = CP_AMM_PROGRAM_ID; exports.CollectFeeMode = CollectFeeMode; exports.CpAmm = CpAmm; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.LIQUIDITY_SCALE = LIQUIDITY_SCALE; exports.MAX_CU_BUFFER = MAX_CU_BUFFER; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MIN_CU_BUFFER = MIN_CU_BUFFER; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.ONE = ONE; exports.PRECISION = PRECISION; exports.Rounding = Rounding; exports.SCALE_OFFSET = SCALE_OFFSET; exports.TradeDirection = TradeDirection; exports.calculateInitSqrtPrice = calculateInitSqrtPrice; exports.calculateTransferFeeExcludedAmount = calculateTransferFeeExcludedAmount; exports.calculateTransferFeeIncludedAmount = calculateTransferFeeIncludedAmount; exports.decimalToQ64 = decimalToQ64; exports.default = index_default; exports.deriveClaimFeeOperatorAddress = deriveClaimFeeOperatorAddress; exports.deriveConfigAddress = deriveConfigAddress; exports.deriveCustomizablePoolAddress = deriveCustomizablePoolAddress; exports.derivePoolAddress = derivePoolAddress; exports.derivePoolAuthority = derivePoolAuthority; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveRewardVaultAddress = deriveRewardVaultAddress; exports.deriveTokenBadge = deriveTokenBadge; exports.deriveTokenBadgeAddress = deriveTokenBadgeAddress; exports.deriveTokenVaultAddress = deriveTokenVaultAddress; exports.divCeil = divCeil; exports.getAllUserPositionNftAccount = getAllUserPositionNftAccount; exports.getAmountAFromLiquidityDelta = getAmountAFromLiquidityDelta; exports.getAmountBFromLiquidityDelta = getAmountBFromLiquidityDelta; exports.getAvailableVestingLiquidity = getAvailableVestingLiquidity; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getDynamicFeeNumerator = getDynamicFeeNumerator; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getFeeNumerator = getFeeNumerator; exports.getFirstKey = getFirstKey; exports.getLiquidityDeltaFromAmountA = getLiquidityDeltaFromAmountA; exports.getLiquidityDeltaFromAmountB = getLiquidityDeltaFromAmountB; exports.getMaxAmountWithSlippage = getMaxAmountWithSlippage; exports.getMinAmountWithSlippage = getMinAmountWithSlippage; exports.getNextSqrtPrice = getNextSqrtPrice; exports.getNftOwner = getNftOwner; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getPriceImpact = getPriceImpact; exports.getSecondKey = getSecondKey; exports.getSimulationComputeUnits = getSimulationComputeUnits; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getSwapAmount = getSwapAmount; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTotalLockedLiquidity = getTotalLockedLiquidity; exports.getUnClaimReward = getUnClaimReward; exports.isVestingComplete = isVestingComplete; exports.mulDiv = mulDiv; exports.positionByPoolFilter = positionByPoolFilter; exports.pow = pow; exports.q64ToDecimal = q64ToDecimal; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.vestingByPositionFilter = vestingByPositionFilter; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
9097
|
+
exports.ActivationPoint = ActivationPoint; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.CP_AMM_PROGRAM_ID = CP_AMM_PROGRAM_ID; exports.CollectFeeMode = CollectFeeMode; exports.CpAmm = CpAmm; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.LIQUIDITY_SCALE = LIQUIDITY_SCALE; exports.MAX_CU_BUFFER = MAX_CU_BUFFER; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MIN_CU_BUFFER = MIN_CU_BUFFER; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.ONE = ONE; exports.Rounding = Rounding; exports.SCALE_OFFSET = SCALE_OFFSET; exports.TradeDirection = TradeDirection; exports.calculateInitSqrtPrice = calculateInitSqrtPrice; exports.calculateTransferFeeExcludedAmount = calculateTransferFeeExcludedAmount; exports.calculateTransferFeeIncludedAmount = calculateTransferFeeIncludedAmount; exports.decimalToQ64 = decimalToQ64; exports.default = index_default; exports.deriveClaimFeeOperatorAddress = deriveClaimFeeOperatorAddress; exports.deriveConfigAddress = deriveConfigAddress; exports.deriveCustomizablePoolAddress = deriveCustomizablePoolAddress; exports.derivePoolAddress = derivePoolAddress; exports.derivePoolAuthority = derivePoolAuthority; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveRewardVaultAddress = deriveRewardVaultAddress; exports.deriveTokenBadgeAddress = deriveTokenBadgeAddress; exports.deriveTokenVaultAddress = deriveTokenVaultAddress; exports.getAllUserPositionNftAccount = getAllUserPositionNftAccount; exports.getAmountAFromLiquidityDelta = getAmountAFromLiquidityDelta; exports.getAmountBFromLiquidityDelta = getAmountBFromLiquidityDelta; exports.getAvailableVestingLiquidity = getAvailableVestingLiquidity; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getDynamicFeeNumerator = getDynamicFeeNumerator; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getFeeNumerator = getFeeNumerator; exports.getFirstKey = getFirstKey; exports.getLiquidityDeltaFromAmountA = getLiquidityDeltaFromAmountA; exports.getLiquidityDeltaFromAmountB = getLiquidityDeltaFromAmountB; exports.getMaxAmountWithSlippage = getMaxAmountWithSlippage; exports.getMinAmountWithSlippage = getMinAmountWithSlippage; exports.getNextSqrtPrice = getNextSqrtPrice; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getPriceImpact = getPriceImpact; exports.getSecondKey = getSecondKey; exports.getSimulationComputeUnits = getSimulationComputeUnits; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getSwapAmount = getSwapAmount; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTotalLockedLiquidity = getTotalLockedLiquidity; exports.getUnClaimReward = getUnClaimReward; exports.isVestingComplete = isVestingComplete; exports.mulDiv = mulDiv; exports.positionByPoolFilter = positionByPoolFilter; exports.pow = pow; exports.q64ToDecimal = q64ToDecimal; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.vestingByPositionFilter = vestingByPositionFilter; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
9132
9098
|
//# sourceMappingURL=index.js.map
|