Program ID
Generated Bindings
Generate bindings from the IDL with Anchor’sdeclare_program!. Do not type account orders from memory. A misplaced optional account or remaining account is the usual cause of a failing CPI.
The IDL ships in the Zap SDK repository at src/idl/zap/idl.json. declare_program!(zap) reads idls/zap.json. The macro looks for an idls directory in the crate directory and then in each parent directory, and uses the nearest one. Copy the file from the SDK release you pin and save it as idls/zap.json.
-f flag makes curl fail instead of saving an error page as the IDL. Take the IDL from the SDK release you pin, and update it when you upgrade the SDK.
declare_program!(zap) creates a zap module in your crate. The examples on this page use zap::cpi and zap::cpi::accounts from that module.
CPI Pattern
declare_program!(zap) generates the CPI helpers. For low-level zap out:
Common CPI Calls
declare_program! names each accounts struct from the instruction name. The Ctx suffix on the program’s Rust accounts structs is not part of these types. CpiContext::new takes zap::ID.
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.

