Skip to main content
Use CPI when your Solana program needs to call Zap directly. Most client apps should use the TypeScript SDK instead because Zap flows require careful transaction ordering, token account setup, and downstream remaining accounts.

Program ID

Generated Bindings

For a Rust program in the same workspace, enable the Zap program crate with the cpi feature:
The crate name in Rust code is zap.

CPI Pattern

Anchor generates CPI helpers from the program crate. For low-level zap out:
The remaining accounts are forwarded by Zap to the whitelisted downstream swap instruction. Their order, signer flags, and writable flags must match the downstream program’s expected account list.

Common CPI Calls

The uninitialized DLMM account context name is spelled ZapInDlmmForUnintializedPositionCtx in the current Rust source. Use the generated binding name exactly.

Zap-Out CPI Requirements

Zap-In CPI Requirements

Zap does not emit its own custom events, but DAMM v2 and DLMM downstream CPI calls require their event authority accounts.

Token And Account Planning

Common CPI Failures

Best Practices