Skip to main content
Use the rust-sdk crate when you need Rust tooling around DAMM v2 quotes and initial pool math.

Install

If your project is in the same workspace as damm-v2, depend on the local crate by path:
If you vendor or pin it from Git, keep the rust-sdk and cp-amm revisions aligned so account structs, fee logic, and quote math match. The Rust library reads cp-amm account structs and math directly.

What It Provides

Program ID

The public DAMM v2 program ID is the same on mainnet and devnet:
The backing program crate is cp-amm 0.2.0.

Quote Inputs

Rust quote helpers expect a deserialized cp_amm::state::Pool and current chain context: Use the on-chain account data for transaction-critical quotes. API data is useful for discovery and charts, but the pool account is the source of truth for execution. The quote modules return the same SwapResult2 shape used by the program and TypeScript SDK, including claiming_fee, compounding_fee, protocol_fee, referral_fee, included_fee_input_amount, excluded_fee_input_amount, output_amount, next_sqrt_price, and amount_left.

Initial Price Helpers

Use the initial-price helpers when preparing pool creation inputs in Rust: For transaction construction, use the TypeScript SDK unless your Rust stack owns signing, simulation, and account planning.

Tests

The public repository includes Rust tests and fixtures for quote paths and initial price calculations:
These tests are suitable for quote-engine regression coverage. CPI programs should also add Anchor/local-validator tests for account metas, signer constraints, remaining accounts, and Token 2022 behavior.

Rust SDK Or CPI