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 TypeScript source in damm-v1-sdk/ts-client. Use it as the high-level map for the SDK, then open the package types when you need exact parameter shapes.
import AmmImpl, {
  PROGRAM_ID,
  MAINNET_POOL,
  DEVNET_POOL,
  calculateSwapQuote,
  derivePoolAddress,
  type SwapQuote,
  type DepositQuote,
  type WithdrawQuote,
} from "@meteora-ag/dynamic-amm-sdk";

Dependencies

PackageVersion in local SDK
@coral-xyz/anchor0.29.0
@solana/web3.js1.98.0
@solana/spl-token^0.4.6
@meteora-ag/vault-sdk2.3.1
@meteora-ag/m3m31.0.10
bn.js5.2.1
decimal.js^10.4.1

Program IDs

ProgramID
DAMM v1Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB
DAMM v1 stagingammbh4CQztZ6txJ8AaQgPsWjd6o7GhmvopS2JAo5bCB
Dynamic Vault24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi
Metaplex metadatametaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s

Top-Level Exports

ExportUse
AmmImplMain SDK class for pool loading, quotes, transactions, configs, and locks.
ConstantProductSwap, StableSwapLocal curve implementations used by quote helpers.
DynamicAmmErrorSDK error decoder.
AmmIdl, VaultIdlBundled Anchor IDLs.
PROGRAM_ID, MAINNET_POOL, DEVNET_POOL, CURVE_TYPE_ACCOUNTSProgram constants, sample pool addresses, and depeg accounts.
CONSTANT_PRODUCT_ALLOWED_TRADE_FEE_BPS, STABLE_SWAP_ALLOWED_TRADE_FEE_BPSAllowed fee tiers for permissionless pool creation.
getDepegAccounts, getOnchainTimeAccount and clock helpers used by quotes.
calculateMaxSwapOutAmount, calculateSwapQuote, calculatePoolInfoQuote and pool information helpers.
checkPoolExists, getTokensMintFromPoolAddress, derivePoolAddressPool lookup and derivation helpers.
Type exportsAmmImplementation, DepositQuote, WithdrawQuote, SwapQuote, PoolState, LockEscrow, PoolInformation, curve types, and Bootstrapping.
Some PDA helpers are implemented in src/amm/utils.ts but are not top-level exports. Existing examples import them through package build paths.

Important Constants

ConstantValue
PROGRAM_IDEo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB
DEVNET_POOL.USDT_USDCBAHscmu1NncGS7t4rc5gSBPv1UFEMkvLaon1Ahdd5rHi
DEVNET_POOL.USDT_SOLBgf1Sy5kfeDgib4go4NgzHuZwek8wE8NZus56z6uizzi
DEVNET_POOL.SOL_MSOL2rkn2yM4wJcHPV57T8fPWeBksrfSpiNZoEjRgjtxNDEQ
MAINNET_POOL.USDT_USDC32D4zRxNc1EssbJieVHfPhZM3rH6CzfUPrWUuWxD9prG
MAINNET_POOL.USDC_SOL5yuefgbJJpmFNK2iiYbLSpv1aZXq7F9AUKkZKErTYCvs
MAINNET_POOL.SOL_STSOL7EJSgV2pthhDfb4UiER9vzTqe2eojei9GEQAQnkqJ96e
MAINNET_POOL.SOL_MSOLHcjZvfeSNJbNkfLD4eEcRBr96AD3w1GpmMppaeRZf7ur
CURVE_TYPE_ACCOUNTS.marinade8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC
CURVE_TYPE_ACCOUNTS.lido49Yi1TKkNyYjPAFdR9LBvoHcUjuPX4Df5T5yv39w2XTn
CONSTANT_PRODUCT_ALLOWED_TRADE_FEE_BPS[25, 100, 400, 600]
STABLE_SWAP_ALLOWED_TRADE_FEE_BPS[1, 4, 10, 100]
PERMISSIONLESS_AMP100
U64_MAX18446744073709551615

AmmImpl Static Methods

