@meteora-ag/cp-amm-sdk 1.2.4-rc.0 → 1.2.5
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 +1 -11
- package/dist/index.d.ts +1 -11
- package/dist/index.js +24 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11640,82 +11640,6 @@ var CpAmm = class {
|
|
|
11640
11640
|
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
11641
11641
|
});
|
|
11642
11642
|
}
|
|
11643
|
-
/**
|
|
11644
|
-
* Builds a transaction to remove liquidity from a position.
|
|
11645
|
-
* @param {RemoveLiquidityParams} params - Parameters for removing liquidity.
|
|
11646
|
-
* @returns Transaction builder.
|
|
11647
|
-
*/
|
|
11648
|
-
removeLiquidity2(params) {
|
|
11649
|
-
return __async(this, null, function* () {
|
|
11650
|
-
const {
|
|
11651
|
-
owner,
|
|
11652
|
-
receiver,
|
|
11653
|
-
feePayer,
|
|
11654
|
-
pool,
|
|
11655
|
-
position,
|
|
11656
|
-
positionNftAccount,
|
|
11657
|
-
liquidityDelta,
|
|
11658
|
-
tokenAAmountThreshold,
|
|
11659
|
-
tokenBAmountThreshold,
|
|
11660
|
-
tokenAMint,
|
|
11661
|
-
tokenBMint,
|
|
11662
|
-
tokenAVault,
|
|
11663
|
-
tokenBVault,
|
|
11664
|
-
tokenAProgram,
|
|
11665
|
-
tokenBProgram,
|
|
11666
|
-
vestings
|
|
11667
|
-
} = params;
|
|
11668
|
-
const {
|
|
11669
|
-
tokenAAta: tokenAAccount,
|
|
11670
|
-
tokenBAta: tokenBAccount,
|
|
11671
|
-
instructions: preInstructions
|
|
11672
|
-
} = yield this.prepareTokenAccounts({
|
|
11673
|
-
payer: feePayer,
|
|
11674
|
-
tokenAOwner: receiver,
|
|
11675
|
-
tokenBOwner: receiver,
|
|
11676
|
-
tokenAMint,
|
|
11677
|
-
tokenBMint,
|
|
11678
|
-
tokenAProgram,
|
|
11679
|
-
tokenBProgram
|
|
11680
|
-
});
|
|
11681
|
-
const postInstructions = [];
|
|
11682
|
-
if ([tokenAMint.toBase58(), tokenBMint.toBase58()].includes(
|
|
11683
|
-
NATIVE_MINT2.toBase58()
|
|
11684
|
-
)) {
|
|
11685
|
-
const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
|
|
11686
|
-
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
11687
|
-
}
|
|
11688
|
-
if (vestings.length > 0) {
|
|
11689
|
-
const refreshVestingInstruction = yield this.buildRefreshVestingInstruction({
|
|
11690
|
-
owner,
|
|
11691
|
-
position,
|
|
11692
|
-
positionNftAccount,
|
|
11693
|
-
pool,
|
|
11694
|
-
vestingAccounts: vestings.map((item) => item.account)
|
|
11695
|
-
});
|
|
11696
|
-
refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
|
|
11697
|
-
}
|
|
11698
|
-
return yield this._program.methods.removeLiquidity({
|
|
11699
|
-
liquidityDelta,
|
|
11700
|
-
tokenAAmountThreshold,
|
|
11701
|
-
tokenBAmountThreshold
|
|
11702
|
-
}).accountsPartial({
|
|
11703
|
-
poolAuthority: this.poolAuthority,
|
|
11704
|
-
pool,
|
|
11705
|
-
position,
|
|
11706
|
-
positionNftAccount,
|
|
11707
|
-
owner,
|
|
11708
|
-
tokenAAccount,
|
|
11709
|
-
tokenBAccount,
|
|
11710
|
-
tokenAMint,
|
|
11711
|
-
tokenBMint,
|
|
11712
|
-
tokenAVault,
|
|
11713
|
-
tokenBVault,
|
|
11714
|
-
tokenAProgram,
|
|
11715
|
-
tokenBProgram
|
|
11716
|
-
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
11717
|
-
});
|
|
11718
|
-
}
|
|
11719
11643
|
/**
|
|
11720
11644
|
* Builds a transaction to remove liquidity from a position.
|
|
11721
11645
|
* @param {RemoveLiquidityParams} params - Parameters for removing liquidity.
|
|
@@ -11857,15 +11781,18 @@ var CpAmm = class {
|
|
|
11857
11781
|
const { maxLimiterDuration, maxFeeBps } = parseRateLimiterSecondFactor(
|
|
11858
11782
|
poolState.poolFees.baseFee.secondFactor
|
|
11859
11783
|
);
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11784
|
+
let rateLimiterApplied = false;
|
|
11785
|
+
if (poolState.poolFees.baseFee.baseFeeMode === 2 /* RateLimiter */) {
|
|
11786
|
+
rateLimiterApplied = isRateLimiterApplied(
|
|
11787
|
+
poolState.poolFees.baseFee.thirdFactor,
|
|
11788
|
+
maxLimiterDuration,
|
|
11789
|
+
maxFeeBps,
|
|
11790
|
+
poolState.poolFees.baseFee.firstFactor,
|
|
11791
|
+
currentPoint,
|
|
11792
|
+
poolState.activationPoint,
|
|
11793
|
+
tradeDirection
|
|
11794
|
+
);
|
|
11795
|
+
}
|
|
11869
11796
|
const remainingAccounts = rateLimiterApplied ? [
|
|
11870
11797
|
{
|
|
11871
11798
|
isSigner: false,
|
|
@@ -11964,15 +11891,18 @@ var CpAmm = class {
|
|
|
11964
11891
|
const { maxLimiterDuration, maxFeeBps } = parseRateLimiterSecondFactor(
|
|
11965
11892
|
poolState.poolFees.baseFee.secondFactor
|
|
11966
11893
|
);
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11894
|
+
let rateLimiterApplied = false;
|
|
11895
|
+
if (poolState.poolFees.baseFee.baseFeeMode === 2 /* RateLimiter */) {
|
|
11896
|
+
rateLimiterApplied = isRateLimiterApplied(
|
|
11897
|
+
poolState.poolFees.baseFee.thirdFactor,
|
|
11898
|
+
maxLimiterDuration,
|
|
11899
|
+
maxFeeBps,
|
|
11900
|
+
poolState.poolFees.baseFee.firstFactor,
|
|
11901
|
+
currentPoint,
|
|
11902
|
+
poolState.activationPoint,
|
|
11903
|
+
tradeDirection
|
|
11904
|
+
);
|
|
11905
|
+
}
|
|
11976
11906
|
const remainingAccounts = rateLimiterApplied ? [
|
|
11977
11907
|
{
|
|
11978
11908
|
isSigner: false,
|