Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

This page is based on the public declaration surface of @meteora-ag/dynamic-bonding-curve-sdk. Use it as the high-level map for the SDK, then open the package types when you need exact parameter shapes.
import {
  DynamicBondingCurveClient,
  ActivationType,
  BaseFeeMode,
  CollectFeeMode,
  MigrationOption,
  SwapMode,
  buildCurveWithMarketCap,
  deriveDbcPoolAddress,
  getDynamicFeeParams,
  getFeeSchedulerParams,
  getRateLimiterParams,
} from "@meteora-ag/dynamic-bonding-curve-sdk";

Dependencies

PackageVersion
@coral-xyz/anchor^0.31.0
@solana/web3.js^1.98.0
@solana/spl-token^0.4.13
bn.js^5.2.1
decimal.js^10.5.0

Program IDs

ProgramID
DBCdbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN
DAMM v1Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB
DAMM v2cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG
LockerLocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn
Dynamic Vault24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi
Metaplex metadatametaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s

Core Exports

ExportUse
DynamicBondingCurveClientMain SDK client. Exposes pool, partner, creator, migration, and state services.
DynamicBondingCurveIdlBundled Anchor IDL JSON for dynamic_bonding_curve.
DynamicBondingCurveTypesIDL TypeScript type export.
DynamicBondingCurveProgramBase service class with the connection-backed Anchor program.
types exportsIDL account types, SDK parameter types, enums, and quote result types.
constants exportsProgram IDs, fee constants, curve limits, migration fee config keys, and default parameter structs.
helpers exportsCurve builders, PDA helpers, validation helpers, token helpers, instruction helpers, and config math helpers.
services exportsService classes for partner, pool, creator, migration, program, and state flows.
math exportsCurve math, swap quote math, fee math, safe math, and pool fee handlers.

Enums

EnumValues
ActivationTypeSlot = 0, Timestamp = 1.
TokenTypeSPL = 0, Token2022 = 1.
CollectFeeModeQuoteToken = 0, OutputToken = 1.
MigratedCollectFeeModeQuoteToken = 0, OutputToken = 1, Compounding = 2.
DammV2DynamicFeeModeDisabled = 0, Enabled = 1.
DammV2BaseFeeModeFeeTimeSchedulerLinear = 0, FeeTimeSchedulerExponential = 1, RateLimiter = 2, FeeMarketCapSchedulerLinear = 3, FeeMarketCapSchedulerExponential = 4.
MigrationOptionMET_DAMM = 0, MET_DAMM_V2 = 1.
BaseFeeModeFeeSchedulerLinear = 0, FeeSchedulerExponential = 1, RateLimiter = 2.
MigrationFeeOptionFixedBps25 = 0, FixedBps30 = 1, FixedBps100 = 2, FixedBps200 = 3, FixedBps400 = 4, FixedBps600 = 5, Customizable = 6.
TokenDecimalSIX = 6, SEVEN = 7, EIGHT = 8, NINE = 9.
TradeDirectionBaseToQuote = 0, QuoteToBase = 1.
SwapModeExactIn = 0, PartialFill = 1, ExactOut = 2.
TokenUpdateAuthorityOptionCreatorUpdateAuthority = 0, Immutable = 1, PartnerUpdateAuthority = 2, CreatorUpdateAndMintAuthority = 3, PartnerUpdateAndMintAuthority = 4.

Important Constants

ConstantValue
MAX_CURVE_POINT16
FEE_DENOMINATOR1_000_000_000
MAX_BASIS_POINT10_000
U16_MAX, U24_MAX, U64_MAX, U128_MAXInteger bounds used by validation and math helpers.
MIN_SQRT_PRICE / MAX_SQRT_PRICE4295048016 / 79226673521066979257578248091
MIN_FEE_BPS / MAX_FEE_BPS25 / 9900
MIN_FEE_NUMERATOR / MAX_FEE_NUMERATOR2_500_000 / 990_000_000
MAX_RATE_LIMITER_DURATION_IN_SECONDS43_200
MAX_RATE_LIMITER_DURATION_IN_SLOTS108_000
DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULTDefault dynamic-fee timing and reduction settings.
BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, MAX_PRICE_CHANGE_BPS_DEFAULTDefault dynamic-fee bin and price-change settings.
PROTOCOL_FEE_PERCENT / HOST_FEE_PERCENT20 / 20
SWAP_BUFFER_PERCENTAGE25
MAX_MIGRATION_FEE_PERCENTAGE / MAX_CREATOR_MIGRATION_FEE_PERCENTAGE99 / 100
MIN_LOCKED_LIQUIDITY_BPS1000
SECONDS_PER_DAY86400
MAX_LOCK_DURATION_IN_SECONDS63_072_000
PROTOCOL_POOL_CREATION_FEE_PERCENT10
MIN_POOL_CREATION_FEE / MAX_POOL_CREATION_FEE1_000_000 / 100_000_000_000 lamports
MIN_MIGRATED_POOL_FEE_BPS / MAX_MIGRATED_POOL_FEE_BPS10 / 1000
DAMM_V1_MIGRATION_FEE_ADDRESS, DAMM_V2_MIGRATION_FEE_ADDRESSPublished migration fee config addresses used by migrated-pool flows.
DEFAULT_MIGRATED_POOL_FEE_PARAMS, DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS, DEFAULT_MIGRATED_POOL_MARKET_CAP_FEE_SCHEDULER_PARAMSDefault config helper structs.

