Note
This is the Anchor v1 copy of this example, kept for programs staying on the
Anchor v1 LTS line. Every anchor command on this page needs the v1 CLI:
avm install 1.1.2 && avm use 1.1.2. The Anchor v2 version of this example is in
../anchor.
Enable CPI Guard so certain token actions cannot run inside a CPI context.
See also: the repository catalog.
- CPI Guard extension
- Transfer restrictions in CPI
From this directory (tokens/token-extensions/cpi-guard/anchor/):
anchor buildPrerequisites: Agave CLI (version in Anchor.toml [toolchain]), Anchor.
Tests run in-process with LiteSVM. No local validator.
anchor testThis runs cargo test as configured in Anchor.toml. Tests call instruction handlers and check onchain state.
Read the program programs/ source and Anchor.toml for deployed program IDs. For deployment, use anchor build && anchor deploy against your target cluster.