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

# DFlow 交易技能

> 结合 DFlow 交易 API 与 Helius 基础设施。涵盖现货交易、预测市场、实时市场流、身份验证和交易提交。

**DFlow** 技能使您的 AI 助手成为构建 Solana 交易应用的专家。它结合了 [DFlow's](https://pond.dflow.net) 交易 API —— 现货交易、预测市场、实时流和身份验证 —— 以及 Helius 基础设施进行交易提交、费用优化、资产查询和链上监控。

<Info>
  **Claude Code:** `/helius:dflow`（通过 [插件](/zh/agents/claude-code-plugin)）或自动调用（独立）。**Codex:** `$helius-dflow`（自动发现自 `.agents/skills/`）。**API / Cursor / ChatGPT:** 使用预构建的[系统提示变体](/zh/agents/skills/overview#using-skills-across-platforms)。
</Info>

## 涵盖内容

DFlow 技能在 DFlow 和 Helius 工具之间引导 AI：

| 领域          | 使用的 API                      | MCP 工具                                                                    |
| ----------- | ---------------------------- | ------------------------------------------------------------------------- |
| **现货交易**    | DFlow 交易 API + Helius Sender | `getPriorityFeeEstimate`, `getSenderInfo`, `transferSol`, `transferToken` |
| **预测市场**    | DFlow 订单 API + 身份验证          | `getPriorityFeeEstimate`, `parseTransactions`                             |
| **实时市场数据**  | DFlow WebSockets             | DFlow MCP 工具                                                              |
| **链上监控**    | 增强型 WebSockets, LaserStream  | `transactionSubscribe`, `accountSubscribe`, `laserstreamSubscribe`        |
| **投资组合与发现** | DAS API, Wallet API          | `getAssetsByOwner`, `getWalletBalances`, `getWalletHistory`               |
| **交易提交**    | Helius Sender                | `getPriorityFeeEstimate`, `getSenderInfo`                                 |
| **身份验证**    | DFlow Proof                  | DFlow MCP 工具                                                              |

## 前提条件

此技能需要两个 MCP 服务器：

### Helius MCP 服务器（必需）

[Helius MCP 服务器](/zh/agents/mcp) 提供用于交易提交、资产查询和链上流的区块链工具。

```bash theme={"system"}
claude mcp add helius npx helius-mcp@latest
```

### DFlow MCP 服务器（推荐）

DFlow MCP 服务器提供查询 API 详情、响应模式和代码示例的工具。如果未安装 MCP，DFlow API 也可以通过 fetch 直接调用。

```bash theme={"system"}
claude mcp add --transport http DFlow https://pond.dflow.net/mcp
```

<Note>
  如果通过 [Claude Code 插件](/zh/agents/claude-code-plugin) 安装，则两个 MCP 服务器会自动启动。
</Note>

## 独立安装

<Steps>
  <Step title="克隆存储库">
    ```bash theme={"system"}
    git clone https://github.com/helius-labs/core-ai.git
    cd core-ai/helius-skills/helius-dflow
    ```
  </Step>

  <Step title="运行安装脚本">
    ```bash theme={"system"}
    ./install.sh
    ```

    安装到 `~/.claude/skills/helius-dflow/`。

    **选项：**

    * `./install.sh --project` — 安装到当前项目
    * `./install.sh --path /custom/path` — 安装到自定义目录
  </Step>

  <Step title="安装 MCP 服务器">
    ```bash theme={"system"}
    claude mcp add helius npx helius-mcp@latest
    claude mcp add --transport http DFlow https://pond.dflow.net/mcp
    ```
  </Step>

  <Step title="设置您的 API 密钥">
    **Helius:**

    ```bash theme={"system"}
    export HELIUS_API_KEY=YOUR_API_KEY
    ```

    **DFlow:** REST 开发端点无需 API 密钥（有速率限制）。WebSockets 和生产使用需要从 [pond.dflow.net/build/api-key](https://pond.dflow.net/build/api-key) 获取密钥。
  </Step>
</Steps>

## 示例提示

安装后，可以用简单的英语问：

* "使用 DFlow 和 Helius Sender 构建交换接口"
* "创建预测市场交易界面"
* "流式传输此预测市场的实时价格..."
* "构建一个交易 memecoins 的交易机器人"
* "告诉我如何为预测市场集成 Proof KYC"
* "构建一个带有实时代币价格的投资组合仪表板"

## 综合工作流

DFlow 技能在跨多个 API 的任务中表现出色。以下是 AI 自动处理的常见模式：

### 交易/交易应用

DFlow Trading API 用于报价和路由，Helius Sender 用于交易提交，DAS API 用于代币列表，Priority Fee API 用于优化费用。

### 预测市场界面

DFlow Metadata API 用于市场发现，DFlow Order API 用于交易，Proof KYC 用于身份验证，DFlow WebSockets 用于实时价格，Helius Sender 用于提交。

### 交易机器人

DFlow WebSockets 用于价格信号，DFlow Order API 用于执行，Helius Sender 用于提交，LaserStream 用于以碎片级延迟进行检测。

### 投资组合 + 交易仪表板

Wallet API 用于持有，DAS API 用于代币元数据，DFlow WebSockets 用于实时价格，DFlow Order API 用于交易。

## 包含内容

* **`SKILL.md`** — 交易应用程序的路由逻辑、规则和专家上下文
* **`prompts/`** — 预构建的系统提示变体 (`openai.developer.md`, `claude.system.md`, `full.md`) — 请参阅[平台设置](/zh/agents/skills/overview#using-skills-across-platforms)
* **`references/`** — 深度文档文件：
  * `dflow-spot-trading.md` — 命令式和声明式交换流程
  * `dflow-prediction-markets.md` — 预测市场订单生命周期
  * `dflow-websockets.md` — 实时流媒体（价格、订单簿、交易）
  * `dflow-proof-kyc.md` — 预测市场的身份验证
  * `integration-patterns.md` — 复合模式（交换执行、代币选择器、CORS 代理、机器人）
  * `helius-sender.md` — 通过 Helius Sender 进行交易提交
  * `helius-priority-fees.md` — 费用估算策略
  * `helius-das.md` — 数字资产标准 API
  * `helius-laserstream.md` — gRPC 流
  * `helius-wallet-api.md` — 钱包分析和身份
  * `helius-websockets.md` — WebSocket 订阅
  * `helius-onboarding.md` — 账户设置和注册流程

## 了解更多

<CardGroup cols={2}>
  <Card title="构建技能" icon="hammer" href="/zh/agents/skills/build">
    用于一般 Solana 开发的核心 Helius 技能
  </Card>

  <Card title="DFlow 文档" icon="book" href="https://pond.dflow.net/introduction">
    官方 DFlow API 文档
  </Card>

  <Card title="DFlow Cookbook" icon="code" href="https://github.com/DFlowProtocol/cookbook">
    DFlow 集成的代码示例
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/helius-labs/core-ai">
    源代码和问题跟踪
  </Card>
</CardGroup>