MethodReturnsUse
create(connection, pool, opt?)Promise<AmmImpl>Load one pool, vault state, reserves, LP supply, clock, depeg accounts, and computed pool info.
createMultiple(connection, poolList, opt?)Promise<AmmImpl[]>Batch-load multiple pools and shared account data.
createConfig(...)Promise<Transaction>Build an admin create_config transaction for a new config PDA index.
searchPoolsByToken(connection, tokenMint)Pool account listFind pools where the mint is token A or token B.
createPermissionlessPool(...)Promise<Transaction>Create a permissionless pool with stable or constant-product curve and fee tier.
createPermissionlessConstantProductPoolWithConfig(...)Promise<Transaction[]>Create a config-based constant-product pool. Supports optional initial LP lock and initial B-to-A swap.
createPermissionlessConstantProductPoolWithConfig2(...)Promise<Transaction[]>Create a config-based pool with optional activation point and optional stake-for-fee lock split.
createCustomizablePermissionlessConstantProductPool(...)Promise<Transaction>Create a customizable constant-product launch pool.
createPermissionlessConstantProductMemecoinPoolWithConfig(...)Promise<Transaction[]>Create or mint a token, create a config-based pool, and optionally lock/stake/swap liquidity.
getPoolConfigsWithPoolCreatorAuthority(connection, wallet, opt?)Config accountsFetch configs whose pool_creator_authority matches the wallet.
getPoolConfig(connection, config, opt?)Config accountFetch one config account.
getFeeConfigurations(connection, opt?)Config summary listFetch all config accounts and derived fee bps.
getLockedLpAmountByUser(connection, userPubKey, opt?)Map<string, LockEscrowAccount>Fetch lock escrows for one owner, keyed by pool address.
fetchMultipleUserBalance(connection, lpMintList, owner)Promise<BN[]>Fetch a wallet’s LP balances for multiple LP mints.

AmmImpl Instance Methods

MethodReturnsUse
updateState()Promise<void>Refresh pool, vault, clock, depeg accounts, and computed pool info.
getPoolTokenMint()PublicKeyReturn the pool LP mint.
getLpSupply()Promise<BN>Fetch current LP token supply.
getUserBalance(owner)Promise<BN>Fetch the owner’s LP token balance.
getSwapQuote(inTokenMint, inAmountLamport, slippage, swapInitiator?)SwapQuoteCompute exact-in swap output, minimum output, fee, and price impact.
getMaxSwapInAmount(tokenMint)BNEstimate max source amount for a swap.
getMaxSwapOutAmount(tokenMint)BNEstimate max output amount for a token mint.
swap(owner, inTokenMint, inAmountLamport, outAmountLamport, referralOwner?)Promise<Transaction>Build an exact-in swap transaction.
swapAndStakeForFee(owner, inTokenMint, inAmount, minOut, outAmount, stakeForFee)Promise<Transaction[]>Build a swap followed by a Stake2Earn stake transaction.
getDepositQuote(tokenAInAmount, tokenBInAmount, balance, slippage)DepositQuoteQuote a balanced or stable imbalanced deposit.
deposit(owner, tokenAInAmount, tokenBInAmount, poolTokenAmount)Promise<Transaction>Build a deposit transaction.
getWithdrawQuote(lpTokenAmount, slippage, tokenMint?)WithdrawQuoteQuote balanced withdrawal or stable single-sided withdrawal.
withdraw(owner, lpTokenAmount, tokenAOutAmount, tokenBOutAmount)Promise<Transaction>Build a withdrawal transaction.
getUserLockEscrow(owner)Promise<LockEscrow | null>Fetch a lock escrow and derive claimed/unclaimed fee data.
getLockedLpAmount()Promise<BN>Return pool-level locked LP amount from the pool and legacy LP ATA path.
lockLiquidity(owner, amount, feePayer?, opt?)Promise<Transaction>Lock LP tokens into a lock escrow, optionally splitting stake-for-fee liquidity.
claimLockFee(owner, maxAmount, payer, receiver?, tempWSolAcc?)Promise<Transaction>Build the older lock-fee claim transaction.
claimLockFee2(owner, maxAmount, payer, receiver)Promise<Transaction>Build the newer lock-fee claim transaction.
moveLockedLP(owner, newOwner, maxAmount, payer?)Promise<Transaction>Move locked LP between two owners’ lock escrows.
partnerClaimFees(partnerAddress, maxAmountA, maxAmountB)Promise<Transaction>Claim partner fees for config-created pools.

