@meteora-ag/cp-amm-sdk 1.0.1-rc.14 → 1.0.1-rc.15
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Program, IdlAccounts, BN, IdlTypes } from '@coral-xyz/anchor';
|
|
2
2
|
import { PublicKey, Transaction, Connection, TransactionInstruction, AddressLookupTableAccount, Commitment, GetProgramAccountsFilter } from '@solana/web3.js';
|
|
3
|
+
import Decimal from 'decimal.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
@@ -6714,6 +6715,14 @@ declare const getUnClaimReward: (positionState: PositionState) => {
|
|
|
6714
6715
|
|
|
6715
6716
|
declare const positionByPoolFilter: (pool: PublicKey) => GetProgramAccountsFilter;
|
|
6716
6717
|
|
|
6718
|
+
declare function mulShr(x: BN, y: BN, offset: number, rounding: Rounding): BN;
|
|
6719
|
+
declare function shlDiv(x: BN, y: BN, offset: number, rounding: Rounding): BN;
|
|
6720
|
+
declare function mulDiv(x: BN, y: BN, denominator: BN, rounding: Rounding): BN;
|
|
6721
|
+
declare function divCeil(a: BN, b: BN): BN;
|
|
6722
|
+
declare function q64ToDecimal(num: BN, decimalPlaces?: number): Decimal;
|
|
6723
|
+
declare function decimalToQ64(num: Decimal): BN;
|
|
6724
|
+
declare function getInitPriceQ64(tokenAAmount: BN, tokenBAmount: BN): BN;
|
|
6725
|
+
|
|
6717
6726
|
var address = "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
|
|
6718
6727
|
var metadata = {
|
|
6719
6728
|
name: "cp_amm",
|
|
@@ -12873,4 +12882,4 @@ var CpAmmIDL = {
|
|
|
12873
12882
|
types: types
|
|
12874
12883
|
};
|
|
12875
12884
|
|
|
12876
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeParams, type ClaimRewardParams, 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, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, 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, positionByPoolFilter, unwrapSOLInstruction, wrapSOLInstruction };
|
|
12885
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeParams, type ClaimRewardParams, 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, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getCurrentPrice, getDeltaAmountA, getDeltaAmountB, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getInitPriceQ64, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, mulShr, positionByPoolFilter, q64ToDecimal, shlDiv, unwrapSOLInstruction, wrapSOLInstruction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Program, IdlAccounts, BN, IdlTypes } from '@coral-xyz/anchor';
|
|
2
2
|
import { PublicKey, Transaction, Connection, TransactionInstruction, AddressLookupTableAccount, Commitment, GetProgramAccountsFilter } from '@solana/web3.js';
|
|
3
|
+
import Decimal from 'decimal.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
@@ -6714,6 +6715,14 @@ declare const getUnClaimReward: (positionState: PositionState) => {
|
|
|
6714
6715
|
|
|
6715
6716
|
declare const positionByPoolFilter: (pool: PublicKey) => GetProgramAccountsFilter;
|
|
6716
6717
|
|
|
6718
|
+
declare function mulShr(x: BN, y: BN, offset: number, rounding: Rounding): BN;
|
|
6719
|
+
declare function shlDiv(x: BN, y: BN, offset: number, rounding: Rounding): BN;
|
|
6720
|
+
declare function mulDiv(x: BN, y: BN, denominator: BN, rounding: Rounding): BN;
|
|
6721
|
+
declare function divCeil(a: BN, b: BN): BN;
|
|
6722
|
+
declare function q64ToDecimal(num: BN, decimalPlaces?: number): Decimal;
|
|
6723
|
+
declare function decimalToQ64(num: Decimal): BN;
|
|
6724
|
+
declare function getInitPriceQ64(tokenAAmount: BN, tokenBAmount: BN): BN;
|
|
6725
|
+
|
|
6717
6726
|
var address = "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
|
|
6718
6727
|
var metadata = {
|
|
6719
6728
|
name: "cp_amm",
|
|
@@ -12873,4 +12882,4 @@ var CpAmmIDL = {
|
|
|
12873
12882
|
types: types
|
|
12874
12883
|
};
|
|
12875
12884
|
|
|
12876
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeParams, type ClaimRewardParams, 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, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, 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, positionByPoolFilter, unwrapSOLInstruction, wrapSOLInstruction };
|
|
12885
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, type BaseFee, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeParams, type ClaimRewardParams, 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, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, PRECISION, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PreparePoolCreationParams, type PreparedPoolCreation, type RefreshVestingParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SwapParams, type SwapQuotes, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, deriveEventAuthority, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, divCeil, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getBaseFeeNumerator, getCurrentPrice, getDeltaAmountA, getDeltaAmountB, getDynamicFeeNumerator, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getFeeNumerator, getFirstKey, getInitPriceQ64, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNftOwner, getOrCreateATAInstruction, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSwapAmount, getTokenDecimals, getTokenProgram, getUnClaimReward, mulDiv, mulShr, positionByPoolFilter, q64ToDecimal, shlDiv, unwrapSOLInstruction, wrapSOLInstruction };
|
package/dist/index.js
CHANGED
|
@@ -6526,6 +6526,10 @@ function pow(base, exp) {
|
|
|
6526
6526
|
// src/math/index.ts
|
|
6527
6527
|
|
|
6528
6528
|
var _decimaljs = require('decimal.js'); var _decimaljs2 = _interopRequireDefault(_decimaljs);
|
|
6529
|
+
function mulShr(x, y, offset, rounding) {
|
|
6530
|
+
const denominator = new (0, _anchor.BN)(1).shln(offset);
|
|
6531
|
+
return mulDiv(x, y, denominator, rounding);
|
|
6532
|
+
}
|
|
6529
6533
|
function shlDiv(x, y, offset, rounding) {
|
|
6530
6534
|
const scale = new (0, _anchor.BN)(1).shln(offset);
|
|
6531
6535
|
return mulDiv(x, scale, y, rounding);
|
|
@@ -6543,6 +6547,12 @@ function divCeil(a, b) {
|
|
|
6543
6547
|
}
|
|
6544
6548
|
return a.add(b.sub(new (0, _anchor.BN)(1))).div(b);
|
|
6545
6549
|
}
|
|
6550
|
+
function q64ToDecimal(num, decimalPlaces) {
|
|
6551
|
+
return new (0, _decimaljs2.default)(num.toString()).div(_decimaljs2.default.pow(2, 64)).toDecimalPlaces(decimalPlaces);
|
|
6552
|
+
}
|
|
6553
|
+
function decimalToQ64(num) {
|
|
6554
|
+
return new (0, _anchor.BN)(num.mul(_decimaljs2.default.pow(2, 64)).floor().toFixed());
|
|
6555
|
+
}
|
|
6546
6556
|
function getInitPriceQ64(tokenAAmount, tokenBAmount) {
|
|
6547
6557
|
const sqrtInitPrice = new (0, _decimaljs2.default)(tokenBAmount.toString()).div(new (0, _decimaljs2.default)(tokenAAmount.toString())).sqrt();
|
|
6548
6558
|
return new (0, _anchor.BN)(sqrtInitPrice.mul(_decimaljs2.default.pow(2, 64)).floor().toFixed());
|
|
@@ -8071,5 +8081,12 @@ var index_default = cp_amm_default;
|
|
|
8071
8081
|
|
|
8072
8082
|
|
|
8073
8083
|
|
|
8074
|
-
|
|
8084
|
+
|
|
8085
|
+
|
|
8086
|
+
|
|
8087
|
+
|
|
8088
|
+
|
|
8089
|
+
|
|
8090
|
+
|
|
8091
|
+
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.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.PRECISION = PRECISION; exports.Rounding = Rounding; exports.SCALE_OFFSET = SCALE_OFFSET; exports.TradeDirection = TradeDirection; exports.decimalToQ64 = decimalToQ64; exports.default = index_default; exports.deriveClaimFeeOperatorAddress = deriveClaimFeeOperatorAddress; exports.deriveConfigAddress = deriveConfigAddress; exports.deriveCustomizablePoolAddress = deriveCustomizablePoolAddress; exports.deriveEventAuthority = deriveEventAuthority; exports.derivePoolAddress = derivePoolAddress; exports.derivePoolAuthority = derivePoolAuthority; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveRewardVaultAddress = deriveRewardVaultAddress; exports.deriveTokenBadgeAddress = deriveTokenBadgeAddress; exports.deriveTokenVaultAddress = deriveTokenVaultAddress; exports.divCeil = divCeil; exports.getAmountAFromLiquidityDelta = getAmountAFromLiquidityDelta; exports.getAmountBFromLiquidityDelta = getAmountBFromLiquidityDelta; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getCurrentPrice = getCurrentPrice; exports.getDeltaAmountA = getDeltaAmountA; exports.getDeltaAmountB = getDeltaAmountB; exports.getDynamicFeeNumerator = getDynamicFeeNumerator; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getFeeNumerator = getFeeNumerator; exports.getFirstKey = getFirstKey; exports.getInitPriceQ64 = getInitPriceQ64; exports.getLiquidityDeltaFromAmountA = getLiquidityDeltaFromAmountA; exports.getLiquidityDeltaFromAmountB = getLiquidityDeltaFromAmountB; exports.getMaxAmountWithSlippage = getMaxAmountWithSlippage; exports.getMinAmountWithSlippage = getMinAmountWithSlippage; exports.getNextSqrtPrice = getNextSqrtPrice; exports.getNftOwner = getNftOwner; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPriceImpact = getPriceImpact; exports.getSecondKey = getSecondKey; exports.getSimulationComputeUnits = getSimulationComputeUnits; exports.getSwapAmount = getSwapAmount; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getUnClaimReward = getUnClaimReward; exports.mulDiv = mulDiv; exports.mulShr = mulShr; exports.positionByPoolFilter = positionByPoolFilter; exports.q64ToDecimal = q64ToDecimal; exports.shlDiv = shlDiv; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
8075
8092
|
//# sourceMappingURL=index.js.map
|