Skip to main content
These examples are based on the local damm-v1-sdk/ts-client/src/examples files and public SDK methods. They focus on transaction construction patterns. For the full method catalog, see the SDK Reference.

Setup

Use devnet while testing. The DAMM v1 program ID is the same for devnet and mainnet:

Fetch Pool State

AmmImpl.create reads the pool, both Dynamic Vault accounts, vault token accounts, vault LP mints, pool-held vault LP token accounts, clock, and depeg accounts when required.

Quote And Swap

The recommended swap flow is:
  1. Load the pool.
  2. Quote with getSwapQuote.
  3. Build the swap transaction with minSwapOutAmount.
  4. Sign, simulate when appropriate, and send.
Pass a referralOwner as the optional fifth pool.swap argument when routing a host fee account for referral flows.

Deposit Liquidity

For a balanced deposit, provide one token-side amount to getDepositQuote with balance = true; the SDK computes the other side from pool state.
For stable pools, the SDK can also quote imbalanced deposits by calling getDepositQuote(tokenAAmount, tokenBAmount, false, slippagePercent).

Withdraw Liquidity

For stable pools, pass a token mint as the third getWithdrawQuote argument to quote a single-sided withdrawal.

Create A Config-Based Pool

createPermissionlessConstantProductPoolWithConfig returns an array of transactions because vault creation, pool creation, optional locking, and optional initial swap can require multiple transactions.
Use createPermissionlessConstantProductPoolWithConfig2 when you need to pass an activationPoint accepted by the selected config.

Find Authorized Configs

Public configs have pool_creator_authority set to the default pubkey. Private configs require the configured creator signer.

Lock LP And Claim Fees

claimLockFee2 is the newer claim helper. Use claimLockFee only when you need the older wrapped-SOL receiver behavior.