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 guide shows how to install and initialize the official DAMM v2 TypeScript SDK, @meteora-ag/cp-amm-sdk. Before you begin, here are the main resources:

TypeScript SDK

Public SDK source, examples, tests, and generated cp_amm IDL.

NPM Package

Published @meteora-ag/cp-amm-sdk package.

Installation

To use the SDK in your project, install it with your preferred package manager:
npm install @meteora-ag/cp-amm-sdk @solana/web3.js @coral-xyz/anchor bn.js

Initialization

import { Connection, PublicKey } from "@solana/web3.js";
import { CpAmm } from "@meteora-ag/cp-amm-sdk";

const connection = new Connection("https://api.mainnet-beta.solana.com", "confirmed");
const cpAmm = new CpAmm(connection);

const pool = new PublicKey("POOL_ADDRESS");
const poolState = await cpAmm.fetchPoolState(pool);
You can also find pool addresses with the Data API:
curl "https://damm-v2.datapi.meteora.ag/pools?page=1&page_size=20"

Program ID

The SDK uses the public DAMM v2 program ID by default:
cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG

Reference

SDK Examples

Explore full transaction flows, including pool initialization, swaps, liquidity, and more.

SDK Reference

Access the full method map, PDA helpers, and fee helpers for DAMM v2.

Testing the SDK

The SDK repository includes Vitest and Bankrun tests. They use the SDK source and a local program fixture, so they are best for SDK contributors and regression testing. App integrators should also test against devnet or their own local validator flow before shipping transaction code.
git clone https://github.com/MeteoraAg/damm-v2-sdk.git
cd damm-v2-sdk
pnpm install
pnpm run build
pnpm run check-types
pnpm test

Faucets

Devnet Faucet

Use this when your devnet test wallet needs SOL for fees and rent.