Creating A Client

import { Connection } from "@solana/web3.js";
import { DynamicBondingCurveClient } from "@meteora-ag/dynamic-bonding-curve-sdk";

const connection = new Connection(process.env.RPC_URL!, "confirmed");
const client = DynamicBondingCurveClient.create(connection, "confirmed");
The client creates service instances for transactions, quotes, and account reads. The returned transactions are unsigned; callers still set blockhashes when needed, sign, simulate, and submit.

Complete Function Index

Client And Program Helpers

Function or methodReturnsUse
new DynamicBondingCurveClient(connection, commitment)DynamicBondingCurveClientConstruct a client and its service instances manually.
DynamicBondingCurveClient.create(connection, commitment?)DynamicBondingCurveClientPreferred client factory. Defaults commitment to confirmed.
new DynamicBondingCurveProgram(connection, commitment)DynamicBondingCurveProgramConstruct the base program service used by concrete services.
DynamicBondingCurveProgram.getProgram()Program<DynamicBondingCurve>Return the underlying Anchor program instance.
createDbcProgram(connection, commitment?)DBC program wrapperCreate an Anchor program for the DBC IDL and program ID.
createVaultProgram(connection, commitment?)Dynamic Vault program wrapperCreate an Anchor program for Dynamic Vault migration helpers.
createDammV1Program(connection, commitment?)DAMM v1 program wrapperCreate an Anchor program for DAMM v1 migration helpers.
createDammV2Program(connection, commitment?)DAMM v2 program wrapperCreate an Anchor program for DAMM v2 migration helpers.

PartnerService

MethodReturnsUse
createConfig(params)Promise<Transaction>Create a PoolConfig from CreateConfigParams.
createPartnerMetadata(params)Promise<Transaction>Create partner metadata for a fee claimer.
claimPartnerTradingFee(params)Promise<Transaction>Claim partner trading fees with optional SOL wrapping behavior.
claimPartnerTradingFee2(params)Promise<Transaction>Claim partner trading fees with explicit receiver accounts.
partnerWithdrawSurplus(params)Promise<Transaction>Withdraw partner surplus after migration.
partnerWithdrawMigrationFee(params)Promise<Transaction>Withdraw the partner share of migration fees.
claimPartnerPoolCreationFee(params)Promise<Transaction>Claim the partner share of pool creation fees.

PoolService

MethodReturnsUse
createPool(params)Promise<Transaction>Create a virtual pool from an existing config and base mint.
createConfigAndPool(params)Promise<Transaction>Create a config and pool in one builder path.
createConfigAndPoolWithFirstBuy(params)Promise<{ createConfigTx; createPoolWithFirstBuyTx }>Build config, pool, and first-buy transactions. Current SDK returns config and pool-with-first-buy transactions separately.
createPoolWithFirstBuy(params)Promise<Transaction>Create a pool and include an initial buy.
createPoolWithPartnerAndCreatorFirstBuy(params)Promise<Transaction>Create a pool with partner and creator first-buy handling.
swap(params)Promise<Transaction>Build the legacy exact-in swap transaction.
swap2(params)Promise<Transaction>Build the preferred swap transaction for exact-in, partial-fill, and exact-out modes.
swapQuote(params)SwapQuoteResultQuote the legacy exact-in swap path.
swapQuote2(params)SwapQuote2ResultQuote SwapMode.ExactIn, PartialFill, or ExactOut.

CreatorService

MethodReturnsUse
createPoolMetadata(params)Promise<Transaction>Create optional metadata for a virtual pool.
claimCreatorTradingFee(params)Promise<Transaction>Claim creator trading fees with optional SOL wrapping behavior.
claimCreatorTradingFee2(params)Promise<Transaction>Claim creator trading fees with explicit receiver accounts.
creatorWithdrawSurplus(params)Promise<Transaction>Withdraw creator surplus after migration.
transferPoolCreator(params)Promise<Transaction>Transfer creator rights to a new creator.
creatorWithdrawMigrationFee(params)Promise<Transaction>Withdraw the creator share of migration fees.

MigrationService

