@meteora-ag/cp-amm-sdk 1.0.1-rc.25 → 1.0.1-rc.26
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 +158 -2
- package/dist/index.d.ts +158 -2
- package/dist/index.js +577 -258
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +577 -258
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5294,14 +5294,80 @@ type LiquidityDeltaParams = {
|
|
|
5294
5294
|
currentEpoch: number;
|
|
5295
5295
|
};
|
|
5296
5296
|
};
|
|
5297
|
-
type RemoveLiquidityParams =
|
|
5297
|
+
type RemoveLiquidityParams = {
|
|
5298
|
+
owner: PublicKey;
|
|
5299
|
+
position: PublicKey;
|
|
5300
|
+
pool: PublicKey;
|
|
5301
|
+
positionNftMint: PublicKey;
|
|
5302
|
+
liquidityDeltaQ64: BN;
|
|
5303
|
+
tokenAAmountThreshold: BN;
|
|
5304
|
+
tokenBAmountThreshold: BN;
|
|
5305
|
+
tokenAMint: PublicKey;
|
|
5306
|
+
tokenBMint: PublicKey;
|
|
5307
|
+
tokenAVault: PublicKey;
|
|
5308
|
+
tokenBVault: PublicKey;
|
|
5309
|
+
tokenAProgram: PublicKey;
|
|
5310
|
+
tokenBProgram: PublicKey;
|
|
5311
|
+
};
|
|
5298
5312
|
type RemoveAllLiquidityParams = Omit<RemoveLiquidityParams, "liquidityDeltaQ64">;
|
|
5313
|
+
type BuildAddLiquidityParams = {
|
|
5314
|
+
owner: PublicKey;
|
|
5315
|
+
position: PublicKey;
|
|
5316
|
+
pool: PublicKey;
|
|
5317
|
+
positionNftAccount: PublicKey;
|
|
5318
|
+
liquidityDelta: BN;
|
|
5319
|
+
tokenAAccount: PublicKey;
|
|
5320
|
+
tokenBAccount: PublicKey;
|
|
5321
|
+
tokenAAmountThreshold: BN;
|
|
5322
|
+
tokenBAmountThreshold: BN;
|
|
5323
|
+
tokenAMint: PublicKey;
|
|
5324
|
+
tokenBMint: PublicKey;
|
|
5325
|
+
tokenAVault: PublicKey;
|
|
5326
|
+
tokenBVault: PublicKey;
|
|
5327
|
+
tokenAProgram: PublicKey;
|
|
5328
|
+
tokenBProgram: PublicKey;
|
|
5329
|
+
};
|
|
5330
|
+
type BuildRemoveAllLiquidityInstructionParams = {
|
|
5331
|
+
poolAuthority: PublicKey;
|
|
5332
|
+
owner: PublicKey;
|
|
5333
|
+
position: PublicKey;
|
|
5334
|
+
pool: PublicKey;
|
|
5335
|
+
positionNftAccount: PublicKey;
|
|
5336
|
+
tokenAAccount: PublicKey;
|
|
5337
|
+
tokenBAccount: PublicKey;
|
|
5338
|
+
tokenAAmountThreshold: BN;
|
|
5339
|
+
tokenBAmountThreshold: BN;
|
|
5340
|
+
tokenAMint: PublicKey;
|
|
5341
|
+
tokenBMint: PublicKey;
|
|
5342
|
+
tokenAVault: PublicKey;
|
|
5343
|
+
tokenBVault: PublicKey;
|
|
5344
|
+
tokenAProgram: PublicKey;
|
|
5345
|
+
tokenBProgram: PublicKey;
|
|
5346
|
+
};
|
|
5299
5347
|
type ClosePositionParams = {
|
|
5300
5348
|
owner: PublicKey;
|
|
5301
5349
|
pool: PublicKey;
|
|
5302
5350
|
position: PublicKey;
|
|
5303
5351
|
positionNftMint: PublicKey;
|
|
5304
5352
|
};
|
|
5353
|
+
type RemoveAllLiquidityAndClosePositionParams = {
|
|
5354
|
+
owner: PublicKey;
|
|
5355
|
+
position: PublicKey;
|
|
5356
|
+
poolState: PoolState;
|
|
5357
|
+
positionState: PositionState;
|
|
5358
|
+
tokenAAmountThreshold: BN;
|
|
5359
|
+
tokenBAmountThreshold: BN;
|
|
5360
|
+
};
|
|
5361
|
+
type MergePositionParams = {
|
|
5362
|
+
owner: PublicKey;
|
|
5363
|
+
positionA: PublicKey;
|
|
5364
|
+
positionB: PublicKey;
|
|
5365
|
+
poolState: PoolState;
|
|
5366
|
+
positionAState: PositionState;
|
|
5367
|
+
positionBState: PositionState;
|
|
5368
|
+
tokenAAmountThreshold: BN;
|
|
5369
|
+
tokenBAmountThreshold: BN;
|
|
5370
|
+
};
|
|
5305
5371
|
type GetQuoteParams = {
|
|
5306
5372
|
inAmount: BN;
|
|
5307
5373
|
inputTokenMint: PublicKey;
|
|
@@ -5351,6 +5417,21 @@ type LockPositionParams = {
|
|
|
5351
5417
|
liquidityPerPeriod: BN;
|
|
5352
5418
|
numberOfPeriod: number;
|
|
5353
5419
|
};
|
|
5420
|
+
type ClaimPositionFeeInstructionParams = {
|
|
5421
|
+
owner: PublicKey;
|
|
5422
|
+
poolAuthority: PublicKey;
|
|
5423
|
+
pool: PublicKey;
|
|
5424
|
+
position: PublicKey;
|
|
5425
|
+
positionNftAccount: PublicKey;
|
|
5426
|
+
tokenAAccount: PublicKey;
|
|
5427
|
+
tokenBAccount: PublicKey;
|
|
5428
|
+
tokenAVault: PublicKey;
|
|
5429
|
+
tokenBVault: PublicKey;
|
|
5430
|
+
tokenAMint: PublicKey;
|
|
5431
|
+
tokenBMint: PublicKey;
|
|
5432
|
+
tokenAProgram: PublicKey;
|
|
5433
|
+
tokenBProgram: PublicKey;
|
|
5434
|
+
};
|
|
5354
5435
|
type ClaimPositionFeeParams = {
|
|
5355
5436
|
owner: PublicKey;
|
|
5356
5437
|
position: PublicKey;
|
|
@@ -5363,6 +5444,14 @@ type ClaimPositionFeeParams = {
|
|
|
5363
5444
|
tokenAProgram: PublicKey;
|
|
5364
5445
|
tokenBProgram: PublicKey;
|
|
5365
5446
|
};
|
|
5447
|
+
type ClosePositionInstructionParams = {
|
|
5448
|
+
owner: PublicKey;
|
|
5449
|
+
poolAuthority: PublicKey;
|
|
5450
|
+
pool: PublicKey;
|
|
5451
|
+
position: PublicKey;
|
|
5452
|
+
positionNftMint: PublicKey;
|
|
5453
|
+
positionNftAccount: PublicKey;
|
|
5454
|
+
};
|
|
5366
5455
|
type InitializeRewardParams = {
|
|
5367
5456
|
rewardIndex: number;
|
|
5368
5457
|
rewardDuration: BN;
|
|
@@ -5438,6 +5527,18 @@ declare class CpAmm {
|
|
|
5438
5527
|
* @returns init sqrt price and liquidity in Q64 format.
|
|
5439
5528
|
*/
|
|
5440
5529
|
private preparePoolCreationParams;
|
|
5530
|
+
/**
|
|
5531
|
+
* Prepares token accounts for a transaction by retrieving or creating associated token accounts.
|
|
5532
|
+
* @private
|
|
5533
|
+
* @param {PublicKey} owner - The owner of the token accounts
|
|
5534
|
+
* @param {PublicKey} tokenAMint - Mint address of token A
|
|
5535
|
+
* @param {PublicKey} tokenBMint - Mint address of token B
|
|
5536
|
+
* @param {PublicKey} tokenAProgram - Program ID for token A (Token or Token2022)
|
|
5537
|
+
* @param {PublicKey} tokenBProgram - Program ID for token B (Token or Token2022)
|
|
5538
|
+
* @returns {Promise<{tokenAAta: PublicKey, tokenBAta: PublicKey, instructions: TransactionInstruction[]}>}
|
|
5539
|
+
* The token account addresses and any instructions needed to create them
|
|
5540
|
+
*/
|
|
5541
|
+
private prepareTokenAccounts;
|
|
5441
5542
|
/**
|
|
5442
5543
|
* Derives token badge account metadata
|
|
5443
5544
|
* @param tokenAMint - Public key of token A mint
|
|
@@ -5445,6 +5546,34 @@ declare class CpAmm {
|
|
|
5445
5546
|
* @returns Array of account metadata for token badges
|
|
5446
5547
|
*/
|
|
5447
5548
|
private getTokenBadgeAccounts;
|
|
5549
|
+
/**
|
|
5550
|
+
* Builds an instruction to add liquidity to a position.
|
|
5551
|
+
* @private
|
|
5552
|
+
* @param {BuildAddLiquidityParams} params - Parameters for adding liquidity
|
|
5553
|
+
* @returns {Promise<TransactionInstruction>} Instruction to add liquidity
|
|
5554
|
+
*/
|
|
5555
|
+
private buildAddLiquidityInstruction;
|
|
5556
|
+
/**
|
|
5557
|
+
* Builds an instruction to remove all liquidity from a position.
|
|
5558
|
+
* @private
|
|
5559
|
+
* @param {BuildRemoveAllLiquidityInstructionParams} params - Parameters for removing all liquidity
|
|
5560
|
+
* @returns {Promise<TransactionInstruction>} Instruction to remove all liquidity
|
|
5561
|
+
*/
|
|
5562
|
+
private buildRemoveAllLiquidityInstruction;
|
|
5563
|
+
/**
|
|
5564
|
+
* Builds an instruction to claim fees accumulated by a position.
|
|
5565
|
+
* @private
|
|
5566
|
+
* @param {ClaimPositionFeeInstructionParams} params - Parameters for claiming position fees
|
|
5567
|
+
* @returns {Promise<TransactionInstruction>} Instruction to claim position fees
|
|
5568
|
+
*/
|
|
5569
|
+
private buildClaimPositionFeeInstruction;
|
|
5570
|
+
/**
|
|
5571
|
+
* Builds an instruction to close a position.
|
|
5572
|
+
* @private
|
|
5573
|
+
* @param {ClosePositionInstructionParams} params - Parameters for closing a position
|
|
5574
|
+
* @returns {Promise<TransactionInstruction>} Instruction to close the position
|
|
5575
|
+
*/
|
|
5576
|
+
private buildClosePositionInstruction;
|
|
5448
5577
|
/**
|
|
5449
5578
|
* Fetches the Config state of the program.
|
|
5450
5579
|
* @param config - Public key of the config account.
|
|
@@ -5519,6 +5648,8 @@ declare class CpAmm {
|
|
|
5519
5648
|
publicKey: PublicKey;
|
|
5520
5649
|
account: VestingState;
|
|
5521
5650
|
}>>;
|
|
5651
|
+
isLockedPosition(position: PositionState): boolean;
|
|
5652
|
+
isPoolExist(pool: PublicKey): Promise<boolean>;
|
|
5522
5653
|
/**
|
|
5523
5654
|
* Calculates swap quote based on input amount and pool state.
|
|
5524
5655
|
* @param params - Swap parameters including input amount, pool state, slippage, etc.
|
|
@@ -5610,6 +5741,31 @@ declare class CpAmm {
|
|
|
5610
5741
|
*/
|
|
5611
5742
|
claimPositionFee(params: ClaimPositionFeeParams): TxBuilder;
|
|
5612
5743
|
closePosition(params: ClosePositionParams): TxBuilder;
|
|
5744
|
+
/**
|
|
5745
|
+
* Builds a transaction to remove all liquidity from a position and close it.
|
|
5746
|
+
* This combines several operations in a single transaction:
|
|
5747
|
+
* 1. Claims any accumulated fees
|
|
5748
|
+
* 2. Removes all liquidity
|
|
5749
|
+
* 3. Closes the position
|
|
5750
|
+
*
|
|
5751
|
+
* @param {RemoveAllLiquidityAndClosePositionParams} params - Combined parameters
|
|
5752
|
+
* @returns {TxBuilder} Transaction builder with all required instructions
|
|
5753
|
+
* @throws {Error} If the position is locked or cannot be closed
|
|
5754
|
+
*/
|
|
5755
|
+
removeAllLiquidityAndClosePosition(params: RemoveAllLiquidityAndClosePositionParams): TxBuilder;
|
|
5756
|
+
/**
|
|
5757
|
+
* Builds a transaction to merge liquidity from one position into another.
|
|
5758
|
+
* This process:
|
|
5759
|
+
* 1. Claims fees from the source position
|
|
5760
|
+
* 2. Removes all liquidity from the source position
|
|
5761
|
+
* 3. Adds that liquidity to the target position
|
|
5762
|
+
* 4. Closes the source position
|
|
5763
|
+
*
|
|
5764
|
+
* @param {MergePositionParams} params - Parameters for merging positions
|
|
5765
|
+
* @returns {TxBuilder} Transaction builder with all required instructions
|
|
5766
|
+
* @throws {Error} If either position is locked or incompatible
|
|
5767
|
+
*/
|
|
5768
|
+
mergePosition(params: MergePositionParams): TxBuilder;
|
|
5613
5769
|
/**
|
|
5614
5770
|
* Builds a transaction to update reward duration.
|
|
5615
5771
|
* @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.
|
|
@@ -12163,4 +12319,4 @@ var CpAmmIDL = {
|
|
|
12163
12319
|
types: types
|
|
12164
12320
|
};
|
|
12165
12321
|
|
|
12166
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeParams, type ClaimRewardParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionParams, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetQuoteParams, type InitializeCustomizeablePoolParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, ONE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllNftByUser, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getCurrentPrice, getDeltaAmountA, getDeltaAmountB, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, mulShr, positionByPoolFilter, pow, q64ToDecimal, shlDiv, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
|
12322
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, type BuildAddLiquidityParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionParams, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetQuoteParams, type InitializeCustomizeablePoolParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllNftByUser, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getCurrentPrice, getDeltaAmountA, getDeltaAmountB, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, mulShr, positionByPoolFilter, pow, q64ToDecimal, shlDiv, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
package/dist/index.d.ts
CHANGED
|
@@ -5294,14 +5294,80 @@ type LiquidityDeltaParams = {
|
|
|
5294
5294
|
currentEpoch: number;
|
|
5295
5295
|
};
|
|
5296
5296
|
};
|
|
5297
|
-
type RemoveLiquidityParams =
|
|
5297
|
+
type RemoveLiquidityParams = {
|
|
5298
|
+
owner: PublicKey;
|
|
5299
|
+
position: PublicKey;
|
|
5300
|
+
pool: PublicKey;
|
|
5301
|
+
positionNftMint: PublicKey;
|
|
5302
|
+
liquidityDeltaQ64: BN;
|
|
5303
|
+
tokenAAmountThreshold: BN;
|
|
5304
|
+
tokenBAmountThreshold: BN;
|
|
5305
|
+
tokenAMint: PublicKey;
|
|
5306
|
+
tokenBMint: PublicKey;
|
|
5307
|
+
tokenAVault: PublicKey;
|
|
5308
|
+
tokenBVault: PublicKey;
|
|
5309
|
+
tokenAProgram: PublicKey;
|
|
5310
|
+
tokenBProgram: PublicKey;
|
|
5311
|
+
};
|
|
5298
5312
|
type RemoveAllLiquidityParams = Omit<RemoveLiquidityParams, "liquidityDeltaQ64">;
|
|
5313
|
+
type BuildAddLiquidityParams = {
|
|
5314
|
+
owner: PublicKey;
|
|
5315
|
+
position: PublicKey;
|
|
5316
|
+
pool: PublicKey;
|
|
5317
|
+
positionNftAccount: PublicKey;
|
|
5318
|
+
liquidityDelta: BN;
|
|
5319
|
+
tokenAAccount: PublicKey;
|
|
5320
|
+
tokenBAccount: PublicKey;
|
|
5321
|
+
tokenAAmountThreshold: BN;
|
|
5322
|
+
tokenBAmountThreshold: BN;
|
|
5323
|
+
tokenAMint: PublicKey;
|
|
5324
|
+
tokenBMint: PublicKey;
|
|
5325
|
+
tokenAVault: PublicKey;
|
|
5326
|
+
tokenBVault: PublicKey;
|
|
5327
|
+
tokenAProgram: PublicKey;
|
|
5328
|
+
tokenBProgram: PublicKey;
|
|
5329
|
+
};
|
|
5330
|
+
type BuildRemoveAllLiquidityInstructionParams = {
|
|
5331
|
+
poolAuthority: PublicKey;
|
|
5332
|
+
owner: PublicKey;
|
|
5333
|
+
position: PublicKey;
|
|
5334
|
+
pool: PublicKey;
|
|
5335
|
+
positionNftAccount: PublicKey;
|
|
5336
|
+
tokenAAccount: PublicKey;
|
|
5337
|
+
tokenBAccount: PublicKey;
|
|
5338
|
+
tokenAAmountThreshold: BN;
|
|
5339
|
+
tokenBAmountThreshold: BN;
|
|
5340
|
+
tokenAMint: PublicKey;
|
|
5341
|
+
tokenBMint: PublicKey;
|
|
5342
|
+
tokenAVault: PublicKey;
|
|
5343
|
+
tokenBVault: PublicKey;
|
|
5344
|
+
tokenAProgram: PublicKey;
|
|
5345
|
+
tokenBProgram: PublicKey;
|
|
5346
|
+
};
|
|
5299
5347
|
type ClosePositionParams = {
|
|
5300
5348
|
owner: PublicKey;
|
|
5301
5349
|
pool: PublicKey;
|
|
5302
5350
|
position: PublicKey;
|
|
5303
5351
|
positionNftMint: PublicKey;
|
|
5304
5352
|
};
|
|
5353
|
+
type RemoveAllLiquidityAndClosePositionParams = {
|
|
5354
|
+
owner: PublicKey;
|
|
5355
|
+
position: PublicKey;
|
|
5356
|
+
poolState: PoolState;
|
|
5357
|
+
positionState: PositionState;
|
|
5358
|
+
tokenAAmountThreshold: BN;
|
|
5359
|
+
tokenBAmountThreshold: BN;
|
|
5360
|
+
};
|
|
5361
|
+
type MergePositionParams = {
|
|
5362
|
+
owner: PublicKey;
|
|
5363
|
+
positionA: PublicKey;
|
|
5364
|
+
positionB: PublicKey;
|
|
5365
|
+
poolState: PoolState;
|
|
5366
|
+
positionAState: PositionState;
|
|
5367
|
+
positionBState: PositionState;
|
|
5368
|
+
tokenAAmountThreshold: BN;
|
|
5369
|
+
tokenBAmountThreshold: BN;
|
|
5370
|
+
};
|
|
5305
5371
|
type GetQuoteParams = {
|
|
5306
5372
|
inAmount: BN;
|
|
5307
5373
|
inputTokenMint: PublicKey;
|
|
@@ -5351,6 +5417,21 @@ type LockPositionParams = {
|
|
|
5351
5417
|
liquidityPerPeriod: BN;
|
|
5352
5418
|
numberOfPeriod: number;
|
|
5353
5419
|
};
|
|
5420
|
+
type ClaimPositionFeeInstructionParams = {
|
|
5421
|
+
owner: PublicKey;
|
|
5422
|
+
poolAuthority: PublicKey;
|
|
5423
|
+
pool: PublicKey;
|
|
5424
|
+
position: PublicKey;
|
|
5425
|
+
positionNftAccount: PublicKey;
|
|
5426
|
+
tokenAAccount: PublicKey;
|
|
5427
|
+
tokenBAccount: PublicKey;
|
|
5428
|
+
tokenAVault: PublicKey;
|
|
5429
|
+
tokenBVault: PublicKey;
|
|
5430
|
+
tokenAMint: PublicKey;
|
|
5431
|
+
tokenBMint: PublicKey;
|
|
5432
|
+
tokenAProgram: PublicKey;
|
|
5433
|
+
tokenBProgram: PublicKey;
|
|
5434
|
+
};
|
|
5354
5435
|
type ClaimPositionFeeParams = {
|
|
5355
5436
|
owner: PublicKey;
|
|
5356
5437
|
position: PublicKey;
|
|
@@ -5363,6 +5444,14 @@ type ClaimPositionFeeParams = {
|
|
|
5363
5444
|
tokenAProgram: PublicKey;
|
|
5364
5445
|
tokenBProgram: PublicKey;
|
|
5365
5446
|
};
|
|
5447
|
+
type ClosePositionInstructionParams = {
|
|
5448
|
+
owner: PublicKey;
|
|
5449
|
+
poolAuthority: PublicKey;
|
|
5450
|
+
pool: PublicKey;
|
|
5451
|
+
position: PublicKey;
|
|
5452
|
+
positionNftMint: PublicKey;
|
|
5453
|
+
positionNftAccount: PublicKey;
|
|
5454
|
+
};
|
|
5366
5455
|
type InitializeRewardParams = {
|
|
5367
5456
|
rewardIndex: number;
|
|
5368
5457
|
rewardDuration: BN;
|
|
@@ -5438,6 +5527,18 @@ declare class CpAmm {
|
|
|
5438
5527
|
* @returns init sqrt price and liquidity in Q64 format.
|
|
5439
5528
|
*/
|
|
5440
5529
|
private preparePoolCreationParams;
|
|
5530
|
+
/**
|
|
5531
|
+
* Prepares token accounts for a transaction by retrieving or creating associated token accounts.
|
|
5532
|
+
* @private
|
|
5533
|
+
* @param {PublicKey} owner - The owner of the token accounts
|
|
5534
|
+
* @param {PublicKey} tokenAMint - Mint address of token A
|
|
5535
|
+
* @param {PublicKey} tokenBMint - Mint address of token B
|
|
5536
|
+
* @param {PublicKey} tokenAProgram - Program ID for token A (Token or Token2022)
|
|
5537
|
+
* @param {PublicKey} tokenBProgram - Program ID for token B (Token or Token2022)
|
|
5538
|
+
* @returns {Promise<{tokenAAta: PublicKey, tokenBAta: PublicKey, instructions: TransactionInstruction[]}>}
|
|
5539
|
+
* The token account addresses and any instructions needed to create them
|
|
5540
|
+
*/
|
|
5541
|
+
private prepareTokenAccounts;
|
|
5441
5542
|
/**
|
|
5442
5543
|
* Derives token badge account metadata
|
|
5443
5544
|
* @param tokenAMint - Public key of token A mint
|
|
@@ -5445,6 +5546,34 @@ declare class CpAmm {
|
|
|
5445
5546
|
* @returns Array of account metadata for token badges
|
|
5446
5547
|
*/
|
|
5447
5548
|
private getTokenBadgeAccounts;
|
|
5549
|
+
/**
|
|
5550
|
+
* Builds an instruction to add liquidity to a position.
|
|
5551
|
+
* @private
|
|
5552
|
+
* @param {BuildAddLiquidityParams} params - Parameters for adding liquidity
|
|
5553
|
+
* @returns {Promise<TransactionInstruction>} Instruction to add liquidity
|
|
5554
|
+
*/
|
|
5555
|
+
private buildAddLiquidityInstruction;
|
|
5556
|
+
/**
|
|
5557
|
+
* Builds an instruction to remove all liquidity from a position.
|
|
5558
|
+
* @private
|
|
5559
|
+
* @param {BuildRemoveAllLiquidityInstructionParams} params - Parameters for removing all liquidity
|
|
5560
|
+
* @returns {Promise<TransactionInstruction>} Instruction to remove all liquidity
|
|
5561
|
+
*/
|
|
5562
|
+
private buildRemoveAllLiquidityInstruction;
|
|
5563
|
+
/**
|
|
5564
|
+
* Builds an instruction to claim fees accumulated by a position.
|
|
5565
|
+
* @private
|
|
5566
|
+
* @param {ClaimPositionFeeInstructionParams} params - Parameters for claiming position fees
|
|
5567
|
+
* @returns {Promise<TransactionInstruction>} Instruction to claim position fees
|
|
5568
|
+
*/
|
|
5569
|
+
private buildClaimPositionFeeInstruction;
|
|
5570
|
+
/**
|
|
5571
|
+
* Builds an instruction to close a position.
|
|
5572
|
+
* @private
|
|
5573
|
+
* @param {ClosePositionInstructionParams} params - Parameters for closing a position
|
|
5574
|
+
* @returns {Promise<TransactionInstruction>} Instruction to close the position
|
|
5575
|
+
*/
|
|
5576
|
+
private buildClosePositionInstruction;
|
|
5448
5577
|
/**
|
|
5449
5578
|
* Fetches the Config state of the program.
|
|
5450
5579
|
* @param config - Public key of the config account.
|
|
@@ -5519,6 +5648,8 @@ declare class CpAmm {
|
|
|
5519
5648
|
publicKey: PublicKey;
|
|
5520
5649
|
account: VestingState;
|
|
5521
5650
|
}>>;
|
|
5651
|
+
isLockedPosition(position: PositionState): boolean;
|
|
5652
|
+
isPoolExist(pool: PublicKey): Promise<boolean>;
|
|
5522
5653
|
/**
|
|
5523
5654
|
* Calculates swap quote based on input amount and pool state.
|
|
5524
5655
|
* @param params - Swap parameters including input amount, pool state, slippage, etc.
|
|
@@ -5610,6 +5741,31 @@ declare class CpAmm {
|
|
|
5610
5741
|
*/
|
|
5611
5742
|
claimPositionFee(params: ClaimPositionFeeParams): TxBuilder;
|
|
5612
5743
|
closePosition(params: ClosePositionParams): TxBuilder;
|
|
5744
|
+
/**
|
|
5745
|
+
* Builds a transaction to remove all liquidity from a position and close it.
|
|
5746
|
+
* This combines several operations in a single transaction:
|
|
5747
|
+
* 1. Claims any accumulated fees
|
|
5748
|
+
* 2. Removes all liquidity
|
|
5749
|
+
* 3. Closes the position
|
|
5750
|
+
*
|
|
5751
|
+
* @param {RemoveAllLiquidityAndClosePositionParams} params - Combined parameters
|
|
5752
|
+
* @returns {TxBuilder} Transaction builder with all required instructions
|
|
5753
|
+
* @throws {Error} If the position is locked or cannot be closed
|
|
5754
|
+
*/
|
|
5755
|
+
removeAllLiquidityAndClosePosition(params: RemoveAllLiquidityAndClosePositionParams): TxBuilder;
|
|
5756
|
+
/**
|
|
5757
|
+
* Builds a transaction to merge liquidity from one position into another.
|
|
5758
|
+
* This process:
|
|
5759
|
+
* 1. Claims fees from the source position
|
|
5760
|
+
* 2. Removes all liquidity from the source position
|
|
5761
|
+
* 3. Adds that liquidity to the target position
|
|
5762
|
+
* 4. Closes the source position
|
|
5763
|
+
*
|
|
5764
|
+
* @param {MergePositionParams} params - Parameters for merging positions
|
|
5765
|
+
* @returns {TxBuilder} Transaction builder with all required instructions
|
|
5766
|
+
* @throws {Error} If either position is locked or incompatible
|
|
5767
|
+
*/
|
|
5768
|
+
mergePosition(params: MergePositionParams): TxBuilder;
|
|
5613
5769
|
/**
|
|
5614
5770
|
* Builds a transaction to update reward duration.
|
|
5615
5771
|
* @param {UpdateRewardDurationParams} params - Parameters including pool and new duration.
|
|
@@ -12163,4 +12319,4 @@ var CpAmmIDL = {
|
|
|
12163
12319
|
types: types
|
|
12164
12320
|
};
|
|
12165
12321
|
|
|
12166
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeParams, type ClaimRewardParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionParams, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetQuoteParams, type InitializeCustomizeablePoolParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, ONE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllNftByUser, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getCurrentPrice, getDeltaAmountA, getDeltaAmountB, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, mulShr, positionByPoolFilter, pow, q64ToDecimal, shlDiv, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
|
12322
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, type BuildAddLiquidityParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionParams, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetQuoteParams, type InitializeCustomizeablePoolParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllNftByUser, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getCurrentPrice, getDeltaAmountA, getDeltaAmountB, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, mulShr, positionByPoolFilter, pow, q64ToDecimal, shlDiv, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|