@meteora-ag/dynamic-bonding-curve-sdk 1.2.2 → 1.2.3
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.cjs +46 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5205,6 +5205,11 @@ type SwapQuoteParam = {
|
|
|
5205
5205
|
hasReferral: boolean;
|
|
5206
5206
|
currentPoint: BN;
|
|
5207
5207
|
};
|
|
5208
|
+
type SwapQuoteExactInParam = {
|
|
5209
|
+
virtualPool: VirtualPool;
|
|
5210
|
+
config: PoolConfig;
|
|
5211
|
+
currentPoint: BN;
|
|
5212
|
+
};
|
|
5208
5213
|
type MigrateToDammV1Param = {
|
|
5209
5214
|
payer: PublicKey;
|
|
5210
5215
|
virtualPool: PublicKey;
|
|
@@ -5483,6 +5488,9 @@ declare class PoolService extends DynamicBondingCurveProgram {
|
|
|
5483
5488
|
* @returns The swap quote result
|
|
5484
5489
|
*/
|
|
5485
5490
|
swapQuote(swapQuoteParam: SwapQuoteParam): Promise<QuoteResult>;
|
|
5491
|
+
swapQuoteExactIn(swapQuoteExactInParam: SwapQuoteExactInParam): {
|
|
5492
|
+
exactAmountIn: BN$1;
|
|
5493
|
+
};
|
|
5486
5494
|
}
|
|
5487
5495
|
|
|
5488
5496
|
declare class MigrationService extends DynamicBondingCurveProgram {
|
|
@@ -13443,5 +13451,15 @@ declare function getFeeMode(collectFeeMode: GetFeeMode, tradeDirection: TradeDir
|
|
|
13443
13451
|
* @returns Swap quote result
|
|
13444
13452
|
*/
|
|
13445
13453
|
declare function swapQuote(virtualPool: VirtualPool, config: PoolConfig, swapBaseForQuote: boolean, amountIn: BN$1, slippageBps: number, hasReferral: boolean, currentPoint: BN$1): Promise<QuoteResult>;
|
|
13454
|
+
/**
|
|
13455
|
+
* Calculate the required quote amount for exact input
|
|
13456
|
+
* @param migrationQuoteThreshold Migration quote threshold
|
|
13457
|
+
* @param quoteReserve Current quote reserve
|
|
13458
|
+
* @param collectFeeMode Fee collection mode
|
|
13459
|
+
* @param config Pool config state
|
|
13460
|
+
* @param currentPoint Current point
|
|
13461
|
+
* @returns Required quote amount
|
|
13462
|
+
*/
|
|
13463
|
+
declare function calculateQuoteExactInAmount(config: PoolConfig, virtualPool: VirtualPool, currentPoint: BN$1): BN$1;
|
|
13446
13464
|
|
|
13447
|
-
export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BuildCurveBaseParam, type BuildCurveParam, type BuildCurveWithLiquidityWeightsParam, type BuildCurveWithMarketCapParam, type BuildCurveWithTwoSegmentsParam, type ClaimCreatorTradingFee2Param, type ClaimCreatorTradingFeeAccounts, type ClaimCreatorTradingFeeParam, type ClaimCreatorTradingFeeWithQuoteMintNotSolParam, type ClaimCreatorTradingFeeWithQuoteMintSolParam, type ClaimFeeOperator, type ClaimPartnerTradingFeeWithQuoteMintNotSolParam, type ClaimPartnerTradingFeeWithQuoteMintSolParam, type ClaimProtocolFeeAccounts, type ClaimTradingFee2Param, type ClaimTradingFeeAccounts, type ClaimTradingFeeParam, type CloseClaimFeeOperatorAccounts, CollectFeeMode, type Config, type ConfigParameters, type CreateClaimFeeOperatorAccounts, type CreateConfigAccounts, type CreateConfigAndPoolParam, type CreateConfigAndPoolWithFirstBuyParam, type CreateConfigParam, type CreateDammV1MigrationMetadataParam, type CreateDammV2MigrationMetadataParam, type CreateLockerAccounts, type CreateLockerParam, type CreatePartnerMetadata, type CreatePartnerMetadataParam, type CreatePartnerMetadataParameters, type CreatePoolParam, type CreatePoolWithFirstBuyParam, type CreateVirtualPoolMetadata, type CreateVirtualPoolMetadataParam, type CreateVirtualPoolMetadataParameters, CreatorService, type CreatorWithdrawSurplusAccounts, type CreatorWithdrawSurplusParam, DAMM_V1_MIGRATION_FEE_ADDRESS, DAMM_V1_PROGRAM_ID, DAMM_V2_MIGRATION_FEE_ADDRESS, DAMM_V2_PROGRAM_ID, DYNAMIC_BONDING_CURVE_PROGRAM_ID, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DammLpTokenParam, DynamicBondingCurveClient, DynamicBondingCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, type FeeResult, FeeSchedulerMode, type FeeSchedulerParams, GetFeeMode, type InitializePoolBaseParam, type InitializePoolParameters, type InitializeVirtualPoolWithSplTokenAccounts, type InitializeVirtualPoolWithToken2022Accounts, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CURVE_POINT, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MAX_SWALLOW_PERCENTAGE, METAPLEX_PROGRAM_ID, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MeteoraDammV2MigrationMetadata, type MigrateMeteoraDammAccounts, type MigrateMeteoraDammClaimLpTokenAccounts, type MigrateMeteoraDammLockLpTokenAccounts, type MigrateToDammV1Param, type MigrateToDammV2Param, type MigrateToDammV2Response, type MigrationDammV2Accounts, type MigrationDammV2CreateMetadataAccounts, MigrationFeeOption, type MigrationMeteoraDammCreateMetadataAccounts, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusAccounts, type PartnerWithdrawSurplusParam, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, type PoolMetrics, PoolService, type PrepareSwapParams, type QuoteResult, RESOLUTION, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, type SwapAccounts, type SwapAmount, type SwapParam, type SwapParameters, type SwapQuoteParam, type SwapResult, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorAccounts, type TransferPoolCreatorParam, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverAccounts, type WithdrawLeftoverParam, type WithdrawMigrationFeeParam, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithTwoSegments, cleanUpTokenAccountTx, convertDecimalToBN, convertToLamports, createDammV1Program, createDammV2Program, createDbcProgram, createInitializePermissionlessDynamicVaultIx, createLockEscrowIx, createProgramAccountFilter, createVaultProgram, deriveBaseKeyForLocker, deriveDammV1EventAuthority, deriveDammV1LockEscrowAddress, deriveDammV1LpMintAddress, deriveDammV1MigrationMetadataAddress, deriveDammV1PoolAddress, deriveDammV1PoolAuthority, deriveDammV1ProtocolFeeAddress, deriveDammV1VaultLPAddress, deriveDammV2EventAuthority, deriveDammV2LockEscrowAddress, deriveDammV2MigrationMetadataAddress, deriveDammV2PoolAddress, deriveDammV2PoolAuthority, deriveDammV2TokenVaultAddress, deriveDbcEventAuthority, deriveDbcPoolAddress, deriveDbcPoolAuthority, deriveDbcPoolMetadata, deriveDbcTokenVaultAddress, deriveEscrow, deriveLockerEventAuthority, deriveMintMetadata, derivePartnerMetadata, derivePositionAddress, derivePositionNftAccount, deriveTokenVaultKey, deriveVaultAddress, deriveVaultLpMintAddress, deriveVaultPdas, feeNumeratorToBps, findAssociatedTokenAddress, fromDecimalToBN, getAccountCreationTimestamp, getAccountCreationTimestamps, getAccountData, getBaseFeeParams, getBaseTokenForSwap, getCurrentBaseFeeNumerator, getDeltaAmountBase, getDeltaAmountBaseUnsigned, getDeltaAmountQuoteUnsigned, getDynamicFeeParams, getFeeInPeriod, getFeeMode, getFeeOnAmount, getFirstCurve, getFirstKey, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getInitializeAmounts, getLiquidity, getLockedVestingParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeBps, getNextSqrtPriceFromAmountBaseRoundingUp, getNextSqrtPriceFromAmountQuoteRoundingDown, getNextSqrtPriceFromInput, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountFromBaseToQuote, getSwapAmountFromQuoteToBase, getSwapAmountWithBuffer, getSwapResult, getTokenDecimals, getTokenProgram, getTokenType, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFee, isDefaultLockedVesting, isNativeSol, prepareTokenAccountTx, swapQuote, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateLPPercentages, validateMigrationAndTokenType, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
|
|
13465
|
+
export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BuildCurveBaseParam, type BuildCurveParam, type BuildCurveWithLiquidityWeightsParam, type BuildCurveWithMarketCapParam, type BuildCurveWithTwoSegmentsParam, type ClaimCreatorTradingFee2Param, type ClaimCreatorTradingFeeAccounts, type ClaimCreatorTradingFeeParam, type ClaimCreatorTradingFeeWithQuoteMintNotSolParam, type ClaimCreatorTradingFeeWithQuoteMintSolParam, type ClaimFeeOperator, type ClaimPartnerTradingFeeWithQuoteMintNotSolParam, type ClaimPartnerTradingFeeWithQuoteMintSolParam, type ClaimProtocolFeeAccounts, type ClaimTradingFee2Param, type ClaimTradingFeeAccounts, type ClaimTradingFeeParam, type CloseClaimFeeOperatorAccounts, CollectFeeMode, type Config, type ConfigParameters, type CreateClaimFeeOperatorAccounts, type CreateConfigAccounts, type CreateConfigAndPoolParam, type CreateConfigAndPoolWithFirstBuyParam, type CreateConfigParam, type CreateDammV1MigrationMetadataParam, type CreateDammV2MigrationMetadataParam, type CreateLockerAccounts, type CreateLockerParam, type CreatePartnerMetadata, type CreatePartnerMetadataParam, type CreatePartnerMetadataParameters, type CreatePoolParam, type CreatePoolWithFirstBuyParam, type CreateVirtualPoolMetadata, type CreateVirtualPoolMetadataParam, type CreateVirtualPoolMetadataParameters, CreatorService, type CreatorWithdrawSurplusAccounts, type CreatorWithdrawSurplusParam, DAMM_V1_MIGRATION_FEE_ADDRESS, DAMM_V1_PROGRAM_ID, DAMM_V2_MIGRATION_FEE_ADDRESS, DAMM_V2_PROGRAM_ID, DYNAMIC_BONDING_CURVE_PROGRAM_ID, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DammLpTokenParam, DynamicBondingCurveClient, DynamicBondingCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, type FeeResult, FeeSchedulerMode, type FeeSchedulerParams, GetFeeMode, type InitializePoolBaseParam, type InitializePoolParameters, type InitializeVirtualPoolWithSplTokenAccounts, type InitializeVirtualPoolWithToken2022Accounts, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CURVE_POINT, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MAX_SWALLOW_PERCENTAGE, METAPLEX_PROGRAM_ID, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MeteoraDammV2MigrationMetadata, type MigrateMeteoraDammAccounts, type MigrateMeteoraDammClaimLpTokenAccounts, type MigrateMeteoraDammLockLpTokenAccounts, type MigrateToDammV1Param, type MigrateToDammV2Param, type MigrateToDammV2Response, type MigrationDammV2Accounts, type MigrationDammV2CreateMetadataAccounts, MigrationFeeOption, type MigrationMeteoraDammCreateMetadataAccounts, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusAccounts, type PartnerWithdrawSurplusParam, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, type PoolMetrics, PoolService, type PrepareSwapParams, type QuoteResult, RESOLUTION, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, type SwapAccounts, type SwapAmount, type SwapParam, type SwapParameters, type SwapQuoteExactInParam, type SwapQuoteParam, type SwapResult, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorAccounts, type TransferPoolCreatorParam, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverAccounts, type WithdrawLeftoverParam, type WithdrawMigrationFeeParam, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithTwoSegments, calculateQuoteExactInAmount, cleanUpTokenAccountTx, convertDecimalToBN, convertToLamports, createDammV1Program, createDammV2Program, createDbcProgram, createInitializePermissionlessDynamicVaultIx, createLockEscrowIx, createProgramAccountFilter, createVaultProgram, deriveBaseKeyForLocker, deriveDammV1EventAuthority, deriveDammV1LockEscrowAddress, deriveDammV1LpMintAddress, deriveDammV1MigrationMetadataAddress, deriveDammV1PoolAddress, deriveDammV1PoolAuthority, deriveDammV1ProtocolFeeAddress, deriveDammV1VaultLPAddress, deriveDammV2EventAuthority, deriveDammV2LockEscrowAddress, deriveDammV2MigrationMetadataAddress, deriveDammV2PoolAddress, deriveDammV2PoolAuthority, deriveDammV2TokenVaultAddress, deriveDbcEventAuthority, deriveDbcPoolAddress, deriveDbcPoolAuthority, deriveDbcPoolMetadata, deriveDbcTokenVaultAddress, deriveEscrow, deriveLockerEventAuthority, deriveMintMetadata, derivePartnerMetadata, derivePositionAddress, derivePositionNftAccount, deriveTokenVaultKey, deriveVaultAddress, deriveVaultLpMintAddress, deriveVaultPdas, feeNumeratorToBps, findAssociatedTokenAddress, fromDecimalToBN, getAccountCreationTimestamp, getAccountCreationTimestamps, getAccountData, getBaseFeeParams, getBaseTokenForSwap, getCurrentBaseFeeNumerator, getDeltaAmountBase, getDeltaAmountBaseUnsigned, getDeltaAmountQuoteUnsigned, getDynamicFeeParams, getFeeInPeriod, getFeeMode, getFeeOnAmount, getFirstCurve, getFirstKey, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getInitializeAmounts, getLiquidity, getLockedVestingParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeBps, getNextSqrtPriceFromAmountBaseRoundingUp, getNextSqrtPriceFromAmountQuoteRoundingDown, getNextSqrtPriceFromInput, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountFromBaseToQuote, getSwapAmountFromQuoteToBase, getSwapAmountWithBuffer, getSwapResult, getTokenDecimals, getTokenProgram, getTokenType, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFee, isDefaultLockedVesting, isNativeSol, prepareTokenAccountTx, swapQuote, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateLPPercentages, validateMigrationAndTokenType, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
|
package/dist/index.d.ts
CHANGED
|
@@ -5205,6 +5205,11 @@ type SwapQuoteParam = {
|
|
|
5205
5205
|
hasReferral: boolean;
|
|
5206
5206
|
currentPoint: BN;
|
|
5207
5207
|
};
|
|
5208
|
+
type SwapQuoteExactInParam = {
|
|
5209
|
+
virtualPool: VirtualPool;
|
|
5210
|
+
config: PoolConfig;
|
|
5211
|
+
currentPoint: BN;
|
|
5212
|
+
};
|
|
5208
5213
|
type MigrateToDammV1Param = {
|
|
5209
5214
|
payer: PublicKey;
|
|
5210
5215
|
virtualPool: PublicKey;
|
|
@@ -5483,6 +5488,9 @@ declare class PoolService extends DynamicBondingCurveProgram {
|
|
|
5483
5488
|
* @returns The swap quote result
|
|
5484
5489
|
*/
|
|
5485
5490
|
swapQuote(swapQuoteParam: SwapQuoteParam): Promise<QuoteResult>;
|
|
5491
|
+
swapQuoteExactIn(swapQuoteExactInParam: SwapQuoteExactInParam): {
|
|
5492
|
+
exactAmountIn: BN$1;
|
|
5493
|
+
};
|
|
5486
5494
|
}
|
|
5487
5495
|
|
|
5488
5496
|
declare class MigrationService extends DynamicBondingCurveProgram {
|
|
@@ -13443,5 +13451,15 @@ declare function getFeeMode(collectFeeMode: GetFeeMode, tradeDirection: TradeDir
|
|
|
13443
13451
|
* @returns Swap quote result
|
|
13444
13452
|
*/
|
|
13445
13453
|
declare function swapQuote(virtualPool: VirtualPool, config: PoolConfig, swapBaseForQuote: boolean, amountIn: BN$1, slippageBps: number, hasReferral: boolean, currentPoint: BN$1): Promise<QuoteResult>;
|
|
13454
|
+
/**
|
|
13455
|
+
* Calculate the required quote amount for exact input
|
|
13456
|
+
* @param migrationQuoteThreshold Migration quote threshold
|
|
13457
|
+
* @param quoteReserve Current quote reserve
|
|
13458
|
+
* @param collectFeeMode Fee collection mode
|
|
13459
|
+
* @param config Pool config state
|
|
13460
|
+
* @param currentPoint Current point
|
|
13461
|
+
* @returns Required quote amount
|
|
13462
|
+
*/
|
|
13463
|
+
declare function calculateQuoteExactInAmount(config: PoolConfig, virtualPool: VirtualPool, currentPoint: BN$1): BN$1;
|
|
13446
13464
|
|
|
13447
|
-
export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BuildCurveBaseParam, type BuildCurveParam, type BuildCurveWithLiquidityWeightsParam, type BuildCurveWithMarketCapParam, type BuildCurveWithTwoSegmentsParam, type ClaimCreatorTradingFee2Param, type ClaimCreatorTradingFeeAccounts, type ClaimCreatorTradingFeeParam, type ClaimCreatorTradingFeeWithQuoteMintNotSolParam, type ClaimCreatorTradingFeeWithQuoteMintSolParam, type ClaimFeeOperator, type ClaimPartnerTradingFeeWithQuoteMintNotSolParam, type ClaimPartnerTradingFeeWithQuoteMintSolParam, type ClaimProtocolFeeAccounts, type ClaimTradingFee2Param, type ClaimTradingFeeAccounts, type ClaimTradingFeeParam, type CloseClaimFeeOperatorAccounts, CollectFeeMode, type Config, type ConfigParameters, type CreateClaimFeeOperatorAccounts, type CreateConfigAccounts, type CreateConfigAndPoolParam, type CreateConfigAndPoolWithFirstBuyParam, type CreateConfigParam, type CreateDammV1MigrationMetadataParam, type CreateDammV2MigrationMetadataParam, type CreateLockerAccounts, type CreateLockerParam, type CreatePartnerMetadata, type CreatePartnerMetadataParam, type CreatePartnerMetadataParameters, type CreatePoolParam, type CreatePoolWithFirstBuyParam, type CreateVirtualPoolMetadata, type CreateVirtualPoolMetadataParam, type CreateVirtualPoolMetadataParameters, CreatorService, type CreatorWithdrawSurplusAccounts, type CreatorWithdrawSurplusParam, DAMM_V1_MIGRATION_FEE_ADDRESS, DAMM_V1_PROGRAM_ID, DAMM_V2_MIGRATION_FEE_ADDRESS, DAMM_V2_PROGRAM_ID, DYNAMIC_BONDING_CURVE_PROGRAM_ID, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DammLpTokenParam, DynamicBondingCurveClient, DynamicBondingCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, type FeeResult, FeeSchedulerMode, type FeeSchedulerParams, GetFeeMode, type InitializePoolBaseParam, type InitializePoolParameters, type InitializeVirtualPoolWithSplTokenAccounts, type InitializeVirtualPoolWithToken2022Accounts, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CURVE_POINT, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MAX_SWALLOW_PERCENTAGE, METAPLEX_PROGRAM_ID, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MeteoraDammV2MigrationMetadata, type MigrateMeteoraDammAccounts, type MigrateMeteoraDammClaimLpTokenAccounts, type MigrateMeteoraDammLockLpTokenAccounts, type MigrateToDammV1Param, type MigrateToDammV2Param, type MigrateToDammV2Response, type MigrationDammV2Accounts, type MigrationDammV2CreateMetadataAccounts, MigrationFeeOption, type MigrationMeteoraDammCreateMetadataAccounts, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusAccounts, type PartnerWithdrawSurplusParam, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, type PoolMetrics, PoolService, type PrepareSwapParams, type QuoteResult, RESOLUTION, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, type SwapAccounts, type SwapAmount, type SwapParam, type SwapParameters, type SwapQuoteParam, type SwapResult, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorAccounts, type TransferPoolCreatorParam, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverAccounts, type WithdrawLeftoverParam, type WithdrawMigrationFeeParam, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithTwoSegments, cleanUpTokenAccountTx, convertDecimalToBN, convertToLamports, createDammV1Program, createDammV2Program, createDbcProgram, createInitializePermissionlessDynamicVaultIx, createLockEscrowIx, createProgramAccountFilter, createVaultProgram, deriveBaseKeyForLocker, deriveDammV1EventAuthority, deriveDammV1LockEscrowAddress, deriveDammV1LpMintAddress, deriveDammV1MigrationMetadataAddress, deriveDammV1PoolAddress, deriveDammV1PoolAuthority, deriveDammV1ProtocolFeeAddress, deriveDammV1VaultLPAddress, deriveDammV2EventAuthority, deriveDammV2LockEscrowAddress, deriveDammV2MigrationMetadataAddress, deriveDammV2PoolAddress, deriveDammV2PoolAuthority, deriveDammV2TokenVaultAddress, deriveDbcEventAuthority, deriveDbcPoolAddress, deriveDbcPoolAuthority, deriveDbcPoolMetadata, deriveDbcTokenVaultAddress, deriveEscrow, deriveLockerEventAuthority, deriveMintMetadata, derivePartnerMetadata, derivePositionAddress, derivePositionNftAccount, deriveTokenVaultKey, deriveVaultAddress, deriveVaultLpMintAddress, deriveVaultPdas, feeNumeratorToBps, findAssociatedTokenAddress, fromDecimalToBN, getAccountCreationTimestamp, getAccountCreationTimestamps, getAccountData, getBaseFeeParams, getBaseTokenForSwap, getCurrentBaseFeeNumerator, getDeltaAmountBase, getDeltaAmountBaseUnsigned, getDeltaAmountQuoteUnsigned, getDynamicFeeParams, getFeeInPeriod, getFeeMode, getFeeOnAmount, getFirstCurve, getFirstKey, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getInitializeAmounts, getLiquidity, getLockedVestingParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeBps, getNextSqrtPriceFromAmountBaseRoundingUp, getNextSqrtPriceFromAmountQuoteRoundingDown, getNextSqrtPriceFromInput, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountFromBaseToQuote, getSwapAmountFromQuoteToBase, getSwapAmountWithBuffer, getSwapResult, getTokenDecimals, getTokenProgram, getTokenType, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFee, isDefaultLockedVesting, isNativeSol, prepareTokenAccountTx, swapQuote, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateLPPercentages, validateMigrationAndTokenType, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
|
|
13465
|
+
export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BuildCurveBaseParam, type BuildCurveParam, type BuildCurveWithLiquidityWeightsParam, type BuildCurveWithMarketCapParam, type BuildCurveWithTwoSegmentsParam, type ClaimCreatorTradingFee2Param, type ClaimCreatorTradingFeeAccounts, type ClaimCreatorTradingFeeParam, type ClaimCreatorTradingFeeWithQuoteMintNotSolParam, type ClaimCreatorTradingFeeWithQuoteMintSolParam, type ClaimFeeOperator, type ClaimPartnerTradingFeeWithQuoteMintNotSolParam, type ClaimPartnerTradingFeeWithQuoteMintSolParam, type ClaimProtocolFeeAccounts, type ClaimTradingFee2Param, type ClaimTradingFeeAccounts, type ClaimTradingFeeParam, type CloseClaimFeeOperatorAccounts, CollectFeeMode, type Config, type ConfigParameters, type CreateClaimFeeOperatorAccounts, type CreateConfigAccounts, type CreateConfigAndPoolParam, type CreateConfigAndPoolWithFirstBuyParam, type CreateConfigParam, type CreateDammV1MigrationMetadataParam, type CreateDammV2MigrationMetadataParam, type CreateLockerAccounts, type CreateLockerParam, type CreatePartnerMetadata, type CreatePartnerMetadataParam, type CreatePartnerMetadataParameters, type CreatePoolParam, type CreatePoolWithFirstBuyParam, type CreateVirtualPoolMetadata, type CreateVirtualPoolMetadataParam, type CreateVirtualPoolMetadataParameters, CreatorService, type CreatorWithdrawSurplusAccounts, type CreatorWithdrawSurplusParam, DAMM_V1_MIGRATION_FEE_ADDRESS, DAMM_V1_PROGRAM_ID, DAMM_V2_MIGRATION_FEE_ADDRESS, DAMM_V2_PROGRAM_ID, DYNAMIC_BONDING_CURVE_PROGRAM_ID, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DammLpTokenParam, DynamicBondingCurveClient, DynamicBondingCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, type FeeResult, FeeSchedulerMode, type FeeSchedulerParams, GetFeeMode, type InitializePoolBaseParam, type InitializePoolParameters, type InitializeVirtualPoolWithSplTokenAccounts, type InitializeVirtualPoolWithToken2022Accounts, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CURVE_POINT, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MAX_SWALLOW_PERCENTAGE, METAPLEX_PROGRAM_ID, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MeteoraDammV2MigrationMetadata, type MigrateMeteoraDammAccounts, type MigrateMeteoraDammClaimLpTokenAccounts, type MigrateMeteoraDammLockLpTokenAccounts, type MigrateToDammV1Param, type MigrateToDammV2Param, type MigrateToDammV2Response, type MigrationDammV2Accounts, type MigrationDammV2CreateMetadataAccounts, MigrationFeeOption, type MigrationMeteoraDammCreateMetadataAccounts, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusAccounts, type PartnerWithdrawSurplusParam, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, type PoolMetrics, PoolService, type PrepareSwapParams, type QuoteResult, RESOLUTION, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, type SwapAccounts, type SwapAmount, type SwapParam, type SwapParameters, type SwapQuoteExactInParam, type SwapQuoteParam, type SwapResult, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorAccounts, type TransferPoolCreatorParam, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverAccounts, type WithdrawLeftoverParam, type WithdrawMigrationFeeParam, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithTwoSegments, calculateQuoteExactInAmount, cleanUpTokenAccountTx, convertDecimalToBN, convertToLamports, createDammV1Program, createDammV2Program, createDbcProgram, createInitializePermissionlessDynamicVaultIx, createLockEscrowIx, createProgramAccountFilter, createVaultProgram, deriveBaseKeyForLocker, deriveDammV1EventAuthority, deriveDammV1LockEscrowAddress, deriveDammV1LpMintAddress, deriveDammV1MigrationMetadataAddress, deriveDammV1PoolAddress, deriveDammV1PoolAuthority, deriveDammV1ProtocolFeeAddress, deriveDammV1VaultLPAddress, deriveDammV2EventAuthority, deriveDammV2LockEscrowAddress, deriveDammV2MigrationMetadataAddress, deriveDammV2PoolAddress, deriveDammV2PoolAuthority, deriveDammV2TokenVaultAddress, deriveDbcEventAuthority, deriveDbcPoolAddress, deriveDbcPoolAuthority, deriveDbcPoolMetadata, deriveDbcTokenVaultAddress, deriveEscrow, deriveLockerEventAuthority, deriveMintMetadata, derivePartnerMetadata, derivePositionAddress, derivePositionNftAccount, deriveTokenVaultKey, deriveVaultAddress, deriveVaultLpMintAddress, deriveVaultPdas, feeNumeratorToBps, findAssociatedTokenAddress, fromDecimalToBN, getAccountCreationTimestamp, getAccountCreationTimestamps, getAccountData, getBaseFeeParams, getBaseTokenForSwap, getCurrentBaseFeeNumerator, getDeltaAmountBase, getDeltaAmountBaseUnsigned, getDeltaAmountQuoteUnsigned, getDynamicFeeParams, getFeeInPeriod, getFeeMode, getFeeOnAmount, getFirstCurve, getFirstKey, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getInitializeAmounts, getLiquidity, getLockedVestingParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeBps, getNextSqrtPriceFromAmountBaseRoundingUp, getNextSqrtPriceFromAmountQuoteRoundingDown, getNextSqrtPriceFromInput, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountFromBaseToQuote, getSwapAmountFromQuoteToBase, getSwapAmountWithBuffer, getSwapResult, getTokenDecimals, getTokenProgram, getTokenType, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFee, isDefaultLockedVesting, isNativeSol, prepareTokenAccountTx, swapQuote, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateLPPercentages, validateMigrationAndTokenType, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
|
package/dist/index.js
CHANGED
|
@@ -21264,6 +21264,39 @@ async function swapQuote(virtualPool, config, swapBaseForQuote, amountIn, slippa
|
|
|
21264
21264
|
}
|
|
21265
21265
|
return result;
|
|
21266
21266
|
}
|
|
21267
|
+
function calculateQuoteExactInAmount(config, virtualPool, currentPoint) {
|
|
21268
|
+
if (virtualPool.quoteReserve.gte(config.migrationQuoteThreshold)) {
|
|
21269
|
+
return new BN10(0);
|
|
21270
|
+
}
|
|
21271
|
+
const amountInAfterFee = config.migrationQuoteThreshold.sub(
|
|
21272
|
+
virtualPool.quoteReserve
|
|
21273
|
+
);
|
|
21274
|
+
if (config.collectFeeMode === 0 /* OnlyQuote */) {
|
|
21275
|
+
const baseFeeNumerator = getCurrentBaseFeeNumerator(
|
|
21276
|
+
config.poolFees.baseFee,
|
|
21277
|
+
currentPoint,
|
|
21278
|
+
virtualPool.activationPoint
|
|
21279
|
+
);
|
|
21280
|
+
let totalFeeNumerator = baseFeeNumerator;
|
|
21281
|
+
if (config.poolFees.dynamicFee.initialized !== 0) {
|
|
21282
|
+
const variableFee = getVariableFee(
|
|
21283
|
+
config.poolFees.dynamicFee,
|
|
21284
|
+
virtualPool.volatilityTracker
|
|
21285
|
+
);
|
|
21286
|
+
totalFeeNumerator = SafeMath.add(totalFeeNumerator, variableFee);
|
|
21287
|
+
}
|
|
21288
|
+
totalFeeNumerator = BN10.min(totalFeeNumerator, new BN10(MAX_FEE_NUMERATOR));
|
|
21289
|
+
const denominator = new BN10(FEE_DENOMINATOR).sub(totalFeeNumerator);
|
|
21290
|
+
return mulDiv(
|
|
21291
|
+
amountInAfterFee,
|
|
21292
|
+
new BN10(FEE_DENOMINATOR),
|
|
21293
|
+
denominator,
|
|
21294
|
+
0 /* Up */
|
|
21295
|
+
);
|
|
21296
|
+
} else {
|
|
21297
|
+
return amountInAfterFee;
|
|
21298
|
+
}
|
|
21299
|
+
}
|
|
21267
21300
|
|
|
21268
21301
|
// src/services/state.ts
|
|
21269
21302
|
import { PublicKey as PublicKey8 } from "@solana/web3.js";
|
|
@@ -22062,6 +22095,17 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
22062
22095
|
currentPoint
|
|
22063
22096
|
);
|
|
22064
22097
|
}
|
|
22098
|
+
swapQuoteExactIn(swapQuoteExactInParam) {
|
|
22099
|
+
const { virtualPool, config, currentPoint } = swapQuoteExactInParam;
|
|
22100
|
+
const requiredQuoteAmount = calculateQuoteExactInAmount(
|
|
22101
|
+
config,
|
|
22102
|
+
virtualPool,
|
|
22103
|
+
currentPoint
|
|
22104
|
+
);
|
|
22105
|
+
return {
|
|
22106
|
+
exactAmountIn: requiredQuoteAmount
|
|
22107
|
+
};
|
|
22108
|
+
}
|
|
22065
22109
|
};
|
|
22066
22110
|
|
|
22067
22111
|
// src/services/migration.ts
|
|
@@ -23525,6 +23569,7 @@ export {
|
|
|
23525
23569
|
buildCurveWithLiquidityWeights,
|
|
23526
23570
|
buildCurveWithMarketCap,
|
|
23527
23571
|
buildCurveWithTwoSegments,
|
|
23572
|
+
calculateQuoteExactInAmount,
|
|
23528
23573
|
cleanUpTokenAccountTx,
|
|
23529
23574
|
convertDecimalToBN,
|
|
23530
23575
|
convertToLamports,
|