TypeScript client for the Meteora DAMM V2 (CP-AMM) program, generated using Coda CLI.
bun add @macalinao/clients-meteora-damm-v2
import {
getSwapInstructionAsync,
fetchPool,
findPoolPda,
} from "@macalinao/clients-meteora-damm-v2";
// Find and fetch a pool
const [poolAddress] = await findPoolPda({
config: configAddress,
tokenAMint: tokenAMintAddress,
tokenBMint: tokenBMintAddress,
});
const pool = await fetchPool(rpc, poolAddress);
// Create a swap instruction (accounts are auto-derived)
const ix = await getSwapInstructionAsync({
pool: poolAddress,
inputTokenMint: tokenAMintAddress,
outputTokenMint: tokenBMintAddress,
userInputToken: userTokenAAccount,
userOutputToken: userTokenBAccount,
user: userSigner,
amountIn: 1000000n,
minimumAmountOut: 0n,
});
Copyright © 2025 Ian Macalinao
Licensed under the Apache License, Version 2.0