MethodReturnsUse
createLocker(params)Promise<Transaction>Create a locker escrow when locked vesting is configured.
withdrawLeftover(params)Promise<Transaction>Withdraw leftover base tokens after migration.
createDammV1MigrationMetadata(params)Promise<Transaction>Create DAMM v1 migration metadata.
migrateToDammV1(params)Promise<Transaction>Migrate a completed DBC pool to DAMM v1.
lockDammV1LpToken(params)Promise<Transaction>Lock DAMM v1 LP allocation.
claimDammV1LpToken(params)Promise<Transaction>Claim locked DAMM v1 LP allocation.
migrateToDammV2(params)Promise<MigrateToDammV2Response>Migrate a completed DBC pool to DAMM v2 and return position NFT keypairs with the transaction.

StateService

MethodReturnsUse
getPoolConfig(configAddress)Promise<PoolConfig>Fetch one config account.
getPoolConfigs()Promise<ProgramAccount<PoolConfig>[]>Fetch all config accounts.
getPoolConfigsByOwner(owner)Promise<ProgramAccount<PoolConfig>[]>Fetch configs by partner owner or fee claimer.
getPool(poolAddress)Promise<VirtualPool>Fetch one virtual pool account.
getPools()Promise<ProgramAccount<VirtualPool>[]>Fetch all virtual pool accounts.
getPoolsByConfig(configAddress)Promise<ProgramAccount<VirtualPool>[]>Fetch pools created from one config.
getPoolsByCreator(creatorAddress)Promise<ProgramAccount<VirtualPool>[]>Fetch pools by creator.
getPoolByBaseMint(baseMint)Promise<ProgramAccount<VirtualPool> or null>Resolve a pool by base mint.
getPoolMigrationQuoteThreshold(poolAddress)Promise<BN>Read the migration quote threshold for a pool.
getPoolQuoteTokenCurveProgress(poolAddress)Promise<number>Calculate quote-side curve progress.
getPoolBaseTokenCurveProgress(poolAddress)Promise<number>Calculate base-side curve progress.
getPoolMetadata(pool)Promise<VirtualPoolMetadata>Fetch optional pool metadata.
getPartnerMetadata(feeClaimer)Promise<PartnerMetadata>Fetch optional partner metadata.
getDammV1LockEscrow(pool)Promise<LockEscrow>Fetch DAMM v1 lock escrow state.
getPoolFeeMetrics(poolAddress)Fee metrics objectRead lifetime fee metrics for one pool.
getPoolFeeBreakdown(poolAddress)Fee breakdown objectRead current claimable fee breakdown for partner and creator.
getPoolsFeesByConfig(configAddress)Aggregated fee metricsAggregate fee metrics across pools for one config.
getPoolsFeesByCreator(creatorAddress)Aggregated fee metricsAggregate fee metrics across pools for one creator.
getDammV1MigrationMetadata(poolAddress)Promise<MeteoraDammMigrationMetadata>Fetch DAMM v1 migration metadata.

Curve Builder Helpers

All curve builders return ConfigParameters.
FunctionParams typeExtra fields beyond BuildCurveBaseParamsUse
buildCurveBuildCurveParamspercentageSupplyOnMigration, migrationQuoteThresholdBuild a config from target migration amount and supply percentage.
buildCurveWithMarketCapBuildCurveWithMarketCapParamsinitialMarketCap, migrationMarketCapBuild a config from market-cap targets.
buildCurveWithTwoSegmentsBuildCurveWithTwoSegmentsParamsinitialMarketCap, migrationMarketCap, percentageSupplyOnMigrationBuild a two-segment curve.
buildCurveWithMidPriceBuildCurveWithMidPriceParamsinitialMarketCap, migrationMarketCap, midPrice, percentageSupplyOnMigrationBuild a two-segment curve with a specified midpoint.
buildCurveWithLiquidityWeightsBuildCurveWithLiquidityWeightsParamsinitialMarketCap, migrationMarketCap, liquidityWeightsShape curve liquidity distribution with weights.
buildCurveWithCustomSqrtPricesBuildCurveWithCustomSqrtPricesParamssqrtPrices, optional liquidityWeightsBuild a curve with explicit square-root price checkpoints.

Config, Curve, And Account Helpers

