r one config. |
| `getPoolsFeesByCreator(creatorAddress)` | Aggregated fee metrics | Aggregate fee metrics across pools for one creator. |
| `getDammV1MigrationMetadata(poolAddress)` | `Promise<MeteoraDammMigrationMetadata>` | Fetch DAMM v1 migration metadata for existing DAMM v1 pools. |
| `getTokenBadge(tokenMint)` | `Promise<TokenBadge or null>` | Fetch the DBC token badge for a quote mint. |
### Curve Builder Helpers
All curve builders return `ConfigParameters`.
| Function | Params type | Extra fields beyond `BuildCurveBaseParams` | Use |
| - | - | - | - |
| `buildCurve` | `BuildCurveParams` | `percentageSupplyOnMigration`, `migrationQuoteThreshold` | Build a config from target migration amount and supply percentage. |
| `buildCurveWithMarketCap` | `BuildCurveWithMarketCapParams` | `initialMarketCap`, `migrationMarketCap` | Build a config from market-cap targets. |
| `buildCurveWithTwoSegments` | `BuildCurveWithTwoSegmentsParams` | `initialMarketCap`, `migrationMarketCap`, `percentageSupplyOnMigration` | Build a two-segment curve. |
| `buildCurveWithMidPrice` | `BuildCurveWithMidPriceParams` | `initialMarketCap`, `migrationMarketCap`, `midPrice`, `percentageSupplyOnMigration` | Build a two-segment curve with a specified midpoint. |
| `buildCurveWithLiquidityWeights` | `BuildCurveWithLiquidityWeightsParams` | `initialMarketCap`, `migrationMarketCap`, `liquidityWeights` | Shape curve liquidity distribution with weights. |
| `buildCurveWithCustomSqrtPrices` | `BuildCurveWithCustomSqrtPricesParams` | `sqrtPrices`, optional `liquidityWeights` | Build a curve with explicit square-root price checkpoints. |
### Config, Curve, And Account Helpers
| Function | Use |
| - | - |
| `getFirstKey` | Return the first ordered key buffer used by sorted PDA seeds. |
| `getSecondKey` | Return the second ordered key buffer used by sorted PDA seeds. |
| `getAccountData` | Fetch and decode one Anchor account by account type. |
| `getAccountCreationTimestamp` | Return the block-time timestamp of the newest fetched signature for one account. |
| `getAccountCreationTimestamps` | Batch `getAccountCreationTimestamp` over multiple accounts. |
| `getTotalTokenSupply` | Add circulating supply and locked vesting supply. |
| `getPriceFromSqrtPrice` | Convert a square-root price into UI price with base and quote decimals. |
| `getSqrtPriceFromPrice` | Convert UI price into a square-root price. |
| `createSqrtPrices` | Build square-root price checkpoints from UI price inputs. |
| `getSqrtPriceFromMarketCap` | Convert market cap and supply inputs into a square-root price. |
| `getBaseTokenForSwap` | Compute base-token movement for a swap against the curve. |
| `getMigrationQuoteAmountFromMigrationQuoteThreshold` | Convert a migration quote threshold into a migration quote amount. |
| `getMigrationQuoteThresholdFromMigrationQuoteAmount` | Convert a migration quote amount into a migration quote threshold. |
| `getProtocolMigrationFee` | Resolve protocol migration fee settings for a migration option and fee option. |
| `getMigrationBaseToken` | Calculate base tokens reserved for migration. |
| `getTotalVestingAmount` | Calculate total locked vesting amount from vesting params. |
| `getLiquidity` | Calculate liquidity from base amount and square-root price range. |
| `getFirstCurve` | Build the first curve segment from supply and price targets. |
| `getTotalSupplyFromCurve` | Sum total supply represented by curve checkpoints. |
| `getMigrationThresholdPrice` | Calculate the price at the migration threshold. |
| `getCurveBreakdown` | Return per-segment curve supply and quote breakdown. |
| `getSwapAmountWithBuffer` | Add SDK swap buffer percentage to a swap amount. |
| `getPercentageSupplyOnMigration` | Calculate migration supply percentage from curve parameters. |
| `calculateAdjustedPercentageSupplyOnMigration` | Adjust migration supply percentage for locked vesting and leftovers. |
| `getMigrationQuoteAmount` | Calculate quote amount needed for migration. |
| `getFeeSchedulerParams` | Convert scheduler inputs into DBC base-fee params. |
| `calculateFeeSchedulerEndingBaseFeeBps` | Calculate ending scheduler fee bps from starting fee and reduction inputs. |
| `getRateLimiterParams` | Convert rate-limiter inputs into DBC base-fee params for existing pools. This helper still takes `tokenQuoteDecimal` and `activationType`. `getBaseFeeParams`, `createConfig`, `createPool`, and `buildCurve*` reject RateLimiter. |
| `getDynamicFeeParams` | Build dynamic-fee params from base fee and optional price-change limit. |
| `getStartingBaseFeeBpsFromBaseFeeParams` | Recover starting base-fee bps from base-fee params. |
| `computeSqrtPriceStepBps` | Calculate bps step between two square-root prices. |
| `getMigratedPoolMarketCapFeeSchedulerParams` | Build DAMM v2 market-cap fee scheduler params for migrated pools using `priceMultiple`. |
| `getLockedVestingParams` | Convert locked vesting inputs into program vesting params. |
| `getLiquidityVestingInfoParams` | Convert migrated-liquidity vesting inputs into program vesting params. |
| `getTwoCurve` | Build a two-segment curve from target inputs. |
| `checkRateLimiterApplied` | Check whether rate limiter behavior applies at a point. |
| `getBaseFeeParams` | Normalize scheduler base-fee helper inputs into program params. Rate limiter inputs are rejected. This helper no longer takes `tokenQuoteDecimal` or `activationType`. |
| `getTokenBadgeRemainingAccounts` | Return the optional token badge remaining-account metas for config and pool creation. |
| `getQuoteReserveFromNextSqrtPrice` | Calculate quote reserve from the next square-root price. |
| `getTokenomics` | Calculate tokenomics breakdown for a configured curve. |
| `getMigratedPoolFeeParams` | Build migrated-pool fee params from migration and fee config inputs. |
| `getCurrentPoint` | Return current slot or timestamp based on activation type. |
| `prepareSwapAmountParam` | Prepare swap amount fields for swap instruction params. |
| `getVestingLockedLiquidityBpsAtNSeconds` | Calculate locked-liquidity bps at an elapsed time. |
| `calculateLockedLiquidityBpsAtTime` | Calculate locked-liquidity bps at a concrete timestamp. |
### PDA Helpers
| Function | Use |
| - | - |
| `deriveDbcEventAuthority` | Derive the DBC event authority PDA. |
| `deriveDammV1EventAuthority` | Derive the DAMM v1 event authority PDA. |
| `deriveDammV2EventAuthority` | Derive the DAMM v2 event authority PDA. |
| `deriveLockerEventAuthority` | Derive the locker event authority PDA. |
| `deriveDbcPoolAuthority` | Derive the DBC pool authority PDA. |
| `deriveDammV1PoolAuthority` | Derive the DAMM v1 pool authority PDA. |
| `deriveDammV2PoolAuthority` | Derive the DAMM v2 pool authority PDA. |
| `deriveDbcPoolAddress` | Derive a DBC virtual pool address from quote mint, base mint, and config. |
| `deriveDammV1PoolAddress` | Derive a migrated DAMM v1 pool address. |
| `deriveDammV2PoolAddress` | Derive a migrated DAMM v2 pool address. |
| `deriveMintMetadata` | Derive Metaplex metadata PDA for a mint. |
| `derivePartnerMetadata` | Derive partner metadata PDA from fee claimer. |
| `deriveDbcPoolMetadata` | Derive DBC pool metadata PDA. |
| `deriveDammV1MigrationMetadataAddress` | Derive DAMM v1 migration metadata PDA. |
| `deriveDammV2MigrationMetadataAddress` | Derive DAMM v2 migration metadata PDA. |
| `deriveDbcTokenVaultAddress` | Derive a DBC token vault PDA. |
| `deriveDammV1VaultLPAddress` | Derive a DAMM v1 vault LP address. |
| `deriveDammV2TokenVaultAddress` | Derive a DAMM v2 token vault address. |
| `deriveVaultAddress` | Derive a Dynamic Vault address. |
| `deriveVaultPdas` | Derive Dynamic Vault, token vault, and LP mint PDAs together. |
| `deriveTokenVaultKey` | Derive a Dynamic Vault token vault PDA. |
| `deriveVaultLpMintAddress` | Derive a Dynamic Vault LP mint PDA. |
| `deriveDammV1LpMintAddress` | Derive DAMM v1 LP mint PDA. |
| `derivePositionAddress` | Derive DAMM v2 position PDA from a position NFT mint. |
| `derivePositionNftAccount` | Derive the canonical position NFT token account. |
| `deriveDammV1LockEscrowAddress` | Derive DAMM v1 lock escrow PDA. |
| `deriveTokenBadgeAddress` | Derive the DBC token badge PDA from `token_badge` and the quote mint. |
| `deriveDammV2LockEscrowAddress` | Derive DAMM v2 lock escrow PDA. |
| `deriveEscrow` | Derive locker escrow PDA. |
| `deriveDammV1ProtocolFeeAddress` | Derive DAMM v1 protocol fee PDA. |
| `deriveBaseKeyForLocker` | Derive base key used for locker escrow seeds. |
### Token, Instruction, And Utility Helpers
| Function | Use |
| - | - |
| `getOrCreateATAInstruction` | Resolve an ATA and return an idempotent creation instruction when needed. |
| `unwrapSOLInstruction` | Build a wrapped SOL close-account instruction. |
| `wrapSOLInstruction` | Build native SOL wrapping instructions. |
| `findAssociatedTokenAddress` | Derive an ATA for mint, owner, and token program. |
| `getTokenDecimals` | Fetch mint decimals. |
| `getTokenProgram` | Map `TokenType` to SPL Token or Token-2022 program ID. |
| `getTokenType` | Read mint ownership and return `TokenType`. |
| `prepareTokenAccountTx` | Prepare source and destination token accounts for a token transfer or swap. |
| `cleanUpTokenAccountTx` | Add cleanup instructions for temporary wrapped SOL accounts. |
| `createInitializePermissionlessDynamicVaultIx` | Build the Dynamic Vault initialize instruction and derived vault addresses. |
| `createLockEscrowIx` | Build the DAMM v1 lock escrow instruction. |
| `convertToLamports` | Convert UI decimal amount into lamports for a decimal count. |
| `fromDecimalToBN` | Convert a `Decimal` value into `BN`. |
| `convertDecimalToBN` | Convert a decimal value into `BN` using SDK scaling. |
| `createProgramAccountFilter` | Build a memcmp filter for `getProgramAccounts`. |
| `isNativeSol` | Check whether a mint is native SOL. |
| `isDefaultLockedVesting` | Check whether locked vesting params are the SDK default. |
| `bpsToFeeNumerator` | Convert basis points into fee numerator. |
| `feeNumeratorToBps` | Convert fee numerator into basis points. |
### Validation Helpers
| Function | Use |
| - | - |
| `validatePoolFees` | Validate full pool-fee config. |
| `validateFeeScheduler` | Validate time scheduler base-fee inputs. |
| `validateFeeRateLimiter` | Validate rate-limiter base-fee inputs. |
| `validateDynamicFee` | Validate dynamic-fee inputs. |
| `validateCollectFeeMode` | Validate DBC collect-fee mode. |
| `validateMigrationAndTokenType` | Validate migration option and token type compatibility. |
| `validateActivationType` | Validate activation type. |
| `validateMigrationFeeOption` | Validate migration fee option. |
| `validateTokenDecimals` | Validate supported base-token decimals. |
| `validateLPPercentages` | Validate migrated-liquidity percentage split. |
| `validateCurve` | Validate curve checkpoint count, ordering, and bounds. |
| `validateTokenSupply` | Validate token supply against curve and vesting requirements. |
| `validateTokenAuthorityOptions` | Validate mint update-authority and mint-authority option. |
| `hasMintAuthority` | Check whether a token authority option assigns mint authority. |
| `validateTransferHookProgram` | Validate that a transfer-hook program id is not default, DBC, SPL Token, or Token 2022. |
| `validateTransferHookProgramExecutable` | Validate that a transfer-hook program id resolves to an executable account. |
| `validatePoolCreationFee` | Validate pool creation fee bounds. |
| `validateLiquidityVestingInfo` | Validate migrated-liquidity vesting schedule. |
| `validateMinimumLockedLiquidity` | Validate minimum locked liquidity requirements. |
| `validateMigratedCollectFeeMode` | Validate migrated-pool collect-fee mode. |
| `validateCompoundingFeeBps` | Validate DAMM v2 compounding fee bps. |
| `validateMigratedPoolFee` | Validate migrated-pool fee config. |
| `validateConfigParameters` | Validate complete `ConfigParameters` before config creation. |
| `validateBaseTokenType` | Validate base mint owner against expected token type. |
| `validateBalance` | Validate token or SOL balance before building a transaction. |
| `validateSwapAmount` | Validate nonzero swap amount. |
| `validateMigratedPoolBaseFeeMode` | Validate DAMM v2 migrated-pool base-fee mode. |
| `validateMarketCapFeeSchedulerRequiresPoolFeeBps` | Validate market-cap scheduler requirements for migrated-pool fees. |
| `validateMigrationFee` | Validate custom migration fee percentages. |
### Swap Quote Math
| Function | Use |
| - | - |
| `getSwapResult` | Execute shared swap quote simulation across the curve. |
| `swapQuote` | Legacy exact-in quote entry point. |
| `getSwapResultFromExactInput` | Simulate exact-input swap movement. |
| `getSwapResultFromPartialInput` | Simulate partial-fill swap movement. |
| `calculateBaseToQuoteFromAmountIn` | Calculate base-to-quote exact-input movement. |
| `calculateQuoteToBaseFromAmountIn` | Calculate quote-to-base exact-input movement. |
| `getSwapResultFromExactOutput` | Simulate exact-output swap movement. |
| `calculateBaseToQuoteFromAmountOut` | Calculate base-to-quote exact-output movement. |
| `calculateQuoteToBaseFromAmountOut` | Calculate quote-to-base exact-output movement. |
| `swapQuoteExactIn` | Preferred exact-in quote helper for `swap2`. |
| `swapQuotePartialFill` | Preferred partial-fill quote helper for `swap2`. |
| `swapQuoteExactOut` | Preferred exact-out quote helper for `swap2`. |
### Curve Math
| Function | Use |
| - | - |
| `getInitialLiquidityFromDeltaQuote` | Calculate initial liquidity from quote amount and square-root price range. |
| `getInitialLiquidityFromDeltaBase` | Calculate initial liquidity from base amount and square-root price range. |
| `getDeltaAmountBaseUnsigned` | Calculate unsigned base delta for a liquidity and price range. |
| `getDeltaAmountBaseUnsigned256` | Calculate unsigned base delta with 256-bit intermediate handling. |
| `getDeltaAmountBaseUnsignedUnchecked` | Calculate unsigned base delta without public bounds checks. |
| `getDeltaAmountQuoteUnsigned` | Calculate unsigned quote delta for a liquidity and price range. |
| `getDeltaAmountQuoteUnsigned256` | Calculate unsigned quote delta with 256-bit intermediate handling. |
| `getDeltaAmountQuoteUnsignedUnchecked` | Calculate unsigned quote delta without public bounds checks. |
| `getNextSqrtPriceFromInput` | Calculate next square-root price from input amount. |
| `getNextSqrtPriceFromOutput` | Calculate next square-root price from output amount. |
| `getNextSqrtPriceFromQuoteAmountOutRoundingDown` | Calculate next price for quote output with rounding down. |
| `getNextSqrtPriceFromBaseAmountOutRoundingUp` | Calculate next price for base output with rounding up. |
| `getNextSqrtPriceFromBaseAmountInRoundingUp` | Calculate next price for base input with rounding up. |
| `getNextSqrtPriceFromQuoteAmountInRoundingDown` | Calculate next price for quote input with rounding down. |
### Fee Math
| Function | Use |
| - | - |
| `toNumerator` | Convert bps to fee numerator for a denominator. |
| `getFeeMode` | Resolve fee collection behavior from collect-fee mode, direction, and referral state. |
| `getTotalFeeNumeratorFromIncludedFeeAmount` | Infer total fee numerator from an amount that already includes fee. |
| `getTotalFeeNumeratorFromExcludedFeeAmount` | Infer total fee numerator from an amount before fee. |
| `getTotalFeeNumerator` | Combine base fee, dynamic fee, and fee mode into total fee numerator. |
| `getFeeOnAmount` | Calculate fee charged on an amount. |
| `getExcludedFeeAmount` | Calculate fee amount excluded from input. |
| `getIncludedFeeAmount` | Calculate fee amount included in output. |
| `splitFees` | Split total fee into protocol, partner, creator, and referral components. |
### Pool Fee Math
| Function or class | Use |
| - | - |
| `new FeeRateLimiter(...)` | Create a base-fee handler for rate-limiter mode. |
| `FeeRateLimiter.validate` | Validate the rate-limiter handler against collect-fee and activation settings. |
| `FeeRateLimiter.getMinBaseFeeNumerator` | Return the minimum base-fee numerator for the rate limiter. |
| `FeeRateLimiter.getBaseFeeNumeratorFromIncludedFeeAmount` | Calculate base fee from an amount that includes fee. |
| `FeeRateLimiter.getBaseFeeNumeratorFromExcludedFeeAmount` | Calculate base fee from an amount before fee. |
| `new FeeScheduler(...)` | Create a base-fee handler for linear or exponential scheduler mode. |
| `FeeScheduler.validate` | Validate the scheduler handler. |
| `FeeScheduler.getMinBaseFeeNumerator` | Return the scheduler minimum base-fee numerator. |
| `FeeScheduler.getBaseFeeNumeratorFromIncludedFeeAmount` | Calculate scheduled base fee for an included-fee amount. |
| `FeeScheduler.getBaseFeeNumeratorFromExcludedFeeAmount` | Calculate scheduled base fee for an excluded-fee amount. |
| `getBaseFeeHandler` | Instantiate the correct base-fee handler from base-fee mode. |
| `isDynamicFeeEnabled` | Check whether dynamic fee config is active. |
| `getVariableFeeNumerator` | Calculate variable dynamic-fee numerator from volatility state. |
| `getFeeSchedulerMaxBaseFeeNumerator` | Return max base-fee numerator for scheduler mode. |
| `getFeeSchedulerMinBaseFeeNumerator` | Return min base-fee numerator for scheduler mode. |
| `getBaseFeeNumeratorByPeriod` | Calculate scheduler base-fee numerator for a period. |
| `getFeeNumeratorOnLinearFeeScheduler` | Calculate linear scheduler fee numerator. |
| `getFeeNumeratorOnExponentialFeeScheduler` | Calculate exponential scheduler fee numerator. |
| `getBaseFeeNumerator` | Calculate active base-fee numerator for scheduler mode. |
| `isRateLimiterApplied` | Check if rate limiter applies at the current point and trade direction. |
| `isZeroRateLimiter` | Check whether rate-limiter config is effectively zero. |
| `isNonZeroRateLimiter` | Check whether rate-limiter config is nonzero. |
| `getMaxIndex` | Calculate max rate-limiter fee index. |
| `getMaxOutAmountWithMinBaseFee` | Calculate max output amount that can use min base fee. |
| `getCheckedAmounts` | Calculate bounded amount slices for rate-limiter fee math. |
| `getFeeNumeratorFromExcludedAmount` | Calculate rate-limiter fee numerator from excluded amount. |
| `getRateLimiterExcludedFeeAmount` | Calculate excluded fee amount under rate-limiter math. |
| `getFeeNumeratorFromIncludedAmount` | Calculate rate-limiter fee numerator from included amount. |
| `getRateLimiterMinBaseFeeNumerator` | Calculate rate-limiter minimum base-fee numerator. |
### Math Utilities
| Function or class method | Use |
| - | - |
| `SafeMath.add` | Add two `BN` values. |
| `SafeMath.sub` | Subtract two `BN` values and throw on underflow. |
| `SafeMath.mul` | Multiply two `BN` values. |
| `SafeMath.div` | Divide two `BN` values and throw on division by zero. |
| `SafeMath.mod` | Modulo two `BN` values and throw on division by zero. |
| `SafeMath.shl` | Left shift a `BN`. |
| `SafeMath.shr` | Right shift a `BN`. |
| `pow` | Compute scaled exponentiation for `BN` values. |
| `mulDiv` | Multiply then divide with configured rounding. |
| `mulShr` | Multiply then right shift by an offset. |
| `sqrt` | Integer square root for `BN`. |
## Core Types
| Type group | Types |
| - | - |
| Program and IDL | `DynamicCurveProgram`, `DynamicBondingCurveTypes`, `DynamicBondingCurveIdl`. |
| Account states | `PoolConfig`, `ConfigWithTransferHook`, `VirtualPool`, `TransferHookPool`, `MeteoraDammMigrationMetadata`, `LockEscrow`, `PartnerMetadata`, `VirtualPoolMetadata`, `TokenBadge`. |
| Config structs | `ConfigParameters`, `PoolFeeParameters`, `DynamicFeeParameters`, `LiquidityDistributionParameters`, `LockedVestingParameters`, `LiquidityVestingInfoParameters`, `MigratedPoolMarketCapFeeSchedulerParameters`, `TransferHookAccountsInfo`. |
| Builder config inputs | `TokenConfig`, `FeeConfig`, `BaseFeeParams`, `FeeSchedulerParams`, `RateLimiterParams`, `MigrationConfig`, `MigrationFee`, `MigratedPoolFeeC프로젝트로 돌아가기