Skip to main content
Use CPI only when your Solana program must compose directly with Presale Vault. For off-chain apps, launch scripts, and dashboards, the TypeScript SDK is simpler and safer.
Do not hand-type account order from memory. Generate CPI bindings from the Presale Vault IDL or depend on the local Anchor crate with the cpi feature, then compare against SDK-built instructions for the same flow.

Program ID

The public program ID is the same for mainnet and devnet.

Dependency

Keep the local crate, IDL, deployed program, and TypeScript SDK revision aligned in tests.

CPI Instruction Scope

The full instruction list is documented in Program Instructions. CPI integrations most often need: Creator-managed flows such as presale initialization, Merkle root config, operator setup, creator withdrawal, fee collection, and unsold token action can also be called by CPI, but they require stricter authority and lifecycle planning.

Event CPI Accounts

Most account structs use #[event_cpi]. Generated clients include these accounts after the primary accounts: Omitting these accounts from a CPI call can cause account validation or account-count failures.

Account Planning

Read mints, vaults, token program flags, mode, whitelist mode, and registry state from the Presale account whenever possible. Avoid deriving business assumptions from user input alone.

Token 2022 Remaining Accounts

Presale Vault supports Token 2022 transfer hooks through RemainingAccountsInfo:
If a mint has a transfer-hook program, include the required hook accounts in the remaining accounts and set the matching slice length. If a mint does not have a hook program, do not pass transfer-hook accounts for that mint.

Common CPI Failures

Best Practices