Practical overview
When it fits
Use it when an Anchor-based Solana program needs typed wrappers or CPI helpers for a Solana program that was not written with Anchor.
Who it is for
- Rust developers building Solana programs with Anchor.
- Teams integrating non-Anchor Solana program interfaces, including the Mango Markets v3 example shown in the README.
Documented uses
- Represent a non-Anchor program with an Anchor-compatible typed program account.
- Assemble typed CPI accounts and invoke a Mango Markets v3 perpetual-order instruction from a Rust Solana program.
- Use the repository’s v3 SplGovernanceV3 wrapper.
Requirements & limits
- The README’s worked CPI example targets Mango Markets v3 and a perpetual-order instruction.
- The documented dependency uses version 0.1.0 from the Git repository and offers development and production feature selections alongside no-entrypoint.
- The README identifies SplGovernanceV3 in v3 contents; the detailed usage example is for Mango Markets v3.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Add anchor-comp to a Rust Solana program
Configure a Rust Solana program to use anchor-comp for Anchor-compatible CPI integration.
Before you start
- A Rust Solana program using Anchor.
Steps
Add the documented anchor-comp Git dependency to the program's Cargo.toml.
Choose the documented
developmentorproductionfeature alongsideno-entrypoint.
Expected outcome
The program's dependency configuration includes anchor-comp, ready for CPI integration in its Rust code.
Guide limitations
- The example demonstrates a Mango Markets v3 CPI; it does not provide a complete runnable program or deployment procedure.
Construct a Mango Markets v3 perp-order CPI context
Follow the README's example structure for invoking `place_perp_order2` from a Rust Solana instruction.
Before you start
- A Rust Solana program configured to use anchor-comp.
- Anchor instruction accounts for the Mango program, Mango group and account, owner, cache, perp market, bids, asks, and event queue.
Steps
Import
anchor_comp::mango_markets_v3andMangoMarketV3, and declare the Mango program account as `ProgramBuild a
mango_markets_v3::PlacePerpOrder2account struct by converting the instruction's corresponding account fields withto_account_info().Create a
CpiContextfrom the Mango program account and the CPI accounts.Call
mango_markets_v3::place_perp_order2with that context and the documented order arguments; the example applies.with_signer(depository_pda_signer)to the context.
Expected outcome
The instruction follows the documented pattern for assembling and issuing a Mango Markets v3 perp-order CPI.
Guide limitations
- The example contains ellipses and references variables and account fields it does not define, so it is not a complete standalone implementation.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- UXDProtocol/anchor-comp · Official homepage title · retained in its source language