FunctionUse
getFirstKeyReturn the first ordered key buffer used by sorted PDA seeds.
getSecondKeyReturn the second ordered key buffer used by sorted PDA seeds.
getAccountDataFetch and decode one Anchor account by account type.
getAccountCreationTimestampReturn the block-time timestamp of the newest fetched signature for one account.
getAccountCreationTimestampsBatch getAccountCreationTimestamp over multiple accounts.
getTotalTokenSupplyAdd circulating supply and locked vesting supply.
getPriceFromSqrtPriceConvert a square-root price into UI price with base and quote decimals.
getSqrtPriceFromPriceConvert UI price into a square-root price.
createSqrtPricesBuild square-root price checkpoints from UI price inputs.
getSqrtPriceFromMarketCapConvert market cap and supply inputs into a square-root price.
getBaseTokenForSwapCompute base-token movement for a swap against the curve.
getMigrationQuoteAmountFromMigrationQuoteThresholdConvert a migration quote threshold into a migration quote amount.
getMigrationQuoteThresholdFromMigrationQuoteAmountConvert a migration quote amount into a migration quote threshold.
getProtocolMigrationFeeResolve protocol migration fee settings for a migration option and fee option.
getMigrationBaseTokenCalculate base tokens reserved for migration.
getTotalVestingAmountCalculate total locked vesting amount from vesting params.
getLiquidityCalculate liquidity from base amount and square-root price range.
getFirstCurveBuild the first curve segment from supply and price targets.
getTotalSupplyFromCurveSum total supply represented by curve checkpoints.
getMigrationThresholdPriceCalculate the price at the migration threshold.
getCurveBreakdownReturn per-segment curve supply and quote breakdown.
getSwapAmountWithBufferAdd SDK swap buffer percentage to a swap amount.
getPercentageSupplyOnMigrationCalculate migration supply percentage from curve parameters.
calculateAdjustedPercentageSupplyOnMigrationAdjust migration supply percentage for locked vesting and leftovers.
getMigrationQuoteAmountCalculate quote amount needed for migration.
getFeeSchedulerParamsConvert scheduler inputs into DBC base-fee params.
calculateFeeSchedulerEndingBaseFeeBpsCalculate ending scheduler fee bps from starting fee and reduction inputs.
getRateLimiterParamsConvert rate-limiter inputs into DBC base-fee params.
getDynamicFeeParamsBuild dynamic-fee params from base fee and optional price-change limit.
getStartingBaseFeeBpsFromBaseFeeParamsRecover starting base-fee bps from base-fee params.
computeSqrtPriceStepBpsCalculate bps step between two square-root prices.
getMigratedPoolMarketCapFeeSchedulerParamsBuild DAMM v2 market-cap fee scheduler params for migrated pools.
getLockedVestingParamsConvert locked vesting inputs into program vesting params.
getLiquidityVestingInfoParamsConvert migrated-liquidity vesting inputs into program vesting params.
getTwoCurveBuild a two-segment curve from target inputs.
checkRateLimiterAppliedCheck whether rate limiter behavior applies at a point.
getBaseFeeParamsNormalize base-fee helper inputs into program params.
getQuoteReserveFromNextSqrtPriceCalculate quote reserve from the next square-root price.
getTokenomicsCalculate tokenomics breakdown for a configured curve.
getMigratedPoolFeeParamsBuild migrated-pool fee params from migration and fee config inputs.
getCurrentPointReturn current slot or timestamp based on activation type.
prepareSwapAmountParamPrepare swap amount fields for swap instruction params.
getVestingLockedLiquidityBpsAtNSecondsCalculate locked-liquidity bps at an elapsed time.
calculateLockedLiquidityBpsAtTimeCalculate locked-liquidity bps at a concrete timestamp.

PDA Helpers

FunctionUse
deriveDbcEventAuthorityDerive the DBC event authority PDA.
deriveDammV1EventAuthorityDerive the DAMM v1 event authority PDA.
deriveDammV2EventAuthorityDerive the DAMM v2 event authority PDA.
deriveLockerEventAuthorityDerive the locker event authority PDA.
deriveDbcPoolAuthorityDerive the DBC pool authority PDA.
deriveDammV1PoolAuthorityDerive the DAMM v1 pool authority PDA.
deriveDammV2PoolAuthorityDerive the DAMM v2 pool authority PDA.
deriveDbcPoolAddressDerive a DBC virtual pool address from quote mint, base mint, and config.
deriveDammV1PoolAddressDerive a migrated DAMM v1 pool address.
deriveDammV2PoolAddressDerive a migrated DAMM v2 pool address.
deriveMintMetadataDerive Metaplex metadata PDA for a mint.
derivePartnerMetadataDerive partner metadata PDA from fee claimer.
deriveDbcPoolMetadataDerive DBC pool metadata PDA.
deriveDammV1MigrationMetadataAddressDerive DAMM v1 migration metadata PDA.
deriveDammV2MigrationMetadataAddressDerive DAMM v2 migration metadata PDA.
deriveDbcTokenVaultAddressDerive a DBC token vault PDA.
deriveDammV1VaultLPAddressDerive a DAMM v1 vault LP address.
deriveDammV2TokenVaultAddressDerive a DAMM v2 token vault address.
deriveVaultAddressDerive a Dynamic Vault address.
deriveVaultPdasDerive Dynamic Vault, token vault, and LP mint PDAs together.
deriveTokenVaultKeyDerive a Dynamic Vault token vault PDA.
deriveVaultLpMintAddressDerive a Dynamic Vault LP mint PDA.
deriveDammV1LpMintAddressDerive DAMM v1 LP mint PDA.
derivePositionAddressDerive DAMM v2 position PDA from a position NFT mint.
derivePositionNftAccountDerive the canonical position NFT token account.
deriveDammV1LockEscrowAddressDerive DAMM v1 lock escrow PDA.
deriveDammV2LockEscrowAddressDerive DAMM v2 lock escrow PDA.
deriveEscrowDerive locker escrow PDA.
deriveDammV1ProtocolFeeAddressDerive DAMM v1 protocol fee PDA.
deriveBaseKeyForLockerDerive base key used for locker escrow seeds.