Getters

GetterTypeUse
decimalsnumberMax decimals between token A and token B.
isStablePoolbooleanWhether poolState.curveType is stable.
isLSTbooleanWhether the stable curve has a non-none depeg type.
feeBpsBNCurrent trade fee converted to bps.
depegTokenMint | nullHeuristic depeg-side token mint for LST pools.

Quote Types

TypeFields
SwapQuoteswapInAmount, swapOutAmount, minSwapOutAmount, fee, priceImpact.
DepositQuotepoolTokenAmountOut, minPoolTokenAmountOut, tokenAInAmount, tokenBInAmount.
WithdrawQuotepoolTokenAmountIn, minTokenAOutAmount, minTokenBOutAmount, tokenAOutAmount, tokenBOutAmount.
PoolInformationtokenAAmount, tokenBAmount, virtualPrice, virtualPriceRaw.
LockEscrowaddress, amount, claimed token A/B fees, unclaimed LP/token A/token B fees.

Deep PDA And Utility Helpers

These helpers exist in src/amm/utils.ts. Import paths can vary between CJS and ESM builds, so prefer top-level exports where available.
HelperUse
derivePoolAddress(...)Derive permissionless pool PDA for stable or constant-product pools. Top-level export.
derivePoolAddressWithConfig(tokenA, tokenB, config, programId)Derive config-based constant-product pool PDA.
deriveCustomizablePermissionlessConstantProductPoolAddress(tokenA, tokenB, programId)Derive customizable constant-product pool PDA.
deriveConfigPda(index, programId)Derive config PDA from an index.
deriveProtocolTokenFee(poolAddress, tokenMint, programId)Derive protocol fee token account PDA.
deriveLockEscrowPda(pool, owner, programId)Derive a lock escrow PDA.
deriveMintMetadata(lpMint)Derive the Metaplex metadata PDA for an LP mint.
getAssociatedTokenAccount(tokenMint, owner)Return the canonical SPL associated token account.
calculateSwapQuote(...)Lower-level swap quote helper used by pool.getSwapQuote.
calculatePoolInfo(...)Compute token A/B amounts and virtual price from pool and vault data.
getDepegAccounts(connection, poolStates)Fetch remaining depeg accounts for LST/stable pools.
calculateUnclaimedLockEscrowFee(...)Convert lock escrow virtual-price movement into unclaimed LP fee.

Common Workflow

StepSDK call
Read pool stateconst pool = await AmmImpl.create(connection, poolAddress)
Quote a swapconst quote = pool.getSwapQuote(inMint, inAmount, slippage)
Build a transactionconst tx = await pool.swap(user, inMint, quote.swapInAmount, quote.minSwapOutAmount)
Sign and submitSign with your wallet or backend signer, then send through your RPC pipeline.
Refresh before the next quoteawait pool.updateState()

Integration Notes

AreaNote
Amount unitsAll token amounts are raw integer token units. Use BN; do not pass UI decimals.
SlippageSDK slippage parameters are percentages, not bps.
Returned transactionsTransactions are unsigned. Some pool creation helpers return multiple transactions.
Native SOLSwap/deposit/withdraw helpers add wrap or unwrap instructions for native SOL paths.
Dynamic VaultsQuotes depend on Dynamic Vault state and current clock, not only the DAMM v1 pool account.
Depeg poolsStable LST pools require depeg account reads for accurate quotes and swap account lists.
Config poolsPrivate configs require the configured pool_creator_authority signer.