@meteora-ag/cp-amm-sdk 1.1.6 → 1.1.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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -11
- 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;
|
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;
|
package/dist/index.js
CHANGED
|
@@ -10783,9 +10783,9 @@ var CpAmm = class {
|
|
|
10783
10783
|
maxSqrtPrice
|
|
10784
10784
|
),
|
|
10785
10785
|
rawAmount: (delta) => getAmountBFromLiquidityDelta(
|
|
10786
|
-
delta,
|
|
10787
|
-
sqrtPrice,
|
|
10788
10786
|
minSqrtPrice,
|
|
10787
|
+
sqrtPrice,
|
|
10788
|
+
delta,
|
|
10789
10789
|
0 /* Up */
|
|
10790
10790
|
)
|
|
10791
10791
|
} : {
|
|
@@ -10795,9 +10795,9 @@ var CpAmm = class {
|
|
|
10795
10795
|
sqrtPrice
|
|
10796
10796
|
),
|
|
10797
10797
|
rawAmount: (delta) => getAmountAFromLiquidityDelta(
|
|
10798
|
-
delta,
|
|
10799
10798
|
sqrtPrice,
|
|
10800
10799
|
maxSqrtPrice,
|
|
10800
|
+
delta,
|
|
10801
10801
|
0 /* Up */
|
|
10802
10802
|
)
|
|
10803
10803
|
};
|
|
@@ -10837,15 +10837,15 @@ var CpAmm = class {
|
|
|
10837
10837
|
tokenBTokenInfo
|
|
10838
10838
|
} = params;
|
|
10839
10839
|
const amountA = getAmountAFromLiquidityDelta(
|
|
10840
|
-
liquidityDelta,
|
|
10841
10840
|
sqrtPrice,
|
|
10842
10841
|
maxSqrtPrice,
|
|
10842
|
+
liquidityDelta,
|
|
10843
10843
|
1 /* Down */
|
|
10844
10844
|
);
|
|
10845
10845
|
const amountB = getAmountBFromLiquidityDelta(
|
|
10846
|
-
liquidityDelta,
|
|
10847
|
-
sqrtPrice,
|
|
10848
10846
|
minSqrtPrice,
|
|
10847
|
+
sqrtPrice,
|
|
10848
|
+
liquidityDelta,
|
|
10849
10849
|
1 /* Down */
|
|
10850
10850
|
);
|
|
10851
10851
|
return {
|
|
@@ -11616,7 +11616,8 @@ var CpAmm = class {
|
|
|
11616
11616
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(payer);
|
|
11617
11617
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
11618
11618
|
}
|
|
11619
|
-
|
|
11619
|
+
let { poolState } = params;
|
|
11620
|
+
poolState = poolState != null ? poolState : yield this.fetchPoolState(pool);
|
|
11620
11621
|
const currentPoint = yield getCurrentPoint(
|
|
11621
11622
|
this._program.provider.connection,
|
|
11622
11623
|
poolState.activationType
|
|
@@ -11717,7 +11718,8 @@ var CpAmm = class {
|
|
|
11717
11718
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(payer);
|
|
11718
11719
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
11719
11720
|
}
|
|
11720
|
-
|
|
11721
|
+
let { poolState } = params;
|
|
11722
|
+
poolState = poolState != null ? poolState : yield this.fetchPoolState(pool);
|
|
11721
11723
|
const currentPoint = yield getCurrentPoint(
|
|
11722
11724
|
this._program.provider.connection,
|
|
11723
11725
|
poolState.activationType
|
|
@@ -12007,15 +12009,15 @@ var CpAmm = class {
|
|
|
12007
12009
|
refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
|
|
12008
12010
|
}
|
|
12009
12011
|
const tokenAWithdrawAmount = getAmountAFromLiquidityDelta(
|
|
12010
|
-
positionBLiquidityDelta,
|
|
12011
12012
|
poolState.sqrtPrice,
|
|
12012
12013
|
poolState.sqrtMaxPrice,
|
|
12014
|
+
positionBLiquidityDelta,
|
|
12013
12015
|
1 /* Down */
|
|
12014
12016
|
);
|
|
12015
12017
|
const tokenBWithdrawAmount = getAmountBFromLiquidityDelta(
|
|
12016
|
-
positionBLiquidityDelta,
|
|
12017
|
-
poolState.sqrtPrice,
|
|
12018
12018
|
poolState.sqrtMinPrice,
|
|
12019
|
+
poolState.sqrtPrice,
|
|
12020
|
+
positionBLiquidityDelta,
|
|
12019
12021
|
1 /* Down */
|
|
12020
12022
|
);
|
|
12021
12023
|
const newLiquidityDelta = this.getLiquidityDelta({
|