Token, Instruction, And Utility Helpers

FunctionUse
getOrCreateATAInstructionResolve an ATA and return an idempotent creation instruction when needed.
unwrapSOLInstructionBuild a wrapped SOL close-account instruction.
wrapSOLInstructionBuild native SOL wrapping instructions.
findAssociatedTokenAddressDerive an ATA for mint, owner, and token program.
getTokenDecimalsFetch mint decimals.
getTokenProgramMap TokenType to SPL Token or Token-2022 program ID.
getTokenTypeRead mint ownership and return TokenType.
prepareTokenAccountTxPrepare source and destination token accounts for a token transfer or swap.
cleanUpTokenAccountTxAdd cleanup instructions for temporary wrapped SOL accounts.
createInitializePermissionlessDynamicVaultIxBuild the Dynamic Vault initialize instruction and derived vault addresses.
createLockEscrowIxBuild the DAMM v1 lock escrow instruction.
convertToLamportsConvert UI decimal amount into lamports for a decimal count.
fromDecimalToBNConvert a Decimal value into BN.
convertDecimalToBNConvert a decimal value into BN using SDK scaling.
createProgramAccountFilterBuild a memcmp filter for getProgramAccounts.
isNativeSolCheck whether a mint is native SOL.
isDefaultLockedVestingCheck whether locked vesting params are the SDK default.
bpsToFeeNumeratorConvert basis points into fee numerator.
feeNumeratorToBpsConvert fee numerator into basis points.

Validation Helpers

FunctionUse
validatePoolFeesValidate full pool-fee config.
validateFeeSchedulerValidate time scheduler base-fee inputs.
validateFeeRateLimiterValidate rate-limiter base-fee inputs.
validateDynamicFeeValidate dynamic-fee inputs.
validateCollectFeeModeValidate DBC collect-fee mode.
validateMigrationAndTokenTypeValidate migration option and token type compatibility.
validateActivationTypeValidate activation type.
validateMigrationFeeOptionValidate migration fee option.
validateTokenDecimalsValidate supported base-token decimals.
validateLPPercentagesValidate migrated-liquidity percentage split.
validateCurveValidate curve checkpoint count, ordering, and bounds.
validateTokenSupplyValidate token supply against curve and vesting requirements.
validateTokenUpdateAuthorityOptionsValidate mint update-authority option.
validatePoolCreationFeeValidate pool creation fee bounds.
validateLiquidityVestingInfoValidate migrated-liquidity vesting schedule.
validateMinimumLockedLiquidityValidate minimum locked liquidity requirements.
validateMigratedCollectFeeModeValidate migrated-pool collect-fee mode.
validateCompoundingFeeBpsValidate DAMM v2 compounding fee bps.
validateMigratedPoolFeeValidate migrated-pool fee config.
validateConfigParametersValidate complete ConfigParameters before config creation.
validateBaseTokenTypeValidate base mint owner against expected token type.
validateBalanceValidate token or SOL balance before building a transaction.
validateSwapAmountValidate nonzero swap amount.
validateMigratedPoolBaseFeeModeValidate DAMM v2 migrated-pool base-fee mode.
validateMarketCapFeeSchedulerRequiresPoolFeeBpsValidate market-cap scheduler requirements for migrated-pool fees.
validateMigrationFeeValidate custom migration fee percentages.

Swap Quote Math

FunctionUse
getSwapResultExecute shared swap quote simulation across the curve.
swapQuoteLegacy exact-in quote entry point.
getSwapResultFromExactInputSimulate exact-input swap movement.
getSwapResultFromPartialInputSimulate partial-fill swap movement.
calculateBaseToQuoteFromAmountInCalculate base-to-quote exact-input movement.
calculateQuoteToBaseFromAmountInCalculate quote-to-base exact-input movement.
getSwapResultFromExactOutputSimulate exact-output swap movement.
calculateBaseToQuoteFromAmountOutCalculate base-to-quote exact-output movement.
calculateQuoteToBaseFromAmountOutCalculate quote-to-base exact-output movement.
swapQuoteExactInPreferred exact-in quote helper for swap2.
swapQuotePartialFillPreferred partial-fill quote helper for swap2.
swapQuoteExactOutPreferred exact-out quote helper for swap2.

