@meteora-ag/dynamic-bonding-curve-sdk 1.4.6-rc.1 → 1.4.6-rc.2

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.cts CHANGED
@@ -5560,6 +5560,12 @@ type BuildCurveWithTwoSegmentsParams = BuildCurveBaseParams & {
5560
5560
  migrationMarketCap: number;
5561
5561
  percentageSupplyOnMigration: number;
5562
5562
  };
5563
+ type BuildCurveWithMidPriceParams = BuildCurveBaseParams & {
5564
+ initialMarketCap: number;
5565
+ migrationMarketCap: number;
5566
+ midPrice: number;
5567
+ percentageSupplyOnMigration: number;
5568
+ };
5563
5569
  type BuildCurveWithLiquidityWeightsParams = BuildCurveBaseParams & {
5564
5570
  initialMarketCap: number;
5565
5571
  migrationMarketCap: number;
@@ -7244,6 +7250,12 @@ declare function buildCurveWithMarketCap(buildCurveWithMarketCapParam: BuildCurv
7244
7250
  * @returns The build custom constant product curve by market cap
7245
7251
  */
7246
7252
  declare function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam: BuildCurveWithTwoSegmentsParams): ConfigParameters;
7253
+ /**
7254
+ * Build a custom constant product curve with a mid price. This will create a two segment curve with a start price -> mid price, and a mid price -> migration price.
7255
+ * @param buildCurveWithMidPriceParam - The parameters for the custom constant product curve with a mid price
7256
+ * @returns The build custom constant product curve by mid price
7257
+ */
7258
+ declare function buildCurveWithMidPrice(buildCurveWithMidPriceParam: BuildCurveWithMidPriceParams): ConfigParameters;
7247
7259
  /**
7248
7260
  * Build a custom curve graph with liquidity weights, changing the curve shape based on the liquidity weights
7249
7261
  * @param buildCurveWithLiquidityWeightsParam - The parameters for the custom constant product curve with liquidity weights
@@ -21662,4 +21674,4 @@ var idl = {
21662
21674
  types: types
21663
21675
  };
21664
21676
 
21665
- export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BaseFeeHandler, BaseFeeMode, type BaseFeeParams, type BuildCurveBaseParams, type BuildCurveParams, type BuildCurveWithLiquidityWeightsParams, type BuildCurveWithMarketCapParams, type BuildCurveWithTwoSegmentsParams, type ClaimCreatorTradingFee2Params, type ClaimCreatorTradingFeeParams, type ClaimCreatorTradingFeeWithQuoteMintNotSolParams, type ClaimCreatorTradingFeeWithQuoteMintSolParams, type ClaimPartnerTradingFeeWithQuoteMintNotSolParams, type ClaimPartnerTradingFeeWithQuoteMintSolParams, type ClaimTradingFee2Params, type ClaimTradingFeeParams, CollectFeeMode, type ConfigParameters, type CreateConfigAccounts, type CreateConfigAndPoolParams, type CreateConfigAndPoolWithFirstBuyParams, type CreateConfigParams, type CreateDammV1MigrationMetadataParams, type CreateLockerParams, type CreatePartnerMetadataParameters, type CreatePartnerMetadataParams, type CreatePoolParams, type CreatePoolWithFirstBuyParams, type CreatePoolWithPartnerAndCreatorFirstBuyParams, type CreateVirtualPoolMetadataParams, type CreatorFirstBuyParams, CreatorService, type CreatorWithdrawSurplusParams, 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, DYNAMIC_FEE_ROUNDING_OFFSET, DYNAMIC_FEE_SCALING_FACTOR, type DammLpTokenParams, DammV2DynamicFeeMode, DynamicBondingCurveClient, idl as DynamicBondingCurveIdl, DynamicBondingCurveProgram, type DynamicBondingCurve as DynamicBondingCurveTypes, type DynamicCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, FeeRateLimiter, type FeeResult, FeeScheduler, type FeeSchedulerParams, type FirstBuyParams, type InitializePoolBaseParams, type InitializePoolParameters, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CREATOR_MIGRATION_FEE_PERCENTAGE, MAX_CURVE_POINT, MAX_DYNAMIC_FEE_PERCENTAGE, MAX_FEE_BPS, MAX_FEE_NUMERATOR, MAX_MIGRATED_POOL_FEE_BPS, MAX_MIGRATION_FEE_PERCENTAGE, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_RATE_LIMITER_DURATION_IN_SECONDS, MAX_RATE_LIMITER_DURATION_IN_SLOTS, MAX_SQRT_PRICE, METAPLEX_PROGRAM_ID, MIN_FEE_BPS, MIN_FEE_NUMERATOR, MIN_MIGRATED_POOL_FEE_BPS, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MigrateToDammV1Params, type MigrateToDammV2Params, type MigrateToDammV2Response, type MigratedPoolFee, MigrationFeeOption, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerFirstBuyParams, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusParams, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, PoolService, type PreCreatePoolParams, type PrepareSwapParams, RESOLUTION, type RateLimiterParams, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, SafeMath, StateService, type Swap2Params, type SwapAmount, SwapMode, type SwapParams, type SwapQuote2Params, type SwapQuote2Result, type SwapQuoteParams, type SwapQuoteResult, type SwapResult, type SwapResult2, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorParams, U128_MAX, U16_MAX, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverParams, type WithdrawMigrationFeeParams, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithTwoSegments, calculateBaseToQuoteFromAmountIn, calculateBaseToQuoteFromAmountOut, calculateFeeSchedulerEndingBaseFeeBps, calculateQuoteToBaseFromAmountIn, calculateQuoteToBaseFromAmountOut, checkRateLimiterApplied, 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, getBaseFeeHandler, getBaseFeeNumerator, getBaseFeeNumeratorByPeriod, getBaseFeeParams, getBaseTokenForSwap, getCheckedAmounts, getCurrentPoint, getDeltaAmountBaseUnsigned, getDeltaAmountBaseUnsigned256, getDeltaAmountBaseUnsignedUnchecked, getDeltaAmountQuoteUnsigned, getDeltaAmountQuoteUnsigned256, getDeltaAmountQuoteUnsignedUnchecked, getDynamicFeeParams, getExcludedFeeAmount, getFeeMode, getFeeNumeratorFromExcludedAmount, getFeeNumeratorFromIncludedAmount, getFeeNumeratorOnExponentialFeeScheduler, getFeeNumeratorOnLinearFeeScheduler, getFeeOnAmount, getFeeSchedulerParams, getFirstCurve, getFirstKey, getIncludedFeeAmount, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getLiquidity, getLockedVestingParams, getMaxBaseFeeNumerator, getMaxIndex, getMaxOutAmountWithMinBaseFee, getMigratedPoolFeeParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeNumerator, getNextSqrtPriceFromBaseAmountInRoundingUp, getNextSqrtPriceFromBaseAmountOutRoundingUp, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getNextSqrtPriceFromQuoteAmountInRoundingDown, getNextSqrtPriceFromQuoteAmountOutRoundingDown, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getQuoteReserveFromNextSqrtPrice, getRateLimiterExcludedFeeAmount, getRateLimiterParams, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountWithBuffer, getSwapResult, getSwapResultFromExactInput, getSwapResultFromExactOutput, getSwapResultFromPartialInput, getTokenDecimals, getTokenProgram, getTokenType, getTokenomics, getTotalFeeNumerator, getTotalFeeNumeratorFromExcludedFeeAmount, getTotalFeeNumeratorFromIncludedFeeAmount, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFeeNumerator, isDefaultLockedVesting, isDynamicFeeEnabled, isNativeSol, isNonZeroRateLimiter, isRateLimiterApplied, isZeroRateLimiter, mulDiv, mulShr, pow, prepareSwapAmountParam, prepareTokenAccountTx, splitFees, sqrt, swapQuote, swapQuoteExactIn, swapQuoteExactOut, swapQuotePartialFill, toNumerator, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateFeeRateLimiter, validateFeeScheduler, validateLPPercentages, validateMigratedPoolFee, validateMigrationAndTokenType, validateMigrationFee, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
21677
+ export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BaseFeeHandler, BaseFeeMode, type BaseFeeParams, type BuildCurveBaseParams, type BuildCurveParams, type BuildCurveWithLiquidityWeightsParams, type BuildCurveWithMarketCapParams, type BuildCurveWithMidPriceParams, type BuildCurveWithTwoSegmentsParams, type ClaimCreatorTradingFee2Params, type ClaimCreatorTradingFeeParams, type ClaimCreatorTradingFeeWithQuoteMintNotSolParams, type ClaimCreatorTradingFeeWithQuoteMintSolParams, type ClaimPartnerTradingFeeWithQuoteMintNotSolParams, type ClaimPartnerTradingFeeWithQuoteMintSolParams, type ClaimTradingFee2Params, type ClaimTradingFeeParams, CollectFeeMode, type ConfigParameters, type CreateConfigAccounts, type CreateConfigAndPoolParams, type CreateConfigAndPoolWithFirstBuyParams, type CreateConfigParams, type CreateDammV1MigrationMetadataParams, type CreateLockerParams, type CreatePartnerMetadataParameters, type CreatePartnerMetadataParams, type CreatePoolParams, type CreatePoolWithFirstBuyParams, type CreatePoolWithPartnerAndCreatorFirstBuyParams, type CreateVirtualPoolMetadataParams, type CreatorFirstBuyParams, CreatorService, type CreatorWithdrawSurplusParams, 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, DYNAMIC_FEE_ROUNDING_OFFSET, DYNAMIC_FEE_SCALING_FACTOR, type DammLpTokenParams, DammV2DynamicFeeMode, DynamicBondingCurveClient, idl as DynamicBondingCurveIdl, DynamicBondingCurveProgram, type DynamicBondingCurve as DynamicBondingCurveTypes, type DynamicCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, FeeRateLimiter, type FeeResult, FeeScheduler, type FeeSchedulerParams, type FirstBuyParams, type InitializePoolBaseParams, type InitializePoolParameters, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CREATOR_MIGRATION_FEE_PERCENTAGE, MAX_CURVE_POINT, MAX_DYNAMIC_FEE_PERCENTAGE, MAX_FEE_BPS, MAX_FEE_NUMERATOR, MAX_MIGRATED_POOL_FEE_BPS, MAX_MIGRATION_FEE_PERCENTAGE, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_RATE_LIMITER_DURATION_IN_SECONDS, MAX_RATE_LIMITER_DURATION_IN_SLOTS, MAX_SQRT_PRICE, METAPLEX_PROGRAM_ID, MIN_FEE_BPS, MIN_FEE_NUMERATOR, MIN_MIGRATED_POOL_FEE_BPS, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MigrateToDammV1Params, type MigrateToDammV2Params, type MigrateToDammV2Response, type MigratedPoolFee, MigrationFeeOption, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerFirstBuyParams, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusParams, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, PoolService, type PreCreatePoolParams, type PrepareSwapParams, RESOLUTION, type RateLimiterParams, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, SafeMath, StateService, type Swap2Params, type SwapAmount, SwapMode, type SwapParams, type SwapQuote2Params, type SwapQuote2Result, type SwapQuoteParams, type SwapQuoteResult, type SwapResult, type SwapResult2, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorParams, U128_MAX, U16_MAX, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverParams, type WithdrawMigrationFeeParams, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithMidPrice, buildCurveWithTwoSegments, calculateBaseToQuoteFromAmountIn, calculateBaseToQuoteFromAmountOut, calculateFeeSchedulerEndingBaseFeeBps, calculateQuoteToBaseFromAmountIn, calculateQuoteToBaseFromAmountOut, checkRateLimiterApplied, 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, getBaseFeeHandler, getBaseFeeNumerator, getBaseFeeNumeratorByPeriod, getBaseFeeParams, getBaseTokenForSwap, getCheckedAmounts, getCurrentPoint, getDeltaAmountBaseUnsigned, getDeltaAmountBaseUnsigned256, getDeltaAmountBaseUnsignedUnchecked, getDeltaAmountQuoteUnsigned, getDeltaAmountQuoteUnsigned256, getDeltaAmountQuoteUnsignedUnchecked, getDynamicFeeParams, getExcludedFeeAmount, getFeeMode, getFeeNumeratorFromExcludedAmount, getFeeNumeratorFromIncludedAmount, getFeeNumeratorOnExponentialFeeScheduler, getFeeNumeratorOnLinearFeeScheduler, getFeeOnAmount, getFeeSchedulerParams, getFirstCurve, getFirstKey, getIncludedFeeAmount, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getLiquidity, getLockedVestingParams, getMaxBaseFeeNumerator, getMaxIndex, getMaxOutAmountWithMinBaseFee, getMigratedPoolFeeParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeNumerator, getNextSqrtPriceFromBaseAmountInRoundingUp, getNextSqrtPriceFromBaseAmountOutRoundingUp, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getNextSqrtPriceFromQuoteAmountInRoundingDown, getNextSqrtPriceFromQuoteAmountOutRoundingDown, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getQuoteReserveFromNextSqrtPrice, getRateLimiterExcludedFeeAmount, getRateLimiterParams, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountWithBuffer, getSwapResult, getSwapResultFromExactInput, getSwapResultFromExactOutput, getSwapResultFromPartialInput, getTokenDecimals, getTokenProgram, getTokenType, getTokenomics, getTotalFeeNumerator, getTotalFeeNumeratorFromExcludedFeeAmount, getTotalFeeNumeratorFromIncludedFeeAmount, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFeeNumerator, isDefaultLockedVesting, isDynamicFeeEnabled, isNativeSol, isNonZeroRateLimiter, isRateLimiterApplied, isZeroRateLimiter, mulDiv, mulShr, pow, prepareSwapAmountParam, prepareTokenAccountTx, splitFees, sqrt, swapQuote, swapQuoteExactIn, swapQuoteExactOut, swapQuotePartialFill, toNumerator, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateFeeRateLimiter, validateFeeScheduler, validateLPPercentages, validateMigratedPoolFee, validateMigrationAndTokenType, validateMigrationFee, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
package/dist/index.d.ts CHANGED
@@ -5560,6 +5560,12 @@ type BuildCurveWithTwoSegmentsParams = BuildCurveBaseParams & {
5560
5560
  migrationMarketCap: number;
5561
5561
  percentageSupplyOnMigration: number;
5562
5562
  };
5563
+ type BuildCurveWithMidPriceParams = BuildCurveBaseParams & {
5564
+ initialMarketCap: number;
5565
+ migrationMarketCap: number;
5566
+ midPrice: number;
5567
+ percentageSupplyOnMigration: number;
5568
+ };
5563
5569
  type BuildCurveWithLiquidityWeightsParams = BuildCurveBaseParams & {
5564
5570
  initialMarketCap: number;
5565
5571
  migrationMarketCap: number;
@@ -7244,6 +7250,12 @@ declare function buildCurveWithMarketCap(buildCurveWithMarketCapParam: BuildCurv
7244
7250
  * @returns The build custom constant product curve by market cap
7245
7251
  */
7246
7252
  declare function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam: BuildCurveWithTwoSegmentsParams): ConfigParameters;
