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

# 概览

> 使用 Solana Tracker 托管的 Raptor Swap API 获取 Solana 报价与构建兑换交易——无需运行客户端，仅在确有需要时再自托管二进制。

<Note>
  **公开测试** — 在 [Discord](https://discord.gg/JH2e9rR9fc) 上加入以获取支持咨询。
  Raptor 目前免费使用,没有速率限制。
</Note>

## 如何使用 Raptor

**你不需要运行 Raptor 客户端或服务器。** 从你的应用、后端或机器人直接调用 Solana Tracker 的托管 API——获取报价、构建兑换交易、在用户钱包中签名后发回即可。无需二进制、无需配置 RPC、也无需运营池索引。

<Info>
  **托管 API（大多数集成推荐）**

  * **HTTP：** `https://raptor-beta.solanatracker.io`
  * **WebSocket：** `wss://raptor-beta.solanatracker.io`

  从 [Swap API 指南](/cn/guides/swap-api) 开始，了解完整流程与可复制示例。各端点见 [HTTP API 参考](/cn/raptor/http/get-swap-quote) 与下方 [WebSocket](#websocket) 章节。
</Info>

<CardGroup cols={2}>
  <Card title="Swap API 指南" icon="book-open" iconType="duotone" href="/cn/guides/swap-api">
    分步流程：报价 → 构建 → 签名 → 发送。支持 curl、fetch 与 WebSocket。
  </Card>

  <Card title="发送交易" icon="paper-plane" iconType="duotone" href="/cn/raptor/transactions">
    提交已签名兑换并追踪确认状态。
  </Card>
</CardGroup>

<Note>
  **自托管（可选）** — 仅当你需要自己的 Raptor 实例时。[GitHub 二进制发布](https://github.com/solanatracker/raptor-binary)。CLI 参数与环境变量见下方 [自托管（可选）](#自托管可选)。
</Note>

***

## 端点

Raptor 的基本流程很简单:获取报价、构建交易、用用户钱包签名、发送,然后追踪状态。

### Swap

| 端点                            | 描述                                       |
| ----------------------------- | ---------------------------------------- |
| `GET /quote`                  | 在构建交易之前获取预期输出量和路径                        |
| `POST /swap`                  | 构建带有优先费计算、计算预算覆盖、可选 SOL 小费和目标账户支持的完整兑换交易 |
| `POST /swap-instructions`     | 仅构建兑换指令(不带交易包装)                          |
| `POST /quote-and-swap`        | 在单个请求中合并报价和兑换,可选小费、费用配置和交易调优(可选功能)       |
| `POST /send-transaction`      | 通过 Yellowstone Jet TPU 发送交易,自动重发并追踪确认    |
| `GET /transaction/:signature` | 追踪已发送交易状态、延迟和解析后的事件                      |

### 分析

| 端点            | 描述                               |
| ------------- | -------------------------------- |
| `GET /health` | 带有详细状态(池、缓存、Yellowstone 连接)的健康检查 |

***

## WebSocket

| 特性             | 详情                                                 |
| -------------- | -------------------------------------------------- |
| `/stream`      | 带有订阅管理的实时报价流                                       |
| `/stream/swap` | 带有预构建交易(准备签名)的实时流式兑换报价,包括小费支持                      |
| 基于 Slot 的更新    | 当池状态变化时自动重新计算报价                                    |
| 不活动重发          | `/stream/swap` 在 10 个 slot 没有更新后会重发最新兑换交易,帮助避免交易过期 |

***

<Info>
  **程序 ID - Mainnet:** `RaptorD5ojtsqDDtJeRsunPLg6GvLYNnwKJWxYE4m87`
</Info>

## 支持的 DEX

### Raydium

* Raydium AMM
* Raydium CLMM
* Raydium CPMM
* Raydium LaunchLab/Launchpad

### Meteora

* Meteora DLMM
* Meteora Dynamic AMM
* Meteora DAMM (Dynamic AMM V2)
* Meteora Curve
* Meteora DBC (Dynamic Bonding Curve)

### Orca

* Whirlpool (legacy)
* Whirlpool V2

### 联合曲线

* Pump.fun
* Pumpswap
* Heaven (Buy/Sell)
* MoonIt (Buy/Sell)
* Boopfun (Buy/Sell)

### PropAMM

* Humidifi
* Tessera
* Solfi V1/V2
* AlphaQ
* ZeroFi
* BisonFi
* GoonFi V2

### 其他

* FluxBeam
* PancakeSwap V3

***

## 路由

### 多跳(Multi-Hop)

* 最多 4 跳路径以获得最佳定价
* 感知路径的滑点计算(考虑多跳风险)
* DEX 特定的路由偏好
* 按地址列表过滤池
* 通过 txt 文件的 mint 白名单
* 仅直接路径模式(`onlyDirectRoutes` / `maxHops=1`)
* 循环套利选项

### 滑点

* 基于波动性和路径复杂度的动态滑点
* 感知路径的多跳滑点调整
* 手动滑点覆盖(数值或 `"dynamic"`)
* 带有滑点保护的最低输出量计算

### 平台费

* 从输入或输出代币中扣取费用
* 可配置的费用基点(最高 10%)
* 费用钱包指定
* 正向滑点的额外收费
* 在报价和兑换中自动调整费用

### 小费和交易控制

* 通过 `tipAccount` 和 `tipLamports` 可选的原生 SOL 小费
* 交易版本选择(`V0` 或 `LEGACY`)
* 计算单元价格覆盖(`computeUnitPriceMicroLamports`)
* 计算单元限制覆盖(`computeUnitLimit`)
* 最大优先费上限(`maxPriorityFee`)
* 可选的目标代币账户覆盖(`destinationTokenAccount`)

***

## 优先费

### 动态计算

* 针对路径的优先费计算
* DEX 特定的费用调整
* 近期费用数据追踪(已追踪 slot、总费用)
* 最大费用上限和覆盖

### 优先级

| 等级                    | 用例   |
| --------------------- | ---- |
| `Min` / `Low`         | 节省成本 |
| `Auto` / `Medium`     | 推荐默认 |
| `High` / `VeryHigh`   | 优先速度 |
| `Turbo` / `UnsafeMax` | 最大速度 |

***

## 交易管理

### Yellowstone Jet TPU

* 交易发送
* 自动重发并对齐 slot
* 多身份支持(默认 4,可配置)

### 追踪

* 实时状态监控(`pending` / `confirmed` / `failed` / `expired`)
* 延迟测量(发送到确认)
* 解析 Raptor 程序事件
* 原始交易存储
* 自动清理

### 速率限制

* 可配置 RPS(一般使用很少的 RPC 调用)

***

## 自托管（可选）

以下内容仅在你自行运行 [Raptor 二进制](https://github.com/solanatracker/raptor-binary) 时需要。若使用上方托管 API，可忽略 CLI 参数与环境变量。

### CLI 标志

### 帮助与版本

```
-h, --help       Show help message
-v, --version    Show version information
```

### 池索引器

```
--no-pool-indexer          Disable pool indexer client (Yellowstone only)
--skip-pool-indexer-wait   Skip startup wait for pool indexer sync readiness
```

### 路由过滤器

```
--include-dexes <DEXES>    Only include these DEXes (comma-separated)
--exclude-dexes <DEXES>    Exclude these DEXes (comma-separated)
--include-mints-file <PATH>  Only use pools touching mints in this txt file
--include-pools-file <PATH>  Only use pools listed in this txt file
```

### 白名单文件格式

`--include-mints-file` 和 `--include-pools-file` 都期望一个每行一个 pubkey 的纯文本文件。

示例:

```text theme={null}
So11111111111111111111111111111111111111112
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
# comments are allowed
```

* 空行被忽略
* `#` 表示注释开始
* mint 白名单保留 `token_a` 或 `token_b` 之一匹配所列 mint 的任何池
* 池白名单仅保留所列的池地址
* 如果与 DEX 过滤器一起使用,两种过滤器都会生效

### 性能

```
--workers <N>              Number of worker threads (default: CPU cores)
--low-memory               Enable low-memory mode with automatic cache clearing
--memory-limit <MB>        Memory limit in MB (default: 80% of system RAM)
```

### 特性开关

```
--enable-arbitrage         Enable circular arbitrage (same input/output mint)
-s, --enable-quote-and-swap    Enable the /quote-and-swap endpoint
--rpc-rate-limit <N>       Limit RPC calls to N per second (default: unlimited)
--enable-yellowstone-jet   Enable Yellowstone Jet TPU sender for /send-transaction
--enable-websocket         Enable WebSocket streaming quotes at /stream
```

### Yellowstone Jet TPU

```
--jet-identity <PATH>      Path to identity keypair for Jet TPU (optional)
--jet-identities <N>       Number of random identities for Jet (default: 4)
--tx-cache-ttl <SECS>      Transaction cache TTL in seconds (default: 30)
--tx-pending-expiry <SECS> Pending transaction expiry in seconds (default: 120)
```

***

## 请求选项

`POST /swap`、`POST /quote-and-swap` 和 `/stream/swap` 订阅支持的常见兑换构建字段包括:

* `dexes` — 逗号分隔的 DEX 白名单
* `pools` — 逗号分隔的池白名单
* `maxHops` — 最大路径深度(1-4)
* `onlyDirectRoutes` — 仅强制直接路径
* `feeAccount`、`feeBps`、`feeFromInput`、`chargeBps` — 平台费控制
* `priorityFee`、`maxPriorityFee` — 动态或固定优先费控制
* `computeUnitPriceMicroLamports`、`computeUnitLimit` — 计算预算覆盖
* `txVersion`、`asLegacyTransaction` — 交易格式控制
* `tipAccount`、`tipLamports` — 可选 SOL 小费转账
* `destinationTokenAccount` — 自定义输出目标代币账户

***

## 环境变量

### CLI 标志等效项

| 变量                       | 标志                         |
| ------------------------ | -------------------------- |
| `NO_POOL_INDEXER`        | `--no-pool-indexer`        |
| `SKIP_POOL_INDEXER_WAIT` | `--skip-pool-indexer-wait` |
| `INCLUDE_DEXES`          | `--include-dexes`          |
| `EXCLUDE_DEXES`          | `--exclude-dexes`          |
| `INCLUDE_MINTS_FILE`     | `--include-mints-file`     |
| `INCLUDE_POOLS_FILE`     | `--include-pools-file`     |
| `WORKER_THREADS`         | `--workers`                |
| `ENABLE_ARBITRAGE`       | `--enable-arbitrage`       |
| `ENABLE_QUOTE_AND_SWAP`  | `--enable-quote-and-swap`  |
| `RPC_RATE_LIMIT`         | `--rpc-rate-limit`         |
| `ENABLE_YELLOWSTONE_JET` | `--enable-yellowstone-jet` |
| `JET_IDENTITY`           | `--jet-identity`           |
| `JET_NUM_IDENTITIES`     | `--jet-identities`         |
| `TX_CACHE_TTL_SECS`      | `--tx-cache-ttl`           |
| `TX_PENDING_EXPIRY_SECS` | `--tx-pending-expiry`      |
| `ENABLE_WEBSOCKET`       | `--enable-websocket`       |
| `LOW_MEMORY_MODE`        | `--low-memory`             |
| `MEMORY_LIMIT_MB`        | `--memory-limit`           |

### 附加变量

| 变量                     | 描述                          |
| ---------------------- | --------------------------- |
| `RPC_URL`              | Solana RPC 端点               |
| `YELLOWSTONE_ENDPOINT` | Yellowstone gRPC 端点         |
| `YELLOWSTONE_TOKEN`    | Yellowstone 认证令牌(可选)        |
| `BIND_ADDR`            | 服务器绑定地址(默认: `0.0.0.0:8080`) |
