@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.d.mts
CHANGED
|
@@ -5596,6 +5596,11 @@ type WithdrawQuote = {
|
|
|
5596
5596
|
outAmountA: BN;
|
|
5597
5597
|
outAmountB: BN;
|
|
5598
5598
|
};
|
|
5599
|
+
type DynamicFeeParams = {
|
|
5600
|
+
volatilityAccumulator: BN;
|
|
5601
|
+
binStep: number;
|
|
5602
|
+
variableFeeControl: number;
|
|
5603
|
+
};
|
|
5599
5604
|
|
|
5600
5605
|
/**
|
|
5601
5606
|
* CpAmm SDK class to interact with the Dynamic CP-AMM
|
|
@@ -5776,14 +5781,14 @@ declare class CpAmm {
|
|
|
5776
5781
|
* @param params - Swap parameters including input amount, pool state, slippage, etc.
|
|
5777
5782
|
* @returns Swap quote including expected output amount, fee, and price impact.
|
|
5778
5783
|
*/
|
|
5779
|
-
getQuote(params: GetQuoteParams):
|
|
5784
|
+
getQuote(params: GetQuoteParams): {
|
|
5780
5785
|
swapInAmount: BN;
|
|
5781
5786
|
consumedInAmount: BN;
|
|
5782
5787
|
swapOutAmount: BN;
|
|
5783
5788
|
minSwapOutAmount: BN;
|
|
5784
5789
|
totalFee: BN;
|
|
5785
5790
|
priceImpact: number;
|
|
5786
|
-
}
|
|
5791
|
+
};
|
|
5787
5792
|
/**
|
|
5788
5793
|
* Calculates the deposit quote for liquidity pool.
|
|
5789
5794
|
*
|
|
@@ -5794,7 +5799,7 @@ declare class CpAmm {
|
|
|
5794
5799
|
* @returns {BN} returns.outputAmount - The calculated corresponding amount of the other token.
|
|
5795
5800
|
* @returns {BN} returns.liquidityDelta - The amount of liquidity that will be added to the pool.
|
|
5796
5801
|
*/
|
|
5797
|
-
getDepositQuote(params: GetDepositQuoteParams):
|
|
5802
|
+
getDepositQuote(params: GetDepositQuoteParams): DepositQuote;
|
|
5798
5803
|
/**
|
|
5799
5804
|
* Calculates the withdrawal quote for removing liquidity from a concentrated liquidity pool.
|
|
5800
5805
|
*
|
|
@@ -5808,7 +5813,7 @@ declare class CpAmm {
|
|
|
5808
5813
|
* @returns {BN} returns.outAmountA - The calculated amount of token A to be received (after deducting transfer fees)
|
|
5809
5814
|
* @returns {BN} returns.outAmountB - The calculated amount of token B to be received (after deducting transfer fees)
|
|
5810
5815
|
*/
|
|
5811
|
-
getWithdrawQuote(params: GetWithdrawQuoteParams):
|
|
5816
|
+
getWithdrawQuote(params: GetWithdrawQuoteParams): WithdrawQuote;
|
|
5812
5817
|
/**
|
|
5813
5818
|
* Calculates liquidity and corresponding token amounts for token A single-sided pool creation
|
|
5814
5819
|
* Only supports initialization where initial price equals min sqrt price
|
|
@@ -5969,7 +5974,6 @@ declare function deriveCustomizablePoolAddress(tokenAMint: PublicKey, tokenBMint
|
|
|
5969
5974
|
declare function deriveTokenBadgeAddress(tokenMint: PublicKey): PublicKey;
|
|
5970
5975
|
declare function deriveClaimFeeOperatorAddress(operator: PublicKey): PublicKey;
|
|
5971
5976
|
declare function derivePositionNftAccount(positionNftMint: PublicKey): PublicKey;
|
|
5972
|
-
declare function deriveTokenBadge(tokenMint: PublicKey): PublicKey;
|
|
5973
5977
|
|
|
5974
5978
|
declare const CP_AMM_PROGRAM_ID: PublicKey;
|
|
5975
5979
|
declare const LIQUIDITY_SCALE = 128;
|
|
@@ -5977,7 +5981,6 @@ declare const SCALE_OFFSET = 64;
|
|
|
5977
5981
|
declare const BASIS_POINT_MAX = 10000;
|
|
5978
5982
|
declare const MAX_FEE_NUMERATOR = 500000000;
|
|
5979
5983
|
declare const FEE_DENOMINATOR = 1000000000;
|
|
5980
|
-
declare const PRECISION = 1000000;
|
|
5981
5984
|
declare const MIN_SQRT_PRICE: BN;
|
|
5982
5985
|
declare const MAX_SQRT_PRICE: BN;
|
|
5983
5986
|
declare const MIN_CU_BUFFER = 50000;
|
|
@@ -5991,7 +5994,6 @@ declare const getOrCreateATAInstruction: (connection: Connection, tokenMint: Pub
|
|
|
5991
5994
|
}>;
|
|
5992
5995
|
declare const wrapSOLInstruction: (from: PublicKey, to: PublicKey, amount: bigint) => TransactionInstruction[];
|
|
5993
5996
|
declare const unwrapSOLInstruction: (owner: PublicKey, allowOwnerOffCurve?: boolean) => Promise<TransactionInstruction>;
|
|
5994
|
-
declare function getNftOwner(connection: Connection, nftMint: PublicKey): Promise<PublicKey>;
|
|
5995
5997
|
declare function getAllUserPositionNftAccount(connection: Connection, user: PublicKey): Promise<Array<{
|
|
5996
5998
|
positionNft: PublicKey;
|
|
5997
5999
|
positionNftAccount: PublicKey;
|
|
@@ -6025,8 +6027,8 @@ declare function getDynamicFeeNumerator(volatilityAccumulator: BN, binStep: BN,
|
|
|
6025
6027
|
*/
|
|
6026
6028
|
declare function getFeeNumerator(currentPoint: number, activationPoint: BN, numberOfPeriod: number, periodFrequency: BN, feeSchedulerMode: number, cliffFeeNumerator: BN, reductionFactor: BN, dynamicFeeParams?: {
|
|
6027
6029
|
volatilityAccumulator: BN;
|
|
6028
|
-
binStep:
|
|
6029
|
-
variableFeeControl:
|
|
6030
|
+
binStep: number;
|
|
6031
|
+
variableFeeControl: number;
|
|
6030
6032
|
}): BN;
|
|
6031
6033
|
/**
|
|
6032
6034
|
*
|
|
@@ -6150,7 +6152,6 @@ declare const ONE: BN;
|
|
|
6150
6152
|
declare function pow(base: BN, exp: BN): BN;
|
|
6151
6153
|
|
|
6152
6154
|
declare function mulDiv(x: BN, y: BN, denominator: BN, rounding: Rounding): BN;
|
|
6153
|
-
declare function divCeil(a: BN, b: BN): BN;
|
|
6154
6155
|
declare function q64ToDecimal(num: BN, decimalPlaces?: number): Decimal;
|
|
6155
6156
|
declare function decimalToQ64(num: Decimal): BN;
|
|
6156
6157
|
|
|
@@ -12493,4 +12494,4 @@ var CpAmmIDL = {
|
|
|
12493
12494
|
types: types
|
|
12494
12495
|
};
|
|
12495
12496
|
|
|
12496
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, 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,
|
|
12497
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, 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, type DynamicFeeParams, 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, 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, deriveTokenBadgeAddress, deriveTokenVaultAddress, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, 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
|
@@ -5596,6 +5596,11 @@ type WithdrawQuote = {
|
|
|
5596
5596
|
outAmountA: BN;
|
|
5597
5597
|
outAmountB: BN;
|
|
5598
5598
|
};
|
|
5599
|
+
type DynamicFeeParams = {
|
|
5600
|
+
volatilityAccumulator: BN;
|
|
5601
|
+
binStep: number;
|
|
5602
|
+
variableFeeControl: number;
|
|
5603
|
+
};
|
|
5599
5604
|
|
|
5600
5605
|
/**
|
|
5601
5606
|
* CpAmm SDK class to interact with the Dynamic CP-AMM
|
|
@@ -5776,14 +5781,14 @@ declare class CpAmm {
|
|
|
5776
5781
|
* @param params - Swap parameters including input amount, pool state, slippage, etc.
|
|
5777
5782
|
* @returns Swap quote including expected output amount, fee, and price impact.
|
|
5778
5783
|
*/
|
|
5779
|
-
getQuote(params: GetQuoteParams):
|
|
5784
|
+
getQuote(params: GetQuoteParams): {
|
|
5780
5785
|
swapInAmount: BN;
|
|
5781
5786
|
consumedInAmount: BN;
|
|
5782
5787
|
swapOutAmount: BN;
|
|
5783
5788
|
minSwapOutAmount: BN;
|
|
5784
5789
|
totalFee: BN;
|
|
5785
5790
|
priceImpact: number;
|
|
5786
|
-
}
|
|
5791
|
+
};
|
|
5787
5792
|
/**
|
|
5788
5793
|
* Calculates the deposit quote for liquidity pool.
|
|
5789
5794
|
*
|
|
@@ -5794,7 +5799,7 @@ declare class CpAmm {
|
|
|
5794
5799
|
* @returns {BN} returns.outputAmount - The calculated corresponding amount of the other token.
|
|
5795
5800
|
* @returns {BN} returns.liquidityDelta - The amount of liquidity that will be added to the pool.
|
|
5796
5801
|
*/
|
|
5797
|
-
getDepositQuote(params: GetDepositQuoteParams):
|
|
5802
|
+
getDepositQuote(params: GetDepositQuoteParams): DepositQuote;
|
|
5798
5803
|
/**
|
|
5799
5804
|
* Calculates the withdrawal quote for removing liquidity from a concentrated liquidity pool.
|
|
5800
5805
|
*
|
|
@@ -5808,7 +5813,7 @@ declare class CpAmm {
|
|
|
5808
5813
|
* @returns {BN} returns.outAmountA - The calculated amount of token A to be received (after deducting transfer fees)
|
|
5809
5814
|
* @returns {BN} returns.outAmountB - The calculated amount of token B to be received (after deducting transfer fees)
|
|
5810
5815
|
*/
|
|
5811
|
-
getWithdrawQuote(params: GetWithdrawQuoteParams):
|
|
5816
|
+
getWithdrawQuote(params: GetWithdrawQuoteParams): WithdrawQuote;
|
|
5812
5817
|
/**
|
|
5813
5818
|
* Calculates liquidity and corresponding token amounts for token A single-sided pool creation
|
|
5814
5819
|
* Only supports initialization where initial price equals min sqrt price
|
|
@@ -5969,7 +5974,6 @@ declare function deriveCustomizablePoolAddress(tokenAMint: PublicKey, tokenBMint
|
|
|
5969
5974
|
declare function deriveTokenBadgeAddress(tokenMint: PublicKey): PublicKey;
|
|
5970
5975
|
declare function deriveClaimFeeOperatorAddress(operator: PublicKey): PublicKey;
|
|
5971
5976
|
declare function derivePositionNftAccount(positionNftMint: PublicKey): PublicKey;
|
|
5972
|
-
declare function deriveTokenBadge(tokenMint: PublicKey): PublicKey;
|
|
5973
5977
|
|
|
5974
5978
|
declare const CP_AMM_PROGRAM_ID: PublicKey;
|
|
5975
5979
|
declare const LIQUIDITY_SCALE = 128;
|
|
@@ -5977,7 +5981,6 @@ declare const SCALE_OFFSET = 64;
|
|
|
5977
5981
|
declare const BASIS_POINT_MAX = 10000;
|
|
5978
5982
|
declare const MAX_FEE_NUMERATOR = 500000000;
|
|
5979
5983
|
declare const FEE_DENOMINATOR = 1000000000;
|
|
5980
|
-
declare const PRECISION = 1000000;
|
|
5981
5984
|
declare const MIN_SQRT_PRICE: BN;
|
|
5982
5985
|
declare const MAX_SQRT_PRICE: BN;
|
|
5983
5986
|
declare const MIN_CU_BUFFER = 50000;
|
|
@@ -5991,7 +5994,6 @@ declare const getOrCreateATAInstruction: (connection: Connection, tokenMint: Pub
|
|
|
5991
5994
|
}>;
|
|
5992
5995
|
declare const wrapSOLInstruction: (from: PublicKey, to: PublicKey, amount: bigint) => TransactionInstruction[];
|
|
5993
5996
|
declare const unwrapSOLInstruction: (owner: PublicKey, allowOwnerOffCurve?: boolean) => Promise<TransactionInstruction>;
|
|
5994
|
-
declare function getNftOwner(connection: Connection, nftMint: PublicKey): Promise<PublicKey>;
|
|
5995
5997
|
declare function getAllUserPositionNftAccount(connection: Connection, user: PublicKey): Promise<Array<{
|
|
5996
5998
|
positionNft: PublicKey;
|
|
5997
5999
|
positionNftAccount: PublicKey;
|
|
@@ -6025,8 +6027,8 @@ declare function getDynamicFeeNumerator(volatilityAccumulator: BN, binStep: BN,
|
|
|
6025
6027
|
*/
|
|
6026
6028
|
declare function getFeeNumerator(currentPoint: number, activationPoint: BN, numberOfPeriod: number, periodFrequency: BN, feeSchedulerMode: number, cliffFeeNumerator: BN, reductionFactor: BN, dynamicFeeParams?: {
|
|
6027
6029
|
volatilityAccumulator: BN;
|
|
6028
|
-
binStep:
|
|
6029
|
-
variableFeeControl:
|
|
6030
|
+
binStep: number;
|
|
6031
|
+
variableFeeControl: number;
|
|
6030
6032
|
}): BN;
|
|
6031
6033
|
/**
|
|
6032
6034
|
*
|
|
@@ -6150,7 +6152,6 @@ declare const ONE: BN;
|
|
|
6150
6152
|
declare function pow(base: BN, exp: BN): BN;
|
|
6151
6153
|
|
|
6152
6154
|
declare function mulDiv(x: BN, y: BN, denominator: BN, rounding: Rounding): BN;
|
|
6153
|
-
declare function divCeil(a: BN, b: BN): BN;
|
|
6154
6155
|
declare function q64ToDecimal(num: BN, decimalPlaces?: number): Decimal;
|
|
6155
6156
|
declare function decimalToQ64(num: Decimal): BN;
|
|
6156
6157
|
|
|
@@ -12493,4 +12494,4 @@ var CpAmmIDL = {
|
|
|
12493
12494
|
types: types
|
|
12494
12495
|
};
|
|
12495
12496
|
|
|
12496
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, 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,
|
|
12497
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, 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, type DynamicFeeParams, 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, 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, deriveTokenBadgeAddress, deriveTokenVaultAddress, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getOrCreateATAInstruction, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|