> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Anchor 程序示例

> 查看相关项目链接，了解如何使用 litesvm 进行 anchor 程序测试

<Note>
这两个仓库的 README 都要求运行 `anchor build && cargo test`。对于当前版本的 Anchor 和 Solana CLI，请改为执行以下步骤：

```bash
anchor keys sync
anchor build --arch v0
# 仅 Anchor Escrow 需要：其测试会从 idls/ 读取 IDL
cp target/idl/anchor_escrow.json idls/
cargo test
```

`anchor keys sync` 会把程序 ID 设置为你本地的部署 keypair（测试会加载它），这样程序就不会因 `DeclaredProgramIdMismatch` 而失败。
`--arch v0` 会构建 SBPF v0 程序，这些仓库所使用的 LiteSVM 版本可以加载此类程序。若使用 Anchor 1.1.x，请改用
[anchor-litesvm 快速入门](/developers/docs/tools/litesvm/additional-crates/testing-with-anchor-litesvm#installation)
中的构建命令。
</Note>

## `litesvm` crate 示例

<Columns cols={2}>
  <Card title="Anchor CRUD 应用" href="https://github.com/brimigs/anchor-crud-litesvm">
    数据处理示例
  </Card>
</Columns>

## `litesvm-token` crate 示例

<Columns cols={2}>
  <Card title="Anchor Escrow 应用" href="https://github.com/brimigs/anchor-escrow-with-litesvm">
    代币处理示例
  </Card>
</Columns>