Curve Math

FunctionUse
getInitialLiquidityFromDeltaQuoteCalculate initial liquidity from quote amount and square-root price range.
getInitialLiquidityFromDeltaBaseCalculate initial liquidity from base amount and square-root price range.
getDeltaAmountBaseUnsignedCalculate unsigned base delta for a liquidity and price range.
getDeltaAmountBaseUnsigned256Calculate unsigned base delta with 256-bit intermediate handling.
getDeltaAmountBaseUnsignedUncheckedCalculate unsigned base delta without public bounds checks.
getDeltaAmountQuoteUnsignedCalculate unsigned quote delta for a liquidity and price range.
getDeltaAmountQuoteUnsigned256Calculate unsigned quote delta with 256-bit intermediate handling.
getDeltaAmountQuoteUnsignedUncheckedCalculate unsigned quote delta without public bounds checks.
getNextSqrtPriceFromInputCalculate next square-root price from input amount.
getNextSqrtPriceFromOutputCalculate next square-root price from output amount.
getNextSqrtPriceFromQuoteAmountOutRoundingDownCalculate next price for quote output with rounding down.
getNextSqrtPriceFromBaseAmountOutRoundingUpCalculate next price for base output with rounding up.
getNextSqrtPriceFromBaseAmountInRoundingUpCalculate next price for base input with rounding up.
getNextSqrtPriceFromQuoteAmountInRoundingDownCalculate next price for quote input with rounding down.

Fee Math

FunctionUse
toNumeratorConvert bps to fee numerator for a denominator.
getFeeModeResolve fee collection behavior from collect-fee mode, direction, and referral state.
getTotalFeeNumeratorFromIncludedFeeAmountInfer total fee numerator from an amount that already includes fee.
getTotalFeeNumeratorFromExcludedFeeAmountInfer total fee numerator from an amount before fee.
getTotalFeeNumeratorCombine base fee, dynamic fee, and fee mode into total fee numerator.
getFeeOnAmountCalculate fee charged on an amount.
getExcludedFeeAmountCalculate fee amount excluded from input.
getIncludedFeeAmountCalculate fee amount included in output.
splitFeesSplit total fee into protocol, partner, creator, and referral components.

Pool Fee Math

Function or classUse
new FeeRateLimiter(...)Create a base-fee handler for rate-limiter mode.
FeeRateLimiter.validateValidate the rate-limiter handler against collect-fee and activation settings.
FeeRateLimiter.getMinBaseFeeNumeratorReturn the minimum base-fee numerator for the rate limiter.
FeeRateLimiter.getBaseFeeNumeratorFromIncludedFeeAmountCalculate base fee from an amount that includes fee.
FeeRateLimiter.getBaseFeeNumeratorFromExcludedFeeAmountCalculate base fee from an amount before fee.
new FeeScheduler(...)Create a base-fee handler for linear or exponential scheduler mode.
FeeScheduler.validateValidate the scheduler handler.
FeeScheduler.getMinBaseFeeNumeratorReturn the scheduler minimum base-fee numerator.
FeeScheduler.getBaseFeeNumeratorFromIncludedFeeAmountCalculate scheduled base fee for an included-fee amount.
FeeScheduler.getBaseFeeNumeratorFromExcludedFeeAmountCalculate scheduled base fee for an excluded-fee amount.
getBaseFeeHandlerInstantiate the correct base-fee handler from base-fee mode.
isDynamicFeeEnabledCheck whether dynamic fee config is active.
getVariableFeeNumeratorCalculate variable dynamic-fee numerator from volatility state.
getFeeSchedulerMaxBaseFeeNumeratorReturn max base-fee numerator for scheduler mode.
getFeeSchedulerMinBaseFeeNumeratorReturn min base-fee numerator for scheduler mode.
getBaseFeeNumeratorByPeriodCalculate scheduler base-fee numerator for a period.
getFeeNumeratorOnLinearFeeSchedulerCalculate linear scheduler fee numerator.
getFeeNumeratorOnExponentialFeeSchedulerCalculate exponential scheduler fee numerator.
getBaseFeeNumeratorCalculate active base-fee numerator for scheduler mode.
isRateLimiterAppliedCheck if rate limiter applies at the current point and trade direction.
isZeroRateLimiterCheck whether rate-limiter config is effectively zero.
isNonZeroRateLimiterCheck whether rate-limiter config is nonzero.
getMaxIndexCalculate max rate-limiter fee index.
getMaxOutAmountWithMinBaseFeeCalculate max output amount that can use min base fee.
getCheckedAmountsCalculate bounded amount slices for rate-limiter fee math.
getFeeNumeratorFromExcludedAmountCalculate rate-limiter fee numerator from excluded amount.
getRateLimiterExcludedFeeAmountCalculate excluded fee amount under rate-limiter math.
getFeeNumeratorFromIncludedAmountCalculate rate-limiter fee numerator from included amount.
getRateLimiterMinBaseFeeNumeratorCalculate rate-limiter minimum base-fee numerator.

Math Utilities

Function or class methodUse
SafeMath.addAdd two BN values.
SafeMath.subSubtract two BN values and throw on underflow.
SafeMath.mulMultiply two BN values.
SafeMath.divDivide two BN values and throw on division by zero.
SafeMath.modModulo two BN values and throw on division by zero.
SafeMath.shlLeft shift a BN.
SafeMath.shrRight shift a BN.
powCompute scaled exponentiation for BN values.
mulDivMultiply then divide with configured rounding.
mulShrMultiply then right shift by an offset.
sqrtInteger square root for BN.

Core Types

Type groupTypes
Program and IDLDynamicCurveProgram, DynamicBondingCurveTypes, DynamicBondingCurveIdl.
Account statesPoolConfig, VirtualPool, MeteoraDammMigrationMetadata, LockEscrow, PartnerMetadata, VirtualPoolMetadata.
Config structsConfigParameters, PoolFeeParameters, DynamicFeeParameters, LiquidityDistributionParameters, LockedVestingParameters, LiquidityVestingInfoParameters, MigratedPoolMarketCapFeeSchedulerParameters.
Builder config inputsTokenConfig, FeeConfig, BaseFeeParams, FeeSchedulerParams, RateLimiterParams, MigrationConfig, MigrationFee, MigratedPoolFeeConfig, LiquidityDistributionConfig, LockedVestingParams.
Curve builder paramsBuildCurveBaseParams, BuildCurveParams, BuildCurveWithMarketCapParams, BuildCurveWithTwoSegmentsParams, BuildCurveWithMidPriceParams, BuildCurveWithLiquidityWeightsParams, BuildCurveWithCustomSqrtPricesParams.
Pool and swap paramsCreatePoolParams, CreateConfigAndPoolParams, CreateConfigAndPoolWithFirstBuyParams, CreatePoolWithFirstBuyParams, CreatePoolWithPartnerAndCreatorFirstBuyParams, SwapParams, Swap2Params, SwapQuoteParams, SwapQuote2Params.
Migration paramsMigrateToDammV1Params, MigrateToDammV2Params, MigrateToDammV2Response, DammLpTokenParams, CreateLockerParams, CreateDammV1MigrationMetadataParams.
Claim and withdraw paramsClaimTradingFeeParams, ClaimTradingFee2Params, WithdrawSurplusParams, WithdrawMigrationFeeParams, ClaimPartnerPoolCreationFeeParams.
Quote and fee resultsSwapResult, SwapResult2, SwapQuoteResult, SwapQuote2Result, VolatilityTracker, MigratedPoolFee.

Config Creation Types

client.partner.createConfig accepts CreateConfigParams. The type combines the accounts required by the create_config instruction with the SDK’s computed ConfigParameters.
Account fieldTypeUse
configPublicKeyConfig account address to initialize.
feeClaimerPublicKeyPartner authority that can claim partner fees.
leftoverReceiverPublicKeyReceiver for leftover base tokens after migration.
quoteMintPublicKeyQuote token mint used by pools created from the config.
payerPublicKeyTransaction fee payer and account initializer.
ConfigParameters is usually produced by one of the curve builders. Pass the returned object directly into createConfig, createConfigAndPool, or createConfigAndPoolWithFirstBuy.
FieldMeaning
poolFeesBase-fee and optional dynamic-fee parameters for DBC swaps.
collectFeeModeWhether trading fees are collected in quote token or output token.
migrationOptionDestination AMM family, currently DAMM v1 or DAMM v2.
activationTypeActivation point unit, either slot or timestamp.
tokenTypeSPL Token or Token-2022 base mint handling.
tokenDecimalBase token decimal enum encoded into the config.
partnerLiquidityPercentage, creatorLiquidityPercentageMigrated-pool liquidity share for partner and creator.
partnerPermanentLockedLiquidityPercentage, creatorPermanentLockedLiquidityPercentageMigrated-pool liquidity share permanently locked for each party.
migrationQuoteThresholdQuote amount threshold that completes the bonding curve.
sqrtStartPriceInitial square-root price for the virtual curve.
lockedVestingLocked base-token vesting schedule after migration.
migrationFeeOption, migrationFeeFixed or customizable migration fee settings.
tokenSupplyTotal base-token supply for the launch.
creatorTradingFeePercentageCreator share of trading fees.
tokenUpdateAuthorityBase mint update-authority behavior.
migratedPoolFeeFee settings applied to the migrated DAMM pool.
poolCreationFeePool creation fee in lamports.
partnerLiquidityVestingInfo, creatorLiquidityVestingInfoOptional vesting schedule for migrated liquidity shares.
migratedPoolBaseFeeModeOptional DAMM v2 base-fee mode for graduated pools.
migratedPoolMarketCapFeeSchedulerParamsOptional market-cap fee scheduler for DAMM v2 migration.
enableFirstSwapWithMinFeeAllows the first eligible swap to use the configured minimum-fee path.
compoundingFeeBpsDAMM v2 compounding fee bps when migrated collect-fee mode is compounding.
curveUp to MAX_CURVE_POINT curve checkpoints.

Builder Input Groups

All curve builders share BuildCurveBaseParams, then add builder-specific target fields.
GroupFields
tokentokenType, tokenBaseDecimal, tokenQuoteDecimal, tokenUpdateAuthority, totalTokenSupply, leftover.
feebaseFeeParams, dynamicFeeEnabled, collectFeeMode, creatorTradingFeePercentage, poolCreationFee, enableFirstSwapWithMinFee.
migrationmigrationOption, migrationFeeOption, migrationFee, optional migratedPoolFee.
liquidityDistributionPartner and creator migrated-liquidity percentages, permanent-lock percentages, and optional vesting info for each side.
lockedVestingtotalLockedVestingAmount, numberOfVestingPeriod, cliffUnlockAmount, totalVestingDuration, cliffDurationFromMigrationTime.
activationTypeSlot-based or timestamp-based activation.
Nested typeKey fieldsNotes
BaseFeeParamsFee scheduler or rate limiter paramsUse getFeeSchedulerParams for linear or exponential fee decay, or getRateLimiterParams for rate-limited fees.
FeeSchedulerParamsstartingFeeBps, endingFeeBps, numberOfPeriod, totalDurationUsed with FeeSchedulerLinear or FeeSchedulerExponential.
RateLimiterParamsbaseFeeBps, feeIncrementBps, referenceAmount, maxLimiterDurationUses quote-token decimals and activation type when converted into program params.
MigrationFeefeePercentage, creatorFeePercentageRequired only when migrationFeeOption is Customizable.
MigratedPoolFeeConfigcollectFeeMode, dynamicFee, poolFeeBps, optional compoundingFeeBps, optional graduated fee fieldsApplies to the migrated DAMM pool, not to the DBC virtual pool.
LiquidityVestingInfoParamsvestingPercentage, bpsPerPeriod, numberOfPeriods, cliffDurationFromMigrationTime, totalDurationOptional migrated-liquidity vesting schedule.
LockedVestingParamstotalLockedVestingAmount, numberOfVestingPeriod, cliffUnlockAmount, totalVestingDuration, cliffDurationFromMigrationTimeBase-token vesting locked during migration.

Common Workflows

Create A Config From A Builder

const configParams = buildCurveWithMarketCap({
  token,
  fee,
  migration,
  liquidityDistribution,
  lockedVesting,
  activationType: ActivationType.Timestamp,
  initialMarketCap,
  migrationMarketCap,
});

const tx = await client.partner.createConfig({
  ...configParams,
  config,
  feeClaimer,
  leftoverReceiver,
  quoteMint,
  payer,
});

Quote And Build A swap2 Transaction

const quote = client.pool.swapQuote2({
  virtualPool,
  config,
  swapBaseForQuote: false,
  hasReferral: false,
  eligibleForFirstSwapWithMinFee: false,
  currentPoint,
  slippageBps,
  swapMode: SwapMode.ExactIn,
  amountIn,
});

const tx = await client.pool.swap2({
  owner,
  pool,
  swapBaseForQuote: false,
  amountIn,
  minimumAmountOut: quote.minimumAmountOut,
  swapMode: SwapMode.ExactIn,
  referralTokenAccount: null,
});

Integration Notes

GotchaGuidance
swap2 modesUse SwapMode.ExactIn, PartialFill, or ExactOut and pass the matching amount fields.
Rate limiter poolsThe SDK adds the instructions sysvar when the current fee mode requires single-swap validation.
First-swap minimum feeSet eligibleForFirstSwapWithMinFee only when quoting a transaction that satisfies the program’s first-swap validation path.
Token-2022 poolsUse SDK builders so the correct token program, metadata, and ATA handling are included.
DAMM v2 compoundingMigratedCollectFeeMode.Compounding requires compoundingFeeBps; non-compounding modes require it to be zero.
Market-cap schedulerMarket-cap scheduler params use startingMarketCap and endingMarketCap in current SDK helpers.