Skip to main content
This page is based on the public declaration surface of @meteora-ag/cp-amm-sdk. Use it as the high-level map for the SDK, then open the package types when you need exact parameter shapes.

Dependencies

Important runtime dependencies:

Program ID

CpAmm constructs an Anchor Program from the packaged cp_amm IDL and the connection you provide.

Core Exports

Enums

Important Constants

Creating A Client

The client stores the connection-backed Anchor program and exposes read methods, quote methods, and unsigned transaction builders. The caller still sets the fee payer, recent blockhash, signs, simulates, and submits.

Complete Public Function Index

This section lists the public functions and methods exported by the SDK. Private helper methods emitted in declaration files are intentionally excluded.

CpAmm State And Discovery

CpAmm Position State Helpers

CpAmm Quote And Preparation Methods

CpAmm Transaction Builders

PDA Helpers

Token, Account, And Compute Helpers

UI, Price, Reward, And Account Filter Helpers

Token-2022 Helpers

Vesting Helpers

Validation Helpers

Common Fee Encoding Helpers

The same base-fee mode uses different byte layouts in initialize events and pool accounts. Decode EvtInitializePool base-fee data with Borsh decoders and pool-state base-fee data with pod-aligned decoders.

Compounding Liquidity Math

Concentrated Liquidity Math

Generic Liquidity Math

Liquidity Handler Classes

CompoundingLiquidityHandler and ConcentratedLiquidityHandler implement the same public method surface:

Base Fee Handler Classes

FeeRateLimiter, FeeTimeScheduler, and FeeMarketCapScheduler implement the same public method surface:

Base Fee And Pool Fee Math

Swap Quote Math

Math Utilities

Core Types

The SDK exports many parameter and result aliases so app code can keep transaction-building code typed:

Common Workflows

Fetch Pool And Build A Quote

getQuote2 is the preferred quote path for new integrations because it supports exact-in, partial-fill, and exact-out behavior.

Build A Swap Transaction

Rate-limiter pools require the instructions sysvar account on low-level swap builders. The TypeScript SDK detects rate-limiter pools in swap and swap2 when it has poolState; pass poolState to avoid an extra RPC read and to keep account planning explicit.

Decode Pool Fees

Use the pod-aligned decoders for pool-state bytes and Borsh decoders for event bytes.

Error Classes

The SDK exports typed errors that validation, quote, and math helpers may throw:

Notes