7253
+ /**
7254
+ * Build a custom constant product curve with a mid price. This will create a two segment curve with a start price -> mid price, and a mid price -> migration price.
7255
+ * @param buildCurveWithMidPriceParam - The parameters for the custom constant product curve with a mid price
7256
+ * @returns The build custom constant product curve by mid price
7257
+ */
7258
+ declare function buildCurveWithMidPrice(buildCurveWithMidPriceParam: BuildCurveWithMidPriceParams): ConfigParameters;
7247
7259
  /**
7248
7260
  * Build a custom curve graph with liquidity weights, changing the curve shape based on the liquidity weights
7249
7261
  * @param buildCurveWithLiquidityWeightsParam - The parameters for the custom constant product curve with liquidity weights
@@ -21662,4 +21674,4 @@ var idl = {
21662
21674
  types: types
21663
21675
  };
21664
21676
 
21665
- export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BaseFeeHandler, BaseFeeMode, type BaseFeeParams, type BuildCurveBaseParams, type BuildCurveParams, type BuildCurveWithLiquidityWeightsParams, type BuildCurveWithMarketCapParams, type BuildCurveWithTwoSegmentsParams, type ClaimCreatorTradingFee2Params, type ClaimCreatorTradingFeeParams, type ClaimCreatorTradingFeeWithQuoteMintNotSolParams, type ClaimCreatorTradingFeeWithQuoteMintSolParams, type ClaimPartnerTradingFeeWithQuoteMintNotSolParams, type ClaimPartnerTradingFeeWithQuoteMintSolParams, type ClaimTradingFee2Params, type ClaimTradingFeeParams, CollectFeeMode, type ConfigParameters, type CreateConfigAccounts, type CreateConfigAndPoolParams, type CreateConfigAndPoolWithFirstBuyParams, type CreateConfigParams, type CreateDammV1MigrationMetadataParams, type CreateLockerParams, type CreatePartnerMetadataParameters, type CreatePartnerMetadataParams, type CreatePoolParams, type CreatePoolWithFirstBuyParams, type CreatePoolWithPartnerAndCreatorFirstBuyParams, type CreateVirtualPoolMetadataParams, type CreatorFirstBuyParams, CreatorService, type CreatorWithdrawSurplusParams, 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, DYNAMIC_FEE_ROUNDING_OFFSET, DYNAMIC_FEE_SCALING_FACTOR, type DammLpTokenParams, DammV2DynamicFeeMode, DynamicBondingCurveClient, idl as DynamicBondingCurveIdl, DynamicBondingCurveProgram, type DynamicBondingCurve as DynamicBondingCurveTypes, type DynamicCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, FeeRateLimiter, type FeeResult, FeeScheduler, type FeeSchedulerParams, type FirstBuyParams, type InitializePoolBaseParams, type InitializePoolParameters, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CREATOR_MIGRATION_FEE_PERCENTAGE, MAX_CURVE_POINT, MAX_DYNAMIC_FEE_PERCENTAGE, MAX_FEE_BPS, MAX_FEE_NUMERATOR, MAX_MIGRATED_POOL_FEE_BPS, MAX_MIGRATION_FEE_PERCENTAGE, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_RATE_LIMITER_DURATION_IN_SECONDS, MAX_RATE_LIMITER_DURATION_IN_SLOTS, MAX_SQRT_PRICE, METAPLEX_PROGRAM_ID, MIN_FEE_BPS, MIN_FEE_NUMERATOR, MIN_MIGRATED_POOL_FEE_BPS, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MigrateToDammV1Params, type MigrateToDammV2Params, type MigrateToDammV2Response, type MigratedPoolFee, MigrationFeeOption, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerFirstBuyParams, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusParams, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, PoolService, type PreCreatePoolParams, type PrepareSwapParams, RESOLUTION, type RateLimiterParams, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, SafeMath, StateService, type Swap2Params, type SwapAmount, SwapMode, type SwapParams, type SwapQuote2Params, type SwapQuote2Result, type SwapQuoteParams, type SwapQuoteResult, type SwapResult, type SwapResult2, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorParams, U128_MAX, U16_MAX, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverParams, type WithdrawMigrationFeeParams, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithTwoSegments, calculateBaseToQuoteFromAmountIn, calculateBaseToQuoteFromAmountOut, calculateFeeSchedulerEndingBaseFeeBps, calculateQuoteToBaseFromAmountIn, calculateQuoteToBaseFromAmountOut, checkRateLimiterApplied, 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, getBaseFeeHandler, getBaseFeeNumerator, getBaseFeeNumeratorByPeriod, getBaseFeeParams, getBaseTokenForSwap, getCheckedAmounts, getCurrentPoint, getDeltaAmountBaseUnsigned, getDeltaAmountBaseUnsigned256, getDeltaAmountBaseUnsignedUnchecked, getDeltaAmountQuoteUnsigned, getDeltaAmountQuoteUnsigned256, getDeltaAmountQuoteUnsignedUnchecked, getDynamicFeeParams, getExcludedFeeAmount, getFeeMode, getFeeNumeratorFromExcludedAmount, getFeeNumeratorFromIncludedAmount, getFeeNumeratorOnExponentialFeeScheduler, getFeeNumeratorOnLinearFeeScheduler, getFeeOnAmount, getFeeSchedulerParams, getFirstCurve, getFirstKey, getIncludedFeeAmount, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getLiquidity, getLockedVestingParams, getMaxBaseFeeNumerator, getMaxIndex, getMaxOutAmountWithMinBaseFee, getMigratedPoolFeeParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeNumerator, getNextSqrtPriceFromBaseAmountInRoundingUp, getNextSqrtPriceFromBaseAmountOutRoundingUp, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getNextSqrtPriceFromQuoteAmountInRoundingDown, getNextSqrtPriceFromQuoteAmountOutRoundingDown, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getQuoteReserveFromNextSqrtPrice, getRateLimiterExcludedFeeAmount, getRateLimiterParams, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountWithBuffer, getSwapResult, getSwapResultFromExactInput, getSwapResultFromExactOutput, getSwapResultFromPartialInput, getTokenDecimals, getTokenProgram, getTokenType, getTokenomics, getTotalFeeNumerator, getTotalFeeNumeratorFromExcludedFeeAmount, getTotalFeeNumeratorFromIncludedFeeAmount, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFeeNumerator, isDefaultLockedVesting, isDynamicFeeEnabled, isNativeSol, isNonZeroRateLimiter, isRateLimiterApplied, isZeroRateLimiter, mulDiv, mulShr, pow, prepareSwapAmountParam, prepareTokenAccountTx, splitFees, sqrt, swapQuote, swapQuoteExactIn, swapQuoteExactOut, swapQuotePartialFill, toNumerator, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateFeeRateLimiter, validateFeeScheduler, validateLPPercentages, validateMigratedPoolFee, validateMigrationAndTokenType, validateMigrationFee, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
21677
+ export { ActivationType, BASE_ADDRESS, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BaseFeeConfig, type BaseFeeHandler, BaseFeeMode, type BaseFeeParams, type BuildCurveBaseParams, type BuildCurveParams, type BuildCurveWithLiquidityWeightsParams, type BuildCurveWithMarketCapParams, type BuildCurveWithMidPriceParams, type BuildCurveWithTwoSegmentsParams, type ClaimCreatorTradingFee2Params, type ClaimCreatorTradingFeeParams, type ClaimCreatorTradingFeeWithQuoteMintNotSolParams, type ClaimCreatorTradingFeeWithQuoteMintSolParams, type ClaimPartnerTradingFeeWithQuoteMintNotSolParams, type ClaimPartnerTradingFeeWithQuoteMintSolParams, type ClaimTradingFee2Params, type ClaimTradingFeeParams, CollectFeeMode, type ConfigParameters, type CreateConfigAccounts, type CreateConfigAndPoolParams, type CreateConfigAndPoolWithFirstBuyParams, type CreateConfigParams, type CreateDammV1MigrationMetadataParams, type CreateLockerParams, type CreatePartnerMetadataParameters, type CreatePartnerMetadataParams, type CreatePoolParams, type CreatePoolWithFirstBuyParams, type CreatePoolWithPartnerAndCreatorFirstBuyParams, type CreateVirtualPoolMetadataParams, type CreatorFirstBuyParams, CreatorService, type CreatorWithdrawSurplusParams, 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, DYNAMIC_FEE_ROUNDING_OFFSET, DYNAMIC_FEE_SCALING_FACTOR, type DammLpTokenParams, DammV2DynamicFeeMode, DynamicBondingCurveClient, idl as DynamicBondingCurveIdl, DynamicBondingCurveProgram, type DynamicBondingCurve as DynamicBondingCurveTypes, type DynamicCurveProgram, type DynamicFeeConfig, type DynamicFeeParameters, FEE_DENOMINATOR, type FeeMode, type FeeOnAmountResult, FeeRateLimiter, type FeeResult, FeeScheduler, type FeeSchedulerParams, type FirstBuyParams, type InitializePoolBaseParams, type InitializePoolParameters, LOCKER_PROGRAM_ID, type LiquidityDistributionParameters, type LockEscrow, type LockedVestingParameters, type LockedVestingParams, MAX_CREATOR_MIGRATION_FEE_PERCENTAGE, MAX_CURVE_POINT, MAX_DYNAMIC_FEE_PERCENTAGE, MAX_FEE_BPS, MAX_FEE_NUMERATOR, MAX_MIGRATED_POOL_FEE_BPS, MAX_MIGRATION_FEE_PERCENTAGE, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_RATE_LIMITER_DURATION_IN_SECONDS, MAX_RATE_LIMITER_DURATION_IN_SLOTS, MAX_SQRT_PRICE, METAPLEX_PROGRAM_ID, MIN_FEE_BPS, MIN_FEE_NUMERATOR, MIN_MIGRATED_POOL_FEE_BPS, MIN_SQRT_PRICE, type MeteoraDammMigrationMetadata, type MigrateToDammV1Params, type MigrateToDammV2Params, type MigrateToDammV2Response, type MigratedPoolFee, MigrationFeeOption, MigrationOption, MigrationService, OFFSET, ONE_Q64, PARTNER_SURPLUS_SHARE, type PartnerFirstBuyParams, type PartnerMetadata, PartnerService, type PartnerWithdrawSurplusParams, type PoolConfig, type PoolFeeParameters, type PoolFees, type PoolFeesConfig, PoolService, type PreCreatePoolParams, type PrepareSwapParams, RESOLUTION, type RateLimiterParams, Rounding, SLOT_DURATION, SWAP_BUFFER_PERCENTAGE, SafeMath, StateService, type Swap2Params, type SwapAmount, SwapMode, type SwapParams, type SwapQuote2Params, type SwapQuote2Result, type SwapQuoteParams, type SwapQuoteResult, type SwapResult, type SwapResult2, TIMESTAMP_DURATION, TokenDecimal, TokenType, TokenUpdateAuthorityOption, TradeDirection, type TransferPoolCreatorParams, U128_MAX, U16_MAX, U64_MAX, VAULT_PROGRAM_ID, type VirtualPool, type VirtualPoolMetadata, type VolatilityTracker, type WithdrawLeftoverParams, type WithdrawMigrationFeeParams, bpsToFeeNumerator, buildCurve, buildCurveWithLiquidityWeights, buildCurveWithMarketCap, buildCurveWithMidPrice, buildCurveWithTwoSegments, calculateBaseToQuoteFromAmountIn, calculateBaseToQuoteFromAmountOut, calculateFeeSchedulerEndingBaseFeeBps, calculateQuoteToBaseFromAmountIn, calculateQuoteToBaseFromAmountOut, checkRateLimiterApplied, 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, getBaseFeeHandler, getBaseFeeNumerator, getBaseFeeNumeratorByPeriod, getBaseFeeParams, getBaseTokenForSwap, getCheckedAmounts, getCurrentPoint, getDeltaAmountBaseUnsigned, getDeltaAmountBaseUnsigned256, getDeltaAmountBaseUnsignedUnchecked, getDeltaAmountQuoteUnsigned, getDeltaAmountQuoteUnsigned256, getDeltaAmountQuoteUnsignedUnchecked, getDynamicFeeParams, getExcludedFeeAmount, getFeeMode, getFeeNumeratorFromExcludedAmount, getFeeNumeratorFromIncludedAmount, getFeeNumeratorOnExponentialFeeScheduler, getFeeNumeratorOnLinearFeeScheduler, getFeeOnAmount, getFeeSchedulerParams, getFirstCurve, getFirstKey, getIncludedFeeAmount, getInitialLiquidityFromDeltaBase, getInitialLiquidityFromDeltaQuote, getLiquidity, getLockedVestingParams, getMaxBaseFeeNumerator, getMaxIndex, getMaxOutAmountWithMinBaseFee, getMigratedPoolFeeParams, getMigrationBaseToken, getMigrationQuoteAmount, getMigrationQuoteAmountFromMigrationQuoteThreshold, getMigrationQuoteThresholdFromMigrationQuoteAmount, getMigrationThresholdPrice, getMinBaseFeeNumerator, getNextSqrtPriceFromBaseAmountInRoundingUp, getNextSqrtPriceFromBaseAmountOutRoundingUp, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getNextSqrtPriceFromQuoteAmountInRoundingDown, getNextSqrtPriceFromQuoteAmountOutRoundingDown, getOrCreateATAInstruction, getPercentageSupplyOnMigration, getPriceFromSqrtPrice, getQuoteReserveFromNextSqrtPrice, getRateLimiterExcludedFeeAmount, getRateLimiterParams, getSecondKey, getSqrtPriceFromMarketCap, getSqrtPriceFromPrice, getSwapAmountWithBuffer, getSwapResult, getSwapResultFromExactInput, getSwapResultFromExactOutput, getSwapResultFromPartialInput, getTokenDecimals, getTokenProgram, getTokenType, getTokenomics, getTotalFeeNumerator, getTotalFeeNumeratorFromExcludedFeeAmount, getTotalFeeNumeratorFromIncludedFeeAmount, getTotalSupplyFromCurve, getTotalTokenSupply, getTotalVestingAmount, getTwoCurve, getVariableFeeNumerator, isDefaultLockedVesting, isDynamicFeeEnabled, isNativeSol, isNonZeroRateLimiter, isRateLimiterApplied, isZeroRateLimiter, mulDiv, mulShr, pow, prepareSwapAmountParam, prepareTokenAccountTx, splitFees, sqrt, swapQuote, swapQuoteExactIn, swapQuoteExactOut, swapQuotePartialFill, toNumerator, unwrapSOLInstruction, validateActivationType, validateBalance, validateBaseTokenType, validateCollectFeeMode, validateConfigParameters, validateCurve, validateFeeRateLimiter, validateFeeScheduler, validateLPPercentages, validateMigratedPoolFee, validateMigrationAndTokenType, validateMigrationFee, validateMigrationFeeOption, validatePoolFees, validateSwapAmount, validateTokenDecimals, validateTokenSupply, validateTokenUpdateAuthorityOptions, wrapSOLInstruction };
package/dist/index.js CHANGED
@@ -3532,7 +3532,7 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
3532
3532
  let product2 = numerator3.mul(numerator4);
3533
3533
  let midSqrtPriceDecimal3 = Decimal4.pow(product2, 0.25);
3534
3534
  let midSqrtPrice3 = new BN14(midSqrtPriceDecimal3.floor().toFixed());
3535
- let midPrices = [midSqrtPrice1, midSqrtPrice2, midSqrtPrice3];
3535
+ let midPrices = [midSqrtPrice3, midSqrtPrice2, midSqrtPrice1];
3536
3536
  let sqrtStartPrice = new BN14(0);
3537
3537
  let curve = [];
3538
3538
  for (let i = 0; i < midPrices.length; i++) {
@@ -3603,6 +3603,165 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
3603
3603
  };
3604
3604
  return instructionParams;
3605
3605
  }
3606
+ function buildCurveWithMidPrice(buildCurveWithMidPriceParam) {
3607
+ const {
3608
+ totalTokenSupply,
3609
+ initialMarketCap,
3610
+ migrationMarketCap,
3611
+ midPrice,
3612
+ percentageSupplyOnMigration,
3613
+ migrationOption,
3614
+ tokenBaseDecimal,
3615
+ tokenQuoteDecimal,
3616
+ creatorTradingFeePercentage,
3617
+ collectFeeMode,
3618
+ leftover,
3619
+ tokenType,
3620
+ partnerLpPercentage,
3621
+ creatorLpPercentage,
3622
+ partnerLockedLpPercentage,
3623
+ creatorLockedLpPercentage,
3624
+ activationType,
3625
+ dynamicFeeEnabled,
3626
+ migrationFeeOption,
3627
+ migrationFee,
3628
+ tokenUpdateAuthority,
3629
+ baseFeeParams,
3630
+ migratedPoolFee
3631
+ } = buildCurveWithMidPriceParam;
3632
+ const baseFee = getBaseFeeParams(
3633
+ baseFeeParams,
3634
+ tokenQuoteDecimal,
3635
+ activationType
3636
+ );
3637
+ const {
3638
+ totalLockedVestingAmount,
3639
+ numberOfVestingPeriod,
3640
+ cliffUnlockAmount,
3641
+ totalVestingDuration,
3642
+ cliffDurationFromMigrationTime
3643
+ } = buildCurveWithMidPriceParam.lockedVestingParam;
3644
+ const lockedVesting = getLockedVestingParams(
3645
+ totalLockedVestingAmount,
3646
+ numberOfVestingPeriod,
3647
+ cliffUnlockAmount,
3648
+ totalVestingDuration,
3649
+ cliffDurationFromMigrationTime,
3650
+ tokenBaseDecimal
3651
+ );
3652
+ const migratedPoolFeeParams = getMigratedPoolFeeParams(
3653
+ migrationOption,
3654
+ migrationFeeOption,
3655
+ migratedPoolFee
3656
+ );
3657
+ let migrationBaseSupply = new BN14(totalTokenSupply).mul(new BN14(percentageSupplyOnMigration)).div(new BN14(100));
3658
+ let totalSupply = convertToLamports(totalTokenSupply, tokenBaseDecimal);
3659
+ let migrationQuoteAmount = getMigrationQuoteAmount(
3660
+ new Decimal4(migrationMarketCap),
3661
+ new Decimal4(percentageSupplyOnMigration)
3662
+ );
3663
+ let migrationQuoteThreshold = getMigrationQuoteThresholdFromMigrationQuoteAmount(
3664
+ migrationQuoteAmount,
3665
+ new Decimal4(migrationFee.feePercentage)
3666
+ );
3667
+ let migrationPrice = migrationQuoteAmount.div(
3668
+ new Decimal4(migrationBaseSupply.toString())
3669
+ );
3670
+ let migrationQuoteThresholdInLamport = fromDecimalToBN(
3671
+ migrationQuoteThreshold.mul(new Decimal4(10 ** tokenQuoteDecimal))
3672
+ );
3673
+ let migrationQuoteAmountInLamport = fromDecimalToBN(
3674
+ migrationQuoteAmount.mul(new Decimal4(10 ** tokenQuoteDecimal))
3675
+ );
3676
+ let migrateSqrtPrice = getSqrtPriceFromPrice(
3677
+ migrationPrice.toString(),
3678
+ tokenBaseDecimal,
3679
+ tokenQuoteDecimal
3680
+ );
3681
+ let migrationBaseAmount = getMigrationBaseToken(
3682
+ migrationQuoteAmountInLamport,
3683
+ migrateSqrtPrice,
3684
+ migrationOption
3685
+ );
3686
+ let totalVestingAmount = getTotalVestingAmount(lockedVesting);
3687
+ let totalLeftover = convertToLamports(leftover, tokenBaseDecimal);
3688
+ let swapAmount = totalSupply.sub(migrationBaseAmount).sub(totalVestingAmount).sub(totalLeftover);
3689
+ let initialSqrtPrice = getSqrtPriceFromMarketCap(
3690
+ initialMarketCap,
3691
+ totalTokenSupply,
3692
+ tokenBaseDecimal,
3693
+ tokenQuoteDecimal
3694
+ );
3695
+ const midSqrtPrice = getSqrtPriceFromPrice(
3696
+ midPrice.toString(),
3697
+ tokenBaseDecimal,
3698
+ tokenQuoteDecimal
3699
+ );
3700
+ let sqrtStartPrice = new BN14(0);
3701
+ let curve = [];
3702
+ const result = getTwoCurve(
3703
+ migrateSqrtPrice,
3704
+ midSqrtPrice,
3705
+ initialSqrtPrice,
3706
+ swapAmount,
3707
+ migrationQuoteThresholdInLamport
3708
+ );
3709
+ curve = result.curve;
3710
+ sqrtStartPrice = result.sqrtStartPrice;
3711
+ let totalDynamicSupply = getTotalSupplyFromCurve(
3712
+ migrationQuoteThresholdInLamport,
3713
+ sqrtStartPrice,
3714
+ curve,
3715
+ lockedVesting,
3716
+ migrationOption,
3717
+ totalLeftover,
3718
+ migrationFee.feePercentage
3719
+ );
3720
+ if (totalDynamicSupply.gt(totalSupply)) {
3721
+ let leftOverDelta = totalDynamicSupply.sub(totalSupply);
3722
+ if (!leftOverDelta.lt(totalLeftover)) {
3723
+ throw new Error("leftOverDelta must be less than totalLeftover");
3724
+ }
3725
+ }
3726
+ const instructionParams = {
3727
+ poolFees: {
3728
+ baseFee: {
3729
+ ...baseFee
3730
+ },
3731
+ dynamicFee: dynamicFeeEnabled ? getDynamicFeeParams(
3732
+ baseFeeParams.baseFeeMode === 2 /* RateLimiter */ ? baseFeeParams.rateLimiterParam.baseFeeBps : baseFeeParams.feeSchedulerParam.endingFeeBps
3733
+ ) : null
3734
+ },
3735
+ activationType,
3736
+ collectFeeMode,
3737
+ migrationOption,
3738
+ tokenType,
3739
+ tokenDecimal: tokenBaseDecimal,
3740
+ migrationQuoteThreshold: migrationQuoteThresholdInLamport,
3741
+ partnerLpPercentage,
3742
+ creatorLpPercentage,
3743
+ partnerLockedLpPercentage,
3744
+ creatorLockedLpPercentage,
3745
+ sqrtStartPrice,
3746
+ lockedVesting,
3747
+ migrationFeeOption,
3748
+ tokenSupply: {
3749
+ preMigrationTokenSupply: totalSupply,
3750
+ postMigrationTokenSupply: totalSupply
3751
+ },
3752
+ creatorTradingFeePercentage,
3753
+ migratedPoolFee: {
3754
+ collectFeeMode: migratedPoolFeeParams.collectFeeMode,
3755
+ dynamicFee: migratedPoolFeeParams.dynamicFee,
3756
+ poolFeeBps: migratedPoolFeeParams.poolFeeBps
3757
+ },
3758
+ padding: [],
3759
+ curve,
3760
+ tokenUpdateAuthority,
3761
+ migrationFee
3762
+ };
3763
+ return instructionParams;
3764
+ }
3606
3765
  function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
3607
3766
  let {
3608
3767
  totalTokenSupply,
@@ -26349,6 +26508,7 @@ export {
26349
26508
  buildCurve,
26350
26509
  buildCurveWithLiquidityWeights,
26351
26510
  buildCurveWithMarketCap,
26511
+ buildCurveWithMidPrice,
26352
26512
  buildCurveWithTwoSegments,
26353
26513
  calculateBaseToQuoteFromAmountIn,
26354
26514
  calculateBaseToQuoteFromAmountOut,