@meteora-ag/cp-amm-sdk 1.0.1-rc.33 → 1.0.1-rc.34
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 +69 -4
- package/dist/index.d.ts +69 -4
- package/dist/index.js +189 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +192 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5232,8 +5232,6 @@ type PreparePoolCreationParams = {
|
|
|
5232
5232
|
tokenBAmount: BN;
|
|
5233
5233
|
minSqrtPrice: BN;
|
|
5234
5234
|
maxSqrtPrice: BN;
|
|
5235
|
-
tokenADecimal: number;
|
|
5236
|
-
tokenBDecimal: number;
|
|
5237
5235
|
tokenAInfo?: {
|
|
5238
5236
|
mint: Mint;
|
|
5239
5237
|
currentEpoch: number;
|
|
@@ -5324,6 +5322,11 @@ type RemoveLiquidityParams = {
|
|
|
5324
5322
|
tokenBVault: PublicKey;
|
|
5325
5323
|
tokenAProgram: PublicKey;
|
|
5326
5324
|
tokenBProgram: PublicKey;
|
|
5325
|
+
vestings: Array<{
|
|
5326
|
+
account: PublicKey;
|
|
5327
|
+
vestingState: VestingState;
|
|
5328
|
+
}>;
|
|
5329
|
+
currentPoint: BN;
|
|
5327
5330
|
};
|
|
5328
5331
|
type RemoveAllLiquidityParams = Omit<RemoveLiquidityParams, "liquidityDelta">;
|
|
5329
5332
|
type BuildAddLiquidityParams = {
|
|
@@ -5375,6 +5378,11 @@ type RemoveAllLiquidityAndClosePositionParams = {
|
|
|
5375
5378
|
positionState: PositionState;
|
|
5376
5379
|
tokenAAmountThreshold: BN;
|
|
5377
5380
|
tokenBAmountThreshold: BN;
|
|
5381
|
+
vestings: Array<{
|
|
5382
|
+
account: PublicKey;
|
|
5383
|
+
vestingState: VestingState;
|
|
5384
|
+
}>;
|
|
5385
|
+
currentPoint: BN;
|
|
5378
5386
|
};
|
|
5379
5387
|
type MergePositionParams = {
|
|
5380
5388
|
owner: PublicKey;
|
|
@@ -5388,6 +5396,11 @@ type MergePositionParams = {
|
|
|
5388
5396
|
tokenBAmountAddLiquidityThreshold: BN;
|
|
5389
5397
|
tokenAAmountRemoveLiquidityThreshold: BN;
|
|
5390
5398
|
tokenBAmountRemoveLiquidityThreshold: BN;
|
|
5399
|
+
positionBVestings: Array<{
|
|
5400
|
+
account: PublicKey;
|
|
5401
|
+
vestingState: VestingState;
|
|
5402
|
+
}>;
|
|
5403
|
+
currentPoint: BN;
|
|
5391
5404
|
};
|
|
5392
5405
|
type GetQuoteParams = {
|
|
5393
5406
|
inAmount: BN;
|
|
@@ -5523,7 +5536,7 @@ type RefreshVestingParams = {
|
|
|
5523
5536
|
position: PublicKey;
|
|
5524
5537
|
positionNftAccount: PublicKey;
|
|
5525
5538
|
pool: PublicKey;
|
|
5526
|
-
|
|
5539
|
+
vestingAccounts: PublicKey[];
|
|
5527
5540
|
};
|
|
5528
5541
|
type PermanentLockParams = {
|
|
5529
5542
|
owner: PublicKey;
|
|
@@ -5632,6 +5645,12 @@ declare class CpAmm {
|
|
|
5632
5645
|
* @returns {Promise<TransactionInstruction>} Instruction to close the position
|
|
5633
5646
|
*/
|
|
5634
5647
|
private buildClosePositionInstruction;
|
|
5648
|
+
/**
|
|
5649
|
+
* Builds an instruction to refresh vesting for a position
|
|
5650
|
+
* @param params Parameters required for the refresh vesting instruction
|
|
5651
|
+
* @returns Transaction instruction or null if no vestings to refresh
|
|
5652
|
+
*/
|
|
5653
|
+
private buildRefreshVestingInstruction;
|
|
5635
5654
|
/**
|
|
5636
5655
|
* Fetches the Config state of the program.
|
|
5637
5656
|
* @param config - Public key of the config account.
|
|
@@ -5709,6 +5728,30 @@ declare class CpAmm {
|
|
|
5709
5728
|
account: VestingState;
|
|
5710
5729
|
}>>;
|
|
5711
5730
|
isLockedPosition(position: PositionState): boolean;
|
|
5731
|
+
isPermanentLockedPosition(positionState: PositionState): boolean;
|
|
5732
|
+
/**
|
|
5733
|
+
* Checks if a position can be unlocked based on its locking state and vesting schedules.
|
|
5734
|
+
*
|
|
5735
|
+
* This method evaluates whether a position is eligible for operations that require
|
|
5736
|
+
* unlocked liquidity, such as removing all liquidity or closing the position. It checks both
|
|
5737
|
+
* permanent locks and time-based vesting schedules.
|
|
5738
|
+
*
|
|
5739
|
+
* @private
|
|
5740
|
+
* @param {PositionState} positionState - The current state of the position
|
|
5741
|
+
* @param {Array<{account: PublicKey; vestingState: VestingState}>} vestings - Array of vesting accounts and their states
|
|
5742
|
+
* @param {BN} currentPoint - Current timestamp or slot number (depending on activation type of pool)
|
|
5743
|
+
*
|
|
5744
|
+
* @returns {Object} Result object containing unlock status and reason
|
|
5745
|
+
* @returns {boolean} result.canUnlock - Whether the position can be unlocked
|
|
5746
|
+
* @returns {string|undefined} result.reason - Reason why position cannot be unlocked (if applicable)
|
|
5747
|
+
*/
|
|
5748
|
+
canUnlockPosition(positionState: PositionState, vestings: Array<{
|
|
5749
|
+
account: PublicKey;
|
|
5750
|
+
vestingState: VestingState;
|
|
5751
|
+
}>, currentPoint: BN): {
|
|
5752
|
+
canUnlock: boolean;
|
|
5753
|
+
reason?: string;
|
|
5754
|
+
};
|
|
5712
5755
|
isPoolExist(pool: PublicKey): Promise<boolean>;
|
|
5713
5756
|
/**
|
|
5714
5757
|
* Calculates swap quote based on input amount and pool state.
|
|
@@ -6063,6 +6106,28 @@ interface TransferFeeExcludedAmount {
|
|
|
6063
6106
|
}
|
|
6064
6107
|
declare function calculateTransferFeeExcludedAmount(transferFeeIncludedAmount: BN, mint: Mint, currentEpoch: number): TransferFeeExcludedAmount;
|
|
6065
6108
|
|
|
6109
|
+
/**
|
|
6110
|
+
* Checks if a vesting schedule is ready for full release
|
|
6111
|
+
* @param vestingData The vesting account data
|
|
6112
|
+
* @param currentPoint Current timestamp or slot
|
|
6113
|
+
* @returns True if the vesting is complete and all liquidity can be released
|
|
6114
|
+
*/
|
|
6115
|
+
declare function isVestingComplete(vestingData: VestingState, currentPoint: BN): boolean;
|
|
6116
|
+
/**
|
|
6117
|
+
* Gets the total amount of liquidity in the vesting schedule
|
|
6118
|
+
* @param vestingData The vesting account data
|
|
6119
|
+
* @returns The total locked liquidity amount
|
|
6120
|
+
*/
|
|
6121
|
+
declare function getTotalLockedLiquidity(vestingData: VestingState): BN;
|
|
6122
|
+
/**
|
|
6123
|
+
* Calculates the available liquidity to withdraw based on vesting schedule
|
|
6124
|
+
* @param vestingData The vesting account data
|
|
6125
|
+
* @param positionData The position account data
|
|
6126
|
+
* @param currentPoint Current timestamp or slot
|
|
6127
|
+
* @returns The amount of liquidity available to withdraw
|
|
6128
|
+
*/
|
|
6129
|
+
declare function getAvailableVestingLiquidity(vestingData: VestingState, currentPoint: BN): BN;
|
|
6130
|
+
|
|
6066
6131
|
declare const ONE: BN;
|
|
6067
6132
|
declare function pow(base: BN, exp: BN): BN;
|
|
6068
6133
|
|
|
@@ -12410,4 +12475,4 @@ var CpAmmIDL = {
|
|
|
12410
12475
|
types: types
|
|
12411
12476
|
};
|
|
12412
12477
|
|
|
12413
|
-
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 DepositQuote, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, 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 PreparePoolCreationSingleSide, 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, type WithdrawQuote, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
|
12478
|
+
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 DepositQuote, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, 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 PreparePoolCreationSingleSide, 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, type WithdrawQuote, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
package/dist/index.d.ts
CHANGED
|
@@ -5232,8 +5232,6 @@ type PreparePoolCreationParams = {
|
|
|
5232
5232
|
tokenBAmount: BN;
|
|
5233
5233
|
minSqrtPrice: BN;
|
|
5234
5234
|
maxSqrtPrice: BN;
|
|
5235
|
-
tokenADecimal: number;
|
|
5236
|
-
tokenBDecimal: number;
|
|
5237
5235
|
tokenAInfo?: {
|
|
5238
5236
|
mint: Mint;
|
|
5239
5237
|
currentEpoch: number;
|
|
@@ -5324,6 +5322,11 @@ type RemoveLiquidityParams = {
|
|
|
5324
5322
|
tokenBVault: PublicKey;
|
|
5325
5323
|
tokenAProgram: PublicKey;
|
|
5326
5324
|
tokenBProgram: PublicKey;
|
|
5325
|
+
vestings: Array<{
|
|
5326
|
+
account: PublicKey;
|
|
5327
|
+
vestingState: VestingState;
|
|
5328
|
+
}>;
|
|
5329
|
+
currentPoint: BN;
|
|
5327
5330
|
};
|
|
5328
5331
|
type RemoveAllLiquidityParams = Omit<RemoveLiquidityParams, "liquidityDelta">;
|
|
5329
5332
|
type BuildAddLiquidityParams = {
|
|
@@ -5375,6 +5378,11 @@ type RemoveAllLiquidityAndClosePositionParams = {
|
|
|
5375
5378
|
positionState: PositionState;
|
|
5376
5379
|
tokenAAmountThreshold: BN;
|
|
5377
5380
|
tokenBAmountThreshold: BN;
|
|
5381
|
+
vestings: Array<{
|
|
5382
|
+
account: PublicKey;
|
|
5383
|
+
vestingState: VestingState;
|
|
5384
|
+
}>;
|
|
5385
|
+
currentPoint: BN;
|
|
5378
5386
|
};
|
|
5379
5387
|
type MergePositionParams = {
|
|
5380
5388
|
owner: PublicKey;
|
|
@@ -5388,6 +5396,11 @@ type MergePositionParams = {
|
|
|
5388
5396
|
tokenBAmountAddLiquidityThreshold: BN;
|
|
5389
5397
|
tokenAAmountRemoveLiquidityThreshold: BN;
|
|
5390
5398
|
tokenBAmountRemoveLiquidityThreshold: BN;
|
|
5399
|
+
positionBVestings: Array<{
|
|
5400
|
+
account: PublicKey;
|
|
5401
|
+
vestingState: VestingState;
|
|
5402
|
+
}>;
|
|
5403
|
+
currentPoint: BN;
|
|
5391
5404
|
};
|
|
5392
5405
|
type GetQuoteParams = {
|
|
5393
5406
|
inAmount: BN;
|
|
@@ -5523,7 +5536,7 @@ type RefreshVestingParams = {
|
|
|
5523
5536
|
position: PublicKey;
|
|
5524
5537
|
positionNftAccount: PublicKey;
|
|
5525
5538
|
pool: PublicKey;
|
|
5526
|
-
|
|
5539
|
+
vestingAccounts: PublicKey[];
|
|
5527
5540
|
};
|
|
5528
5541
|
type PermanentLockParams = {
|
|
5529
5542
|
owner: PublicKey;
|
|
@@ -5632,6 +5645,12 @@ declare class CpAmm {
|
|
|
5632
5645
|
* @returns {Promise<TransactionInstruction>} Instruction to close the position
|
|
5633
5646
|
*/
|
|
5634
5647
|
private buildClosePositionInstruction;
|
|
5648
|
+
/**
|
|
5649
|
+
* Builds an instruction to refresh vesting for a position
|
|
5650
|
+
* @param params Parameters required for the refresh vesting instruction
|
|
5651
|
+
* @returns Transaction instruction or null if no vestings to refresh
|
|
5652
|
+
*/
|
|
5653
|
+
private buildRefreshVestingInstruction;
|
|
5635
5654
|
/**
|
|
5636
5655
|
* Fetches the Config state of the program.
|
|
5637
5656
|
* @param config - Public key of the config account.
|
|
@@ -5709,6 +5728,30 @@ declare class CpAmm {
|
|
|
5709
5728
|
account: VestingState;
|
|
5710
5729
|
}>>;
|
|
5711
5730
|
isLockedPosition(position: PositionState): boolean;
|
|
5731
|
+
isPermanentLockedPosition(positionState: PositionState): boolean;
|
|
5732
|
+
/**
|
|
5733
|
+
* Checks if a position can be unlocked based on its locking state and vesting schedules.
|
|
5734
|
+
*
|
|
5735
|
+
* This method evaluates whether a position is eligible for operations that require
|
|
5736
|
+
* unlocked liquidity, such as removing all liquidity or closing the position. It checks both
|
|
5737
|
+
* permanent locks and time-based vesting schedules.
|
|
5738
|
+
*
|
|
5739
|
+
* @private
|
|
5740
|
+
* @param {PositionState} positionState - The current state of the position
|
|
5741
|
+
* @param {Array<{account: PublicKey; vestingState: VestingState}>} vestings - Array of vesting accounts and their states
|
|
5742
|
+
* @param {BN} currentPoint - Current timestamp or slot number (depending on activation type of pool)
|
|
5743
|
+
*
|
|
5744
|
+
* @returns {Object} Result object containing unlock status and reason
|
|
5745
|
+
* @returns {boolean} result.canUnlock - Whether the position can be unlocked
|
|
5746
|
+
* @returns {string|undefined} result.reason - Reason why position cannot be unlocked (if applicable)
|
|
5747
|
+
*/
|
|
5748
|
+
canUnlockPosition(positionState: PositionState, vestings: Array<{
|
|
5749
|
+
account: PublicKey;
|
|
5750
|
+
vestingState: VestingState;
|
|
5751
|
+
}>, currentPoint: BN): {
|
|
5752
|
+
canUnlock: boolean;
|
|
5753
|
+
reason?: string;
|
|
5754
|
+
};
|
|
5712
5755
|
isPoolExist(pool: PublicKey): Promise<boolean>;
|
|
5713
5756
|
/**
|
|
5714
5757
|
* Calculates swap quote based on input amount and pool state.
|
|
@@ -6063,6 +6106,28 @@ interface TransferFeeExcludedAmount {
|
|
|
6063
6106
|
}
|
|
6064
6107
|
declare function calculateTransferFeeExcludedAmount(transferFeeIncludedAmount: BN, mint: Mint, currentEpoch: number): TransferFeeExcludedAmount;
|
|
6065
6108
|
|
|
6109
|
+
/**
|
|
6110
|
+
* Checks if a vesting schedule is ready for full release
|
|
6111
|
+
* @param vestingData The vesting account data
|
|
6112
|
+
* @param currentPoint Current timestamp or slot
|
|
6113
|
+
* @returns True if the vesting is complete and all liquidity can be released
|
|
6114
|
+
*/
|
|
6115
|
+
declare function isVestingComplete(vestingData: VestingState, currentPoint: BN): boolean;
|
|
6116
|
+
/**
|
|
6117
|
+
* Gets the total amount of liquidity in the vesting schedule
|
|
6118
|
+
* @param vestingData The vesting account data
|
|
6119
|
+
* @returns The total locked liquidity amount
|
|
6120
|
+
*/
|
|
6121
|
+
declare function getTotalLockedLiquidity(vestingData: VestingState): BN;
|
|
6122
|
+
/**
|
|
6123
|
+
* Calculates the available liquidity to withdraw based on vesting schedule
|
|
6124
|
+
* @param vestingData The vesting account data
|
|
6125
|
+
* @param positionData The position account data
|
|
6126
|
+
* @param currentPoint Current timestamp or slot
|
|
6127
|
+
* @returns The amount of liquidity available to withdraw
|
|
6128
|
+
*/
|
|
6129
|
+
declare function getAvailableVestingLiquidity(vestingData: VestingState, currentPoint: BN): BN;
|
|
6130
|
+
|
|
6066
6131
|
declare const ONE: BN;
|
|
6067
6132
|
declare function pow(base: BN, exp: BN): BN;
|
|
6068
6133
|
|
|
@@ -12410,4 +12475,4 @@ var CpAmmIDL = {
|
|
|
12410
12475
|
types: types
|
|
12411
12476
|
};
|
|
12412
12477
|
|
|
12413
|
-
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 DepositQuote, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, 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 PreparePoolCreationSingleSide, 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, type WithdrawQuote, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
|
12478
|
+
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 DepositQuote, type DynamicFee, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteParams, type GetWithdrawQuoteParams, 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 PreparePoolCreationSingleSide, 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, type WithdrawQuote, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadge, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
package/dist/index.js
CHANGED
|
@@ -7140,8 +7140,49 @@ function calculateTransferFeeExcludedAmount(transferFeeIncludedAmount, mint, cur
|
|
|
7140
7140
|
};
|
|
7141
7141
|
}
|
|
7142
7142
|
|
|
7143
|
-
// src/
|
|
7143
|
+
// src/helpers/vestings.ts
|
|
7144
|
+
|
|
7144
7145
|
var _bnjs = require('bn.js');
|
|
7146
|
+
function isVestingComplete(vestingData, currentPoint) {
|
|
7147
|
+
const cliffPoint = vestingData.cliffPoint;
|
|
7148
|
+
const periodFrequency = vestingData.periodFrequency;
|
|
7149
|
+
const numberOfPeriods = vestingData.numberOfPeriod;
|
|
7150
|
+
const endPoint = cliffPoint.add(periodFrequency.muln(numberOfPeriods));
|
|
7151
|
+
return currentPoint.gte(endPoint);
|
|
7152
|
+
}
|
|
7153
|
+
function getTotalLockedLiquidity(vestingData) {
|
|
7154
|
+
return vestingData.cliffUnlockLiquidity.add(
|
|
7155
|
+
vestingData.liquidityPerPeriod.mul(new (0, _anchor.BN)(vestingData.numberOfPeriod))
|
|
7156
|
+
);
|
|
7157
|
+
}
|
|
7158
|
+
function getAvailableVestingLiquidity(vestingData, currentPoint) {
|
|
7159
|
+
const {
|
|
7160
|
+
cliffPoint,
|
|
7161
|
+
periodFrequency,
|
|
7162
|
+
cliffUnlockLiquidity,
|
|
7163
|
+
liquidityPerPeriod,
|
|
7164
|
+
numberOfPeriod,
|
|
7165
|
+
totalReleasedLiquidity
|
|
7166
|
+
} = vestingData;
|
|
7167
|
+
if (currentPoint < cliffPoint) {
|
|
7168
|
+
return new (0, _anchor.BN)(0);
|
|
7169
|
+
}
|
|
7170
|
+
if (periodFrequency.isZero()) {
|
|
7171
|
+
return cliffUnlockLiquidity.sub(totalReleasedLiquidity);
|
|
7172
|
+
}
|
|
7173
|
+
let passedPeriod = new (0, _anchor.BN)(currentPoint).sub(cliffPoint).div(periodFrequency);
|
|
7174
|
+
passedPeriod = _bnjs.min.call(void 0, passedPeriod, new (0, _anchor.BN)(numberOfPeriod));
|
|
7175
|
+
const unlockedLiquidity = cliffUnlockLiquidity.add(
|
|
7176
|
+
passedPeriod.mul(liquidityPerPeriod)
|
|
7177
|
+
);
|
|
7178
|
+
const availableReleasingLiquidity = unlockedLiquidity.sub(
|
|
7179
|
+
totalReleasedLiquidity
|
|
7180
|
+
);
|
|
7181
|
+
return availableReleasingLiquidity;
|
|
7182
|
+
}
|
|
7183
|
+
|
|
7184
|
+
// src/CpAmm.ts
|
|
7185
|
+
|
|
7145
7186
|
var CpAmm = class {
|
|
7146
7187
|
constructor(connection) {
|
|
7147
7188
|
this._program = new (0, _anchor.Program)(cp_amm_default, {
|
|
@@ -7371,6 +7412,33 @@ var CpAmm = class {
|
|
|
7371
7412
|
}).instruction();
|
|
7372
7413
|
});
|
|
7373
7414
|
}
|
|
7415
|
+
/**
|
|
7416
|
+
* Builds an instruction to refresh vesting for a position
|
|
7417
|
+
* @param params Parameters required for the refresh vesting instruction
|
|
7418
|
+
* @returns Transaction instruction or null if no vestings to refresh
|
|
7419
|
+
*/
|
|
7420
|
+
buildRefreshVestingInstruction(params) {
|
|
7421
|
+
return __async(this, null, function* () {
|
|
7422
|
+
const { owner, position, positionNftAccount, pool, vestingAccounts } = params;
|
|
7423
|
+
if (vestingAccounts.length == 0) {
|
|
7424
|
+
return null;
|
|
7425
|
+
}
|
|
7426
|
+
return yield this._program.methods.refreshVesting().accountsPartial({
|
|
7427
|
+
position,
|
|
7428
|
+
positionNftAccount,
|
|
7429
|
+
pool,
|
|
7430
|
+
owner
|
|
7431
|
+
}).remainingAccounts(
|
|
7432
|
+
vestingAccounts.map((pubkey) => {
|
|
7433
|
+
return {
|
|
7434
|
+
isSigner: false,
|
|
7435
|
+
isWritable: true,
|
|
7436
|
+
pubkey
|
|
7437
|
+
};
|
|
7438
|
+
})
|
|
7439
|
+
).instruction();
|
|
7440
|
+
});
|
|
7441
|
+
}
|
|
7374
7442
|
/**
|
|
7375
7443
|
* Fetches the Config state of the program.
|
|
7376
7444
|
* @param config - Public key of the config account.
|
|
@@ -7518,6 +7586,44 @@ var CpAmm = class {
|
|
|
7518
7586
|
);
|
|
7519
7587
|
return totalLockedLiquidity.gtn(0);
|
|
7520
7588
|
}
|
|
7589
|
+
isPermanentLockedPosition(positionState) {
|
|
7590
|
+
return positionState.permanentLockedLiquidity.gtn(0);
|
|
7591
|
+
}
|
|
7592
|
+
/**
|
|
7593
|
+
* Checks if a position can be unlocked based on its locking state and vesting schedules.
|
|
7594
|
+
*
|
|
7595
|
+
* This method evaluates whether a position is eligible for operations that require
|
|
7596
|
+
* unlocked liquidity, such as removing all liquidity or closing the position. It checks both
|
|
7597
|
+
* permanent locks and time-based vesting schedules.
|
|
7598
|
+
*
|
|
7599
|
+
* @private
|
|
7600
|
+
* @param {PositionState} positionState - The current state of the position
|
|
7601
|
+
* @param {Array<{account: PublicKey; vestingState: VestingState}>} vestings - Array of vesting accounts and their states
|
|
7602
|
+
* @param {BN} currentPoint - Current timestamp or slot number (depending on activation type of pool)
|
|
7603
|
+
*
|
|
7604
|
+
* @returns {Object} Result object containing unlock status and reason
|
|
7605
|
+
* @returns {boolean} result.canUnlock - Whether the position can be unlocked
|
|
7606
|
+
* @returns {string|undefined} result.reason - Reason why position cannot be unlocked (if applicable)
|
|
7607
|
+
*/
|
|
7608
|
+
canUnlockPosition(positionState, vestings, currentPoint) {
|
|
7609
|
+
if (vestings.length > 0) {
|
|
7610
|
+
if (this.isPermanentLockedPosition(positionState)) {
|
|
7611
|
+
return {
|
|
7612
|
+
canUnlock: false,
|
|
7613
|
+
reason: "Position is permanently locked"
|
|
7614
|
+
};
|
|
7615
|
+
}
|
|
7616
|
+
for (const vesting of vestings) {
|
|
7617
|
+
if (!isVestingComplete(vesting.vestingState, currentPoint)) {
|
|
7618
|
+
return {
|
|
7619
|
+
canUnlock: false,
|
|
7620
|
+
reason: "Position has incomplete vesting schedule"
|
|
7621
|
+
};
|
|
7622
|
+
}
|
|
7623
|
+
}
|
|
7624
|
+
}
|
|
7625
|
+
return { canUnlock: true };
|
|
7626
|
+
}
|
|
7521
7627
|
isPoolExist(pool) {
|
|
7522
7628
|
return __async(this, null, function* () {
|
|
7523
7629
|
const poolState = yield this._program.account.pool.fetchNullable(pool);
|
|
@@ -7590,22 +7696,25 @@ var CpAmm = class {
|
|
|
7590
7696
|
aToB,
|
|
7591
7697
|
collectFeeMode
|
|
7592
7698
|
);
|
|
7593
|
-
let
|
|
7699
|
+
let actualAmountOut = amountOut;
|
|
7594
7700
|
if (outputTokenInfo) {
|
|
7595
|
-
|
|
7701
|
+
actualAmountOut = calculateTransferFeeExcludedAmount(
|
|
7596
7702
|
amountOut,
|
|
7597
7703
|
outputTokenInfo.mint,
|
|
7598
7704
|
outputTokenInfo.currentEpoch
|
|
7599
7705
|
).amount;
|
|
7600
7706
|
}
|
|
7601
|
-
const minSwapOutAmount = getMinAmountWithSlippage(
|
|
7707
|
+
const minSwapOutAmount = getMinAmountWithSlippage(
|
|
7708
|
+
actualAmountOut,
|
|
7709
|
+
slippage
|
|
7710
|
+
);
|
|
7602
7711
|
return {
|
|
7603
7712
|
swapInAmount: inAmount,
|
|
7604
7713
|
consumedInAmount: actualAmountIn,
|
|
7605
|
-
swapOutAmount:
|
|
7714
|
+
swapOutAmount: actualAmountOut,
|
|
7606
7715
|
minSwapOutAmount,
|
|
7607
7716
|
totalFee,
|
|
7608
|
-
priceImpact: getPriceImpact(minSwapOutAmount,
|
|
7717
|
+
priceImpact: getPriceImpact(minSwapOutAmount, actualAmountOut)
|
|
7609
7718
|
};
|
|
7610
7719
|
});
|
|
7611
7720
|
}
|
|
@@ -7782,13 +7891,13 @@ var CpAmm = class {
|
|
|
7782
7891
|
tokenAInfo.currentEpoch
|
|
7783
7892
|
).transferFee
|
|
7784
7893
|
) : tokenAAmount;
|
|
7785
|
-
const actualAmountBIn = tokenBInfo ?
|
|
7894
|
+
const actualAmountBIn = tokenBInfo ? tokenBAmount.sub(
|
|
7786
7895
|
calculateTransferFeeIncludedAmount(
|
|
7787
7896
|
tokenBAmount,
|
|
7788
7897
|
tokenBInfo.mint,
|
|
7789
7898
|
tokenBInfo.currentEpoch
|
|
7790
7899
|
).transferFee
|
|
7791
|
-
) :
|
|
7900
|
+
) : tokenBAmount;
|
|
7792
7901
|
const initSqrtPrice = calculateInitSqrtPrice(
|
|
7793
7902
|
tokenAAmount,
|
|
7794
7903
|
tokenBAmount,
|
|
@@ -8121,7 +8230,8 @@ var CpAmm = class {
|
|
|
8121
8230
|
tokenAVault,
|
|
8122
8231
|
tokenBVault,
|
|
8123
8232
|
tokenAProgram,
|
|
8124
|
-
tokenBProgram
|
|
8233
|
+
tokenBProgram,
|
|
8234
|
+
vestings
|
|
8125
8235
|
} = params;
|
|
8126
8236
|
const {
|
|
8127
8237
|
tokenAAta: tokenAAccount,
|
|
@@ -8141,6 +8251,16 @@ var CpAmm = class {
|
|
|
8141
8251
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
|
|
8142
8252
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
8143
8253
|
}
|
|
8254
|
+
if (vestings.length > 0) {
|
|
8255
|
+
const refreshVestingInstruction = yield this.buildRefreshVestingInstruction({
|
|
8256
|
+
owner,
|
|
8257
|
+
position,
|
|
8258
|
+
positionNftAccount,
|
|
8259
|
+
pool,
|
|
8260
|
+
vestingAccounts: vestings.map((item) => item.account)
|
|
8261
|
+
});
|
|
8262
|
+
refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
|
|
8263
|
+
}
|
|
8144
8264
|
return yield this._program.methods.removeLiquidity({
|
|
8145
8265
|
liquidityDelta,
|
|
8146
8266
|
tokenAAmountThreshold,
|
|
@@ -8181,7 +8301,8 @@ var CpAmm = class {
|
|
|
8181
8301
|
tokenAVault,
|
|
8182
8302
|
tokenBVault,
|
|
8183
8303
|
tokenAProgram,
|
|
8184
|
-
tokenBProgram
|
|
8304
|
+
tokenBProgram,
|
|
8305
|
+
vestings
|
|
8185
8306
|
} = params;
|
|
8186
8307
|
const {
|
|
8187
8308
|
tokenAAta: tokenAAccount,
|
|
@@ -8201,6 +8322,16 @@ var CpAmm = class {
|
|
|
8201
8322
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
|
|
8202
8323
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
8203
8324
|
}
|
|
8325
|
+
if (vestings.length > 0) {
|
|
8326
|
+
const refreshVestingInstruction = yield this.buildRefreshVestingInstruction({
|
|
8327
|
+
owner,
|
|
8328
|
+
position,
|
|
8329
|
+
positionNftAccount,
|
|
8330
|
+
pool,
|
|
8331
|
+
vestingAccounts: vestings.map((item) => item.account)
|
|
8332
|
+
});
|
|
8333
|
+
refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
|
|
8334
|
+
}
|
|
8204
8335
|
const removeAllLiquidityInstruction = yield this.buildRemoveAllLiquidityInstruction({
|
|
8205
8336
|
poolAuthority: this.poolAuthority,
|
|
8206
8337
|
owner,
|
|
@@ -8358,21 +8489,8 @@ var CpAmm = class {
|
|
|
8358
8489
|
*/
|
|
8359
8490
|
refreshVesting(params) {
|
|
8360
8491
|
return __async(this, null, function* () {
|
|
8361
|
-
const
|
|
8362
|
-
return
|
|
8363
|
-
position,
|
|
8364
|
-
positionNftAccount,
|
|
8365
|
-
pool,
|
|
8366
|
-
owner
|
|
8367
|
-
}).remainingAccounts(
|
|
8368
|
-
vestings.map((pubkey) => {
|
|
8369
|
-
return {
|
|
8370
|
-
isSigner: false,
|
|
8371
|
-
isWritable: true,
|
|
8372
|
-
pubkey
|
|
8373
|
-
};
|
|
8374
|
-
})
|
|
8375
|
-
).transaction();
|
|
8492
|
+
const instruction = yield this.buildRefreshVestingInstruction(params);
|
|
8493
|
+
return new (0, _web3js.Transaction)().add(instruction);
|
|
8376
8494
|
});
|
|
8377
8495
|
}
|
|
8378
8496
|
/**
|
|
@@ -8470,13 +8588,19 @@ var CpAmm = class {
|
|
|
8470
8588
|
positionState,
|
|
8471
8589
|
poolState,
|
|
8472
8590
|
tokenAAmountThreshold,
|
|
8473
|
-
tokenBAmountThreshold
|
|
8591
|
+
tokenBAmountThreshold,
|
|
8592
|
+
vestings,
|
|
8593
|
+
currentPoint
|
|
8474
8594
|
} = params;
|
|
8475
8595
|
const { nftMint: positionNftMint, pool } = positionState;
|
|
8476
8596
|
const { tokenAMint, tokenBMint, tokenAVault, tokenBVault } = poolState;
|
|
8477
|
-
const
|
|
8478
|
-
|
|
8479
|
-
|
|
8597
|
+
const { canUnlock, reason } = this.canUnlockPosition(
|
|
8598
|
+
positionState,
|
|
8599
|
+
vestings,
|
|
8600
|
+
currentPoint
|
|
8601
|
+
);
|
|
8602
|
+
if (!canUnlock) {
|
|
8603
|
+
throw new Error(`Cannot remove liquidity: ${reason}`);
|
|
8480
8604
|
}
|
|
8481
8605
|
const tokenAProgram = getTokenProgram(poolState.tokenAFlag);
|
|
8482
8606
|
const tokenBProgram = getTokenProgram(poolState.tokenBFlag);
|
|
@@ -8498,6 +8622,16 @@ var CpAmm = class {
|
|
|
8498
8622
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
|
|
8499
8623
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
8500
8624
|
}
|
|
8625
|
+
if (vestings.length > 0) {
|
|
8626
|
+
const refreshVestingInstruction = yield this.buildRefreshVestingInstruction({
|
|
8627
|
+
owner,
|
|
8628
|
+
position,
|
|
8629
|
+
positionNftAccount,
|
|
8630
|
+
pool,
|
|
8631
|
+
vestingAccounts: vestings.map((item) => item.account)
|
|
8632
|
+
});
|
|
8633
|
+
refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
|
|
8634
|
+
}
|
|
8501
8635
|
const transaction = new (0, _web3js.Transaction)();
|
|
8502
8636
|
if (preInstructions.length > 0) {
|
|
8503
8637
|
transaction.add(...preInstructions);
|
|
@@ -8576,13 +8710,19 @@ var CpAmm = class {
|
|
|
8576
8710
|
tokenAAmountAddLiquidityThreshold,
|
|
8577
8711
|
tokenBAmountAddLiquidityThreshold,
|
|
8578
8712
|
tokenAAmountRemoveLiquidityThreshold,
|
|
8579
|
-
tokenBAmountRemoveLiquidityThreshold
|
|
8713
|
+
tokenBAmountRemoveLiquidityThreshold,
|
|
8714
|
+
positionBVestings,
|
|
8715
|
+
currentPoint
|
|
8580
8716
|
} = params;
|
|
8581
|
-
const
|
|
8582
|
-
|
|
8583
|
-
|
|
8717
|
+
const { canUnlock, reason } = this.canUnlockPosition(
|
|
8718
|
+
positionBState,
|
|
8719
|
+
positionBVestings,
|
|
8720
|
+
currentPoint
|
|
8721
|
+
);
|
|
8722
|
+
if (!canUnlock) {
|
|
8723
|
+
throw new Error(`Cannot remove liquidity: ${reason}`);
|
|
8584
8724
|
}
|
|
8585
|
-
const
|
|
8725
|
+
const positionBLiquidityDelta = positionBState.unlockedLiquidity;
|
|
8586
8726
|
const pool = positionBState.pool;
|
|
8587
8727
|
const { tokenAMint, tokenBMint, tokenAVault, tokenBVault } = poolState;
|
|
8588
8728
|
const tokenAProgram = getTokenProgram(poolState.tokenAFlag);
|
|
@@ -8605,6 +8745,16 @@ var CpAmm = class {
|
|
|
8605
8745
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(owner);
|
|
8606
8746
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
8607
8747
|
}
|
|
8748
|
+
if (positionBVestings.length > 0) {
|
|
8749
|
+
const refreshVestingInstruction = yield this.buildRefreshVestingInstruction({
|
|
8750
|
+
owner,
|
|
8751
|
+
position: positionB,
|
|
8752
|
+
positionNftAccount: positionBNftAccount,
|
|
8753
|
+
pool,
|
|
8754
|
+
vestingAccounts: positionBVestings.map((item) => item.account)
|
|
8755
|
+
});
|
|
8756
|
+
refreshVestingInstruction && preInstructions.push(refreshVestingInstruction);
|
|
8757
|
+
}
|
|
8608
8758
|
const transaction = new (0, _web3js.Transaction)();
|
|
8609
8759
|
if (preInstructions.length > 0) {
|
|
8610
8760
|
transaction.add(...preInstructions);
|
|
@@ -8656,7 +8806,7 @@ var CpAmm = class {
|
|
|
8656
8806
|
tokenBVault,
|
|
8657
8807
|
tokenAProgram,
|
|
8658
8808
|
tokenBProgram,
|
|
8659
|
-
liquidityDelta:
|
|
8809
|
+
liquidityDelta: positionBLiquidityDelta,
|
|
8660
8810
|
tokenAAmountThreshold: tokenAAmountAddLiquidityThreshold,
|
|
8661
8811
|
tokenBAmountThreshold: tokenBAmountAddLiquidityThreshold
|
|
8662
8812
|
});
|
|
@@ -8953,5 +9103,8 @@ var index_default = cp_amm_default;
|
|
|
8953
9103
|
|
|
8954
9104
|
|
|
8955
9105
|
|
|
8956
|
-
|
|
9106
|
+
|
|
9107
|
+
|
|
9108
|
+
|
|
9109
|
+
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;
|
|
8957
9110
|
//# sourceMappingURL=index.js.map
|