> ## 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.

# 配置

> 在 TypeScript 中配置 LiteSVM 的构建器方法

LiteSVM 使用构建器模式进行配置。所有方法都会返回 `LiteSVM`,
以便链式调用。

## 典型的测试设置

```typescript
import { createClient, generateKeyPairSigner } from "@solana/kit";
import { litesvm } from "@solana/kit-plugin-litesvm";
import { signer } from "@solana/kit-plugin-signer";

const mySigner = await generateKeyPairSigner();
const client = createClient().use(signer(mySigner)).use(litesvm());

client.svm
  .withSigverify(false) // Skip signature verification (faster)
  .withBlockhashCheck(false) // Skip blockhash validation (simpler)
  .withTransactionHistory(100n); // Store last 100 transactions
```

`litesvm()` 客户端已经加载了 sysvar、内置程序、
预编译程序和默认程序,因此典型的设置只需调整
所需的检查项。

## 签名与 Blockhash

### withSigverify

```typescript
withSigverify(sigverify: boolean): LiteSVM
```

启用或禁用签名验证。

```typescript
// Disable for faster tests (default is enabled)
client.svm.withSigverify(false);

// Enable for production-like testing
client.svm.withSigverify(true);
```

<Info>
  禁用签名验证会让测试运行得更快,但也会降低真实性。
</Info>

### withBlockhashCheck

```typescript
withBlockhashCheck(check: boolean): LiteSVM
```

启用或禁用 blockhash 过期检查。

```typescript
// Disable for simpler tests
client.svm.withBlockhashCheck(false);
```

## 程序与 Sysvar

这些方法会将程序和 sysvar 加载到虚拟机中。`litesvm()` 客户端
已经包含了所有这些内容,因此只有在重置客户端,或需要基于 `litesvm` 包设置
一个空白的 `LiteSVM.default()` 实例时,才需要用到它们。

### withSysvars

```typescript
withSysvars(): LiteSVM
```

将 Clock、Rent、EpochSchedule 和其他 sysvar 重置为默认值。
新建的客户端已经自带 sysvar,因此只有在需要撤销更改时才需要使用此方法。
在 `setClock` 或 `warpToSlot` 之后调用它,会丢弃你设置的时钟。

```typescript
client.svm.setClock(myClock);
client.svm.withSysvars(); // the clock is back to its default
```

### withBuiltins

```typescript
withBuiltins(): LiteSVM
```

添加运行时的内置程序，包括 System Program、BPF 加载器、Vote
和 Compute Budget。

```typescript
client.svm.withBuiltins();
```

### withPrecompiles

```typescript
withPrecompiles(): LiteSVM
```

添加签名验证预编译程序，包括 ed25519、secp256k1 和 secp256r1。

```typescript
client.svm.withPrecompiles();
```

### withDefaultPrograms

```typescript
withDefaultPrograms(): LiteSVM
```

添加默认程序，包括 Token、Token-2022、Associated Token Account、Memo、
Stake 和 Address Lookup Table。

```typescript
client.svm.withDefaultPrograms();
```

## 资源限制

### withLamports

```typescript
withLamports(lamports: bigint): LiteSVM
```

设置内部水龙头账户的余额,`airdrop()` 会从该账户中划拨资金。
超过此余额的空投将会失败。

```typescript
client.svm.withLamports(1_000_000_000n); // the faucet holds 1 SOL
```

### withLogBytesLimit

```typescript
withLogBytesLimit(limit?: bigint): LiteSVM
```

设置日志输出的字节数上限。

```typescript
client.svm.withLogBytesLimit(10000n);
```

### withTransactionHistory

```typescript
withTransactionHistory(capacity: bigint): LiteSVM
```

启用交易历史记录存储。

```typescript
// Store last 100 transactions
client.svm.withTransactionHistory(100n);
```

## 功能集

### withFeatureSet

```typescript
withFeatureSet(featureSet: FeatureSet): LiteSVM
```

配置功能集,以便针对特定的 Solana 版本进行测试。
