gate-exchange-flashswap-assistant

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Resolving
gate-cli
(binary path)

解析
gate-cli
(二进制路径)

Resolve
gate-cli
in order: (1)
command -v gate-cli
and
gate-cli --version
succeeds; (2)
${HOME}/.local/bin/gate-cli
if executable; (3)
${HOME}/.openclaw/skills/bin/gate-cli
if executable. Canonical rules:
exchange-runtime-rules.md
§4 (or
gate-runtime-rules.md
§4).
按以下顺序解析**
gate-cli
**:(1) **
command -v gate-cli
gate-cli --version
执行成功;(2) 若
${HOME}/.local/bin/gate-cli
可执行则使用该路径;(3) 若
${HOME}/.openclaw/skills/bin/gate-cli
**可执行则使用该路径。标准规则:
exchange-runtime-rules.md
第4节(或
gate-runtime-rules.md
第4节)。

gate-exchange-flashswap-assistant

Gate交易所闪电互换助手

General Rules

通用规则

⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding. Do NOT select or call any tool until all rules are read. These rules have the highest priority. → Read gate-runtime-rules.md
  • Only use the
    gate-cli
    commands explicitly listed in this skill.
    Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
⚠️ 停止操作——在继续之前,您必须阅读并严格遵守共享运行时规则。 在未阅读所有规则前,请勿选择或调用任何工具。这些规则具有最高优先级。 → 阅读gate-runtime-rules.md
  • 仅使用本技能中明确列出的
    gate-cli
    命令
    。即使其他接口提供了未在此处记录的命令,也不得在这些工作流中运行。

Skill Dependencies

技能依赖

gate-cli commands used

使用的gate-cli命令

Query Operations (Read-only)
  • gate-cli cex flash-swap order
  • gate-cli cex flash-swap pairs
  • gate-cli cex flash-swap orders
  • gate-cli cex flash-swap preview-many-to-one
  • gate-cli cex flash-swap preview-one-to-many
  • gate-cli cex flash-swap preview-v1
  • gate-cli cex spot account get
  • gate-cli cex wallet balance small
  • gate-cli cex wallet balance small-history
Execution Operations (Write)
  • gate-cli cex flash-swap create-many-to-one
  • gate-cli cex flash-swap create-one-to-many
  • gate-cli cex flash-swap create-v1
  • gate-cli cex wallet balance convert-small
查询操作(只读)
  • gate-cli cex flash-swap order
  • gate-cli cex flash-swap pairs
  • gate-cli cex flash-swap orders
  • gate-cli cex flash-swap preview-many-to-one
  • gate-cli cex flash-swap preview-one-to-many
  • gate-cli cex flash-swap preview-v1
  • gate-cli cex spot account get
  • gate-cli cex wallet balance small
  • gate-cli cex wallet balance small-history
执行操作(写入)
  • gate-cli cex flash-swap create-many-to-one
  • gate-cli cex flash-swap create-one-to-many
  • gate-cli cex flash-swap create-v1
  • gate-cli cex wallet balance convert-small

Authentication

身份验证

  • Interactive file setup: when
    GATE_API_KEY
    and
    GATE_API_SECRET
    are not both set on the host, run
    gate-cli config init
    to complete the wizard for API key, secret, profiles, and defaults (see gate-cli).
  • Env / flags:
    gate-cli config init
    is not required when credentials are already supplied — e.g. both
    GATE_API_KEY
    and
    GATE_API_SECRET
    set on the host, or
    --api-key
    /
    --api-secret
    where supported — never ask the user to paste secrets into chat.
  • API Key Required: Yes (authenticated Gate Exchange MCP)
  • Permissions: Flash convert write (
    gate-cli cex flash-swap preview
    /
    create
    or
    preview-v1
    /
    create-v1
    / multi-currency variants; MCP
    cex_fc_*
    when using Exchange MCP), spot account read, wallet small-balance read and convert as required by the gateway (configure keys with least privilege)
  • Portal: create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage
  • 交互式文件设置:当主机上未同时设置**
    GATE_API_KEY
    GATE_API_SECRET
    时,运行
    gate-cli config init
    **完成API密钥、密钥、配置文件和默认设置的向导(参见gate-cli)。
  • 环境变量/标志:当凭证已提供时,无需运行**
    gate-cli config init
    ——例如主机上已同时设置
    GATE_API_KEY
    GATE_API_SECRET
    ,或在支持的情况下使用
    --api-key
    ** /
    --api-secret
    ——切勿要求用户在聊天中粘贴密钥。
  • 需要API密钥:是(已认证的Gate Exchange MCP)
  • 权限:闪电兑换写入权限(
    gate-cli cex flash-swap preview
    /
    create
    preview-v1
    /
    create-v1
    / 多币种变体;使用Exchange MCP时需MCP
    cex_fc_*
    权限)、现货账户读取权限、钱包小额余额读取和转换权限(根据网关要求配置最小权限密钥)
  • 入口:在聊天外创建或轮换密钥:https://www.gate.com/myaccount/profile/api-key/manage

Installation Check

安装检查

  • Required: Gate (main);
    gate-cli
    when using CLI-backed flows (install via
    setup.sh
    from this skill when applicable).
  • Install (MCP / IDE): Cursor:
    gate-mcp-cursor-installer
    ; Codex:
    gate-mcp-codex-installer
    ; Claude:
    gate-mcp-claude-installer
    ; OpenClaw:
    gate-mcp-openclaw-installer
    .
  • Credentials: When
    GATE_API_KEY
    and
    GATE_API_SECRET
    are both set (non-empty) for the host, do not require
    gate-cli config init
    . When both are unset or empty, remind the operator to run
    gate-cli config init
    or to configure
    GATE_API_KEY
    /
    GATE_API_SECRET
    in the matching skill from the skill library (never ask the user to paste secrets into chat).
  • Sanity check: Before mutating flash-swap or small-balance calls, confirm the runtime works (e.g.
    gate-cli --version
    or a read-only check appropriate to this skill).

  • 必需组件:Gate(主平台);使用CLI驱动工作流时需**
    gate-cli
    **(适用时可通过本技能的
    setup.sh
    安装)。
  • 安装(MCP / IDE):Cursor:
    gate-mcp-cursor-installer
    ;Codex:
    gate-mcp-codex-installer
    ;Claude:
    gate-mcp-claude-installer
    ;OpenClaw:
    gate-mcp-openclaw-installer
  • 凭证:当主机上的**
    GATE_API_KEY
    GATE_API_SECRET
    均已设置(非空)时,无需要求运行
    gate-cli config init
    。当两者均未设置或为空时,提醒操作人员运行
    gate-cli config init
    ,或从技能库中配置匹配技能
    GATE_API_KEY
    ** /
    GATE_API_SECRET
    (切勿要求用户在聊天中粘贴密钥)。
  • 完整性检查:在进行闪电互换或小额余额操作前,确认运行环境正常(例如运行**
    gate-cli --version
    **或适合本技能的只读检查)。

Domain Knowledge

领域知识

What this skill covers

本技能涵盖范围

  • Flash swap (fc): Instant convert using preview then create. Three modes: one-to-one, one-to-many (one sell asset to multiple buy assets), many-to-one (multiple sell assets to one buy asset, consolidation).
  • On-path balance checks: Use
    gate-cli cex spot account get
    for the sell-side (and USDT side for one-to-many) only for this flow. Do not pull full portfolio views here.
  • Two different “small balance” paths (must explain to the user):
    • Flash swap: Subject to per-pair
      sell_min_amount
      /
      sell_max_amount
      from
      gate-cli cex flash-swap pairs
      . If below minimum, do not call fc preview to fake a quote.
    • Wallet dust → GT:
      gate-cli cex wallet balance small
      /
      gate-cli cex wallet balance convert-small
      converts platform-classified dust to GT (not USDT). Rules differ from flash minima; never silently substitute this when the user asked for USDT flash swap.
  • 闪电互换(fc):先预览再创建的即时兑换。三种模式:一对一一对多(一种卖出资产兑换多种买入资产)、多对一(多种卖出资产兑换一种买入资产,即合并资产)。
  • 路径内余额检查:仅在此工作流中使用
    gate-cli cex spot account get
    查询卖出方(以及一对多模式下的USDT方)余额。请勿在此处获取完整投资组合视图。
  • 两种不同的“小额余额”处理路径(必须向用户说明)
    • 闪电互换:受
      gate-cli cex flash-swap pairs
      返回的每对币种
      sell_min_amount
      /
      sell_max_amount
      限制。若余额低于最小值,请勿调用fc预览来生成虚假报价。
    • 钱包小额资产转GT
      gate-cli cex wallet balance small
      /
      gate-cli cex wallet balance convert-small
      将平台认定的小额资产转换为GT(而非USDT)。规则与闪电互换最小值不同,当用户要求USDT闪电互换时,切勿静默替换为此路径。

Core concepts

核心概念

  • quote_id: From preview; required for create. Validity comes from
    valid_timestamp
    in the response — never assume a fixed TTL.
  • sell_amount / buy_amount: Use one per leg as required by the API; one-to-many can use per-target
    sell_amount
    or
    buy_amount
    ; many-to-one uses per-source
    sell_amount
    .
  • Order status:
    status=1
    success,
    status=2
    failure — verify after each create.
  • Precision: Show tiny receive amounts with clear precision; optional rough fiat hint only when clearly justified.
  • quote_id:来自预览操作;创建操作必需。有效性由响应中的
    valid_timestamp
    决定——切勿假设固定的有效期。
  • sell_amount / buy_amount:根据API要求,每笔交易使用其中一个参数;一对多模式可针对每个目标使用
    sell_amount
    buy_amount
    ;多对一模式针对每个源资产使用
    sell_amount
  • 订单状态
    status=1
    表示成功,
    status=2
    表示失败——每次创建操作后需验证状态。
  • 精度:清晰显示极小的到账金额精度;仅在明确合理的情况下提供粗略的法定货币参考。

Explicitly out of scope for tools in this skill

本技能工具明确不支持的范围

  • Do not call
    gate-cli cex spot market tickers
    ,
    gate-cli cex spot market orderbook
    , or
    gate-cli cex wallet balance total
    from this skill. Market depth, “is it a good time”, and full asset audits belong to other skills (see Judgment Logic Summary).
  • 请勿从本技能调用
    gate-cli cex spot market tickers
    gate-cli cex spot market orderbook
    gate-cli cex wallet balance total
    。市场深度、“是否适合交易”以及完整资产审计属于其他技能(参见判断逻辑摘要)。

Regulatory and risk notices

监管与风险提示

  • Digital asset trading involves significant risk and may result in partial or total loss of your investment.
  • This skill is intended for users aged 18 or above with full civil capacity. Users must comply with applicable laws in their jurisdiction.
  • AI-assisted outputs and tool results are for general information only and do not constitute investment, financial, tax, or legal advice, or any representation or warranty by Gate.
  • Prompts and trading-related inputs are processed to call the Gate API via MCP; do not collect unnecessary personal data.

  • 数字资产交易存在重大风险,可能导致部分或全部投资损失。
  • 本技能仅面向年满18周岁且具备完全民事行为能力的用户。用户必须遵守所在司法管辖区的适用法律。
  • AI辅助输出和工具结果仅用于一般信息参考,不构成投资、财务、税务或法律建议,也不代表Gate作出任何陈述或保证。
  • 提示和交易相关输入将通过MCP调用Gate API处理;请勿收集不必要的个人数据。

Atomic Tool Call Chains (mandatory)

原子工具调用链(强制性)

Execution rule: Map the user request to scenario #1–#21 below when possible. Follow the listed tool order. Do not skip gates (balance,
sell_min_amount
, preview before create).
Notation
  • [P1] Parallel
    : Invoke the listed tools in the same wave (any order among them is acceptable unless a later step depends on their output).
  • : Serial — complete the previous step before starting the next.
  • [P0] Plan
    : No MCP call — parse amounts, split ratios, or restrict the coin set (e.g. user-supplied list only).
  • [Confirm]
    : Present Action Draft; wait for explicit Y before any write tool in that branch.
  • (W)
    : Write tool — only after Confirm unless the scenario explicitly ends at preview-only.
Routing reminders (from spec)
  • One-to-many rows #4, #5, #11: If the user uses only spot buy / market buy language with no flash swap / convert / swap anchor, route
    gate-exchange-trading
    instead of fc tools.
  • #8, #20: Preview-only until the user opts in to create.
  • #21: Never mix dust→GT silently into a “swap to USDT” story without explaining the different product path.
执行规则:尽可能将用户请求映射到以下场景#1–#21遵循列出的工具顺序。请勿跳过检查步骤(余额检查、
sell_min_amount
检查、创建前预览)。
符号说明
  • [P1] Parallel
    :在同一阶段调用列出的工具(除非后续步骤依赖其输出,否则顺序不限)。
  • :串行——完成前一步骤后再开始下一步。
  • [P0] Plan
    :无需调用MCP——解析金额、拆分比例或限制币种集合(例如仅使用用户提供的列表)。
  • [Confirm]
    :呈现操作草案;在该分支中执行任何写入工具前,等待用户明确回复Y
  • (W)
    :写入工具——除非场景明确以仅预览结束,否则需在Confirm之后执行。
路由提醒(来自规范)
  • 一对多场景**#4**、#5#11:若用户仅使用现货买入/市价买入表述,未提及闪电互换/兑换/互换相关关键词,则路由至**
    gate-exchange-trading
    **而非fc工具。
  • #8#20:仅进行预览,直到用户选择进行创建操作。
  • #21:在未向用户说明不同产品路径的情况下,切勿将小额资产转GT操作静默混入“兑换为USDT”流程。

Base scenarios (#1–#8)

基础场景(#1–#8)

#User intent (paraphrase)ModeSignalAtomic chain
1Swap a fixed amount (e.g. 1 BTC) to USDT1→1S1[P1]
gate-cli cex flash-swap pairs
(sell asset) ·
gate-cli cex spot account get
(sell asset) Check available ≥ sell amount and sell amount ≥
sell_min_amount
gate-cli cex flash-swap preview-v1
(sell_asset, sell_amount, buy_asset) Show rate, estimated receive, validity → Action Draft [Confirm] (W)
gate-cli cex flash-swap create-v1
(quote_id, matching amounts) Verify
status
Report result
2Swap full available balance of one asset to USDT (e.g. take-profit SOL)1→1S1[P1]
gate-cli cex spot account get
(asset) ·
gate-cli cex flash-swap pairs
(asset) Set
sell_amount
= available; check ≥
sell_min_amount
gate-cli cex flash-swap preview-v1
Action Draft [Confirm] (W)
gate-cli cex flash-swap create-v1
Verify
status
3After deposit, swap asset A to USDT1→1S1[P1]
gate-cli cex spot account get
(A) ·
gate-cli cex flash-swap pairs
(A) Confirm balance and min/max
gate-cli cex flash-swap preview-v1
(A→USDT) Action Draft [Confirm] (W)
gate-cli cex flash-swap create-v1
Verify
status
4One source (e.g. 3000 USDT) flash into multiple targets with set spend per target (e.g. 1000 USDT each to BTC, ETH, SOL)1→NS2[P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(each target asset) Check USDT ≥ total spend; each leg
sell_amount
≥ that pair’s
sell_min_amount
gate-cli cex flash-swap preview-one-to-many
(params for each leg) Show per-leg quote; highlight failures Action Draft [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
(params, exclude failed preview legs) Verify each leg
status
5One source split by ratio (e.g. 1000 USDT: half BTC, half ETH)1→NS2[P0] Compute per-leg
sell_amount
from user ratio [P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(each target)
gate-cli cex flash-swap preview-one-to-many
Action Draft [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
Verify
status
6Named multiple assets → one target (e.g. BTC, ETH, DOGE → USDT), full balancesN→1S3[P1]
gate-cli cex spot account get
(each source) ·
gate-cli cex flash-swap pairs
(each source) Drop legs with balance <
sell_min_amount
or zero; tell user which are skipped
gate-cli cex flash-swap preview-many-to-one
(remaining legs) Action Draft [Confirm] (W)
gate-cli cex flash-swap create-many-to-one
Verify each leg
status
7List recent flash swap historyQueryS4[P1]
gate-cli cex flash-swap orders
(e.g. limit=20) Format table: time / sell / buy / amounts /
status
8Preview only: how much USDT for asset X (e.g. SOL), decide later1→1S1[P1]
gate-cli cex flash-swap pairs
(X) ·
gate-cli cex spot account get
(X)
gate-cli cex flash-swap preview-v1
(full or partial amount) Show rate, estimated receive, validity only If user Y → Action Draft [Confirm] (W)
gate-cli cex flash-swap create-v1
; if N → stop (no write)
#用户意图(转述)模式信号原子调用链
1将固定金额(如1 BTC)兑换为USDT1→1S1[P1]
gate-cli cex flash-swap pairs
(卖出资产) ·
gate-cli cex spot account get
(卖出资产) 检查可用余额≥卖出金额且卖出金额≥
sell_min_amount
gate-cli cex flash-swap preview-v1
(sell_asset, sell_amount, buy_asset) 显示汇率、预估到账金额、报价有效期 → 操作草案 [Confirm] (W)
gate-cli cex flash-swap create-v1
(quote_id, 匹配金额) 验证
status
报告结果
2将某一资产的全部可用余额兑换为USDT(如止盈SOL)1→1S1[P1]
gate-cli cex spot account get
(资产) ·
gate-cli cex flash-swap pairs
(资产) 设置
sell_amount
=可用余额;检查≥
sell_min_amount
gate-cli cex flash-swap preview-v1
操作草案 [Confirm] (W)
gate-cli cex flash-swap create-v1
验证
status
3存款后,将资产A兑换为USDT1→1S1[P1]
gate-cli cex spot account get
(A) ·
gate-cli cex flash-swap pairs
(A) 确认余额和最小/最大额度
gate-cli cex flash-swap preview-v1
(A→USDT) 操作草案 [Confirm] (W)
gate-cli cex flash-swap create-v1
验证
status
4单一源资产(如3000 USDT)闪电兑换为多个目标资产,每个目标设置固定支出(如分别向BTC、ETH、SOL各支出1000 USDT)1→NS2[P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(每个目标资产) 检查USDT余额≥总支出;每笔交易的
sell_amount
≥对应币种对的
sell_min_amount
gate-cli cex flash-swap preview-one-to-many
(每笔交易参数) 显示每笔交易报价;突出失败交易 操作草案 [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
(参数,排除预览失败的交易) 验证每笔交易的
status
5单一源资产按比例拆分(如1000 USDT:一半兑换BTC,一半兑换ETH)1→NS2[P0] 根据用户比例计算每笔交易的
sell_amount
[P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(每个目标资产)
gate-cli cex flash-swap preview-one-to-many
操作草案 [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
验证
status
6指定多种资产兑换为单一目标资产(如BTC、ETH、DOGE → USDT),使用全部余额N→1S3[P1]
gate-cli cex spot account get
(每个源资产) ·
gate-cli cex flash-swap pairs
(每个源资产) 移除余额<
sell_min_amount
或为零的交易;告知用户跳过的资产
gate-cli cex flash-swap preview-many-to-one
(剩余交易) 操作草案 [Confirm] (W)
gate-cli cex flash-swap create-many-to-one
验证每笔交易的
status
7查询近期闪电互换历史查询S4[P1]
gate-cli cex flash-swap orders
(如limit=20) 格式化表格:时间 / 卖出资产 / 买入资产 / 金额 /
status
8仅预览:资产X(如SOL)可兑换多少USDT,后续再决定是否执行1→1S1[P1]
gate-cli cex flash-swap pairs
(X) ·
gate-cli cex spot account get
(X)
gate-cli cex flash-swap preview-v1
(全部或部分金额) 仅显示汇率、预估到账金额、报价有效期 若用户回复Y → 操作草案 [Confirm] (W)
gate-cli cex flash-swap create-v1
;若回复N → 停止操作(不执行写入)

Extended scenarios (#9–#13)

扩展场景(#9–#13)

#User intent (paraphrase)SignalAtomic chain
9Whether a coin (e.g. APT) supports flash swap / pair limitsS4[P1]
gate-cli cex flash-swap pairs
(currency) If empty: not supported; suggest spot trading skill If rows: show pairs and min/max
10Did the latest flash swap succeedS4[P1]
gate-cli cex flash-swap orders
(limit=1) Take newest
order_id
gate-cli cex flash-swap order
(order_id) Report
status
(1 success / 2 fail), fills
11USDT flash into target buy amounts (e.g. 0.1 BTC and 1 ETH)S2[P0] Build params with
buy_amount
per leg (not
sell_amount
) [P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(each target)
gate-cli cex flash-swap preview-one-to-many
Check total USDT consumed vs available (e.g.
total_consume_amount
or equivalent field) Action Draft per leg [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
Verify each
status
12One-to-one non-USDT leg (e.g. 2 ETH → BTC)S1[P1]
gate-cli cex spot account get
(ETH) ·
gate-cli cex flash-swap pairs
(ETH) Check ≥ amount and min/max
gate-cli cex flash-swap preview-v1
(sell ETH, buy BTC, …) Action Draft (state single-hop flash, not “via USDT”) [Confirm] (W)
gate-cli cex flash-swap create-v1
Verify
status
13Multiple named alts → USDT; user may not know balancesN→1S3
#用户意图(转述)信号原子调用链
9某币种(如APT)是否支持闪电互换 / 币种对限制S4[P1]
gate-cli cex flash-swap pairs
(币种) 若结果为空:不支持;建议使用现货交易技能 若有结果:显示币种对和最小/最大额度
10最近一次闪电互换是否成功S4[P1]
gate-cli cex flash-swap orders
(limit=1) 获取最新的
order_id
gate-cli cex flash-swap order
(order_id) 报告
status
(1成功 / 2失败)、成交详情
11USDT闪电兑换为目标资产的指定买入金额(如0.1 BTC和1 ETH)S2[P0] 构建每笔交易的
buy_amount
参数(而非
sell_amount
[P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(每个目标资产)
gate-cli cex flash-swap preview-one-to-many
检查消耗的USDT总额与可用余额(如
total_consume_amount
或等效字段) 每笔交易的操作草案 [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
验证每笔交易的
status
12一对一非USDT交易(如2 ETH → BTC)S1[P1]
gate-cli cex spot account get
(ETH) ·
gate-cli cex flash-swap pairs
(ETH) 检查余额≥交易金额且符合最小/最大额度
gate-cli cex flash-swap preview-v1
(卖出ETH,买入BTC,…) 操作草案(说明是单跳闪电互换,而非“通过USDT中转”) [Confirm] (W)
gate-cli cex flash-swap create-v1
验证
status
13多种指定替代币兑换为USDT;用户可能不清楚余额N→1S3

Dust, small size, and split scenarios (#14–#21)

小额资产、额度不足与拆分场景(#14–#21)

#User intent (paraphrase)SignalAtomic chain
14“Too small” / may be below flash min (e.g. PEPE)S5[P1]
gate-cli cex flash-swap pairs
(asset) ·
gate-cli cex spot account get
(asset) If available <
sell_min_amount
: do not call
gate-cli cex flash-swap preview
(or any preview variant); show balance / min / gap
gate-cli cex wallet balance small
If asset in dust list: explain S7 dust→GT path; else suggest accumulate or spot sell (trading copilot) If available ≥ min: continue scenario #1-style S1 chain
15Small total one-to-many (e.g. 30 USDT split across DOGE and SHIB)S2[P0] Confirm per-leg USDT split with user if unclear [P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(each target) Ensure each leg ≥
sell_min_amount
; if not, ask to adjust
gate-cli cex flash-swap preview-one-to-many
Highlight failed legs; Action Draft [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
(confirmed params)
16Single-asset amount exceeds
sell_max_amount
(must split batches)
S6[P1]
gate-cli cex spot account get
(asset) ·
gate-cli cex flash-swap pairs
(asset) Read
sell_max_amount
; plan batches each ≤ max For batch k:
gate-cli cex flash-swap preview-v1
Action Draft [Confirm] (W)
gate-cli cex flash-swap create-v1
Verify
status
Re-query
gate-cli cex spot account get
before batch k+1 New preview (new
quote_id
) for next batch
17Several tickers → USDT; “swap everything that can”N→1S3
18Ask min flash amount and whether current balance qualifiesS4[P1]
gate-cli cex flash-swap pairs
(asset) ·
gate-cli cex spot account get
(asset) Report
sell_min_amount
,
sell_max_amount
, available, pass/fail If user then says swap all: run scenario #1 or #2
19User supplies an explicit coin list in session (paste / list); flash all that can to USDTN→1S3
20Tiny amount preview only (e.g. 5 USDT → SAT), not urgent to fillS1[P1]
gate-cli cex flash-swap pairs
(target) ·
gate-cli cex spot account get
(USDT) If sell-side USDT <
sell_min_amount
: S5 path; no preview Else
gate-cli cex flash-swap preview-v1
Show receive with precision note; default no auto-create
21Clear wallet dust to GTS7[P1]
gate-cli cex wallet balance small
() Show convertible dust list Action Draft: state GT outcome and
gate-cli cex wallet balance convert-small
; confirm
currencies
or
is_all
[Confirm] (W)
gate-cli cex wallet balance convert-small
Optionally
gate-cli cex wallet balance small-history

#用户意图(转述)信号原子调用链
14“金额太小” / 可能低于闪电互换最小值(如PEPE)S5[P1]
gate-cli cex flash-swap pairs
(资产) ·
gate-cli cex spot account get
(资产) 若可用余额<
sell_min_amount
请勿调用
gate-cli cex flash-swap preview
(或任何预览变体);显示余额 / 最小值 / 差额
gate-cli cex wallet balance small
若资产在小额资产列表中:说明S7小额资产转GT路径;否则建议积累资产或使用现货卖出(交易助手) 若可用余额≥最小值:继续场景#1风格的S1调用链
15小额总额的一对多交易(如30 USDT拆分兑换DOGE和SHIB)S2[P0] 若拆分比例不明确,与用户确认每笔USDT拆分金额 [P1]
gate-cli cex spot account get
(USDT) ·
gate-cli cex flash-swap pairs
(每个目标资产) 确保每笔交易≥
sell_min_amount
;若不满足,请求用户调整
gate-cli cex flash-swap preview-one-to-many
突出失败交易;操作草案 [Confirm] (W)
gate-cli cex flash-swap create-one-to-many
(确认后的参数)
16单一资产金额超过
sell_max_amount
(必须拆分批次)
S6[P1]
gate-cli cex spot account get
(资产) ·
gate-cli cex flash-swap pairs
(资产) 读取
sell_max_amount
;规划每个批次金额≤最大值 对于批次k:
gate-cli cex flash-swap preview-v1
操作草案 [Confirm] (W)
gate-cli cex flash-swap create-v1
验证
status
重新查询
gate-cli cex spot account get
后再进行批次k+1 为下一批次生成新预览(新
quote_id
17多个币种兑换为USDT;“兑换所有可兑换的资产”N→1S3
18查询闪电互换最小金额以及当前余额是否符合要求S4[P1]
gate-cli cex flash-swap pairs
(资产) ·
gate-cli cex spot account get
(资产) 报告
sell_min_amount
sell_max_amount
、可用余额、是否符合要求 若用户随后要求全额兑换:运行场景#1或**#2**
19用户在会话中提供明确的币种列表(粘贴/列出);将所有可兑换的资产闪电兑换为USDTN→1S3
20仅预览小额金额(如5 USDT → SAT),不急于成交S1[P1]
gate-cli cex flash-swap pairs
(目标资产) ·
gate-cli cex spot account get
(USDT) 若卖出方USDT<
sell_min_amount
:走S5路径;不进行预览 否则调用
gate-cli cex flash-swap preview-v1
显示带精度说明的到账金额;默认不自动创建订单
21将钱包小额资产转换为GTS7[P1]
gate-cli cex wallet balance small
() 显示可转换的小额资产列表 操作草案:说明操作结果为GT,使用
gate-cli cex wallet balance convert-small
;确认
currencies
is_all
参数 [Confirm] (W)
gate-cli cex wallet balance convert-small
可选调用
gate-cli cex wallet balance small-history

Workflow

工作流

Step 1: Route intent and select signal S1–S7

步骤1:路由意图并选择信号S1–S7

First, try to match Atomic Tool Call Chains scenario #1–#21 and execute that chain as written (parallel vs serial, preview gates, confirm before writes).
If no row fits, fall back: classify the request. If it belongs to out of scope (see Judgment Logic Summary), stop and name the appropriate skill without calling fc or wallet convert tools.
If in scope but not tabulated, assign one or more signals: S1 one-to-one flash, S2 one-to-many flash, S3 many-to-one consolidation, S4 query or history, S5 below-minimum or dust diagnosis, S6 split over
sell_max_amount
, S7 dust to GT.
Key data to extract:
  • signal
    : S1 | S2 | S3 | S4 | S5 | S6 | S7 (combinations allowed, e.g. S5 then S1)
  • sell_assets
    ,
    buy_asset
    , amounts, and whether the user asked for preview only
  • user_confirmed_flash_language
    : user used flash swap / convert / swap narrative vs pure spot buy wording (see routing table)
首先,尝试匹配原子工具调用链中的场景#1–#21,并严格按照编写的流程执行(并行/串行、预览检查、写入前确认)。
若没有匹配的场景,则回退:对请求进行分类。若属于超出范围(参见判断逻辑摘要),则停止操作并指明适用的技能,切勿调用fc或钱包转换工具。
若在范围内但未列入表格,则分配一个或多个信号:S1一对一闪电互换、S2一对多闪电互换、S3多对一资产合并、S4查询或历史、S5额度不足或小额资产诊断、S6超过
sell_max_amount
拆分、S7小额资产转GT。
需提取的关键数据:
  • signal
    : S1 | S2 | S3 | S4 | S5 | S6 | S7(允许组合,如S5后接S1)
  • sell_assets
    buy_asset
    、金额,以及用户是否要求仅预览
  • user_confirmed_flash_language
    : 用户使用闪电互换/兑换/互换表述,还是纯现货买入表述(参见路由表)

Step 2: Parallel gateway reads (flash paths S1–S3, S5, S6)

步骤2:并行网关读取(闪电路径S1–S3、S5、S6)

Call
gate-cli cex flash-swap pairs
with:
  • currency
    (or equivalent filter per MCP): each sell asset (and targets as needed)
Call
gate-cli cex spot account get
with:
  • Parameters needed to read available balance for each relevant currency (sell side and USDT for one-to-many)
Key data to extract:
  • sell_min_amount
    ,
    sell_max_amount
    per pair
  • available
    balances
  • Whether each leg passes min gate before preview
S5 rule: If
available
<
sell_min_amount
for a flash leg, do not call
gate-cli cex flash-swap preview
(or any preview variant) for that leg. Present a clear table (balance vs min gap) and optionally call
gate-cli cex wallet balance small
to see if S7 applies.
S6 rule: If amount >
sell_max_amount
, plan sequential batches; each batch needs its own preview, Action Draft, Y, create, and post-create balance refresh before the next preview. Cap planned batches at a reasonable maximum (for example 20) or stop if the user cancels — do not loop without bound.
调用
gate-cli cex flash-swap pairs
,参数:
  • currency
    (或MCP支持的等效过滤器):每个卖出资产(必要时包括目标资产)
调用
gate-cli cex spot account get
,参数:
  • 读取每个相关币种(卖出方和一对多模式下的USDT)可用余额所需的参数
需提取的关键数据:
  • 每个币种对的
    sell_min_amount
    sell_max_amount
  • available
    余额
  • 在预览之前,每笔交易是否通过最小值检查
S5规则:若某笔闪电交易的
available
<
sell_min_amount
请勿为该交易调用
gate-cli cex flash-swap preview
(或任何预览变体)。呈现清晰的表格(余额与最小值的差额),并可选调用
gate-cli cex wallet balance small
查看是否适用S7路径。
S6规则:若金额>
sell_max_amount
,规划连续批次;每个批次需要独立的预览、操作草案、用户回复Y、创建操作,以及创建后刷新余额才能进行下一次预览。将计划的批次数量限制在合理最大值(例如20),或在用户取消时停止——切勿无限循环。

Step 3: Preview (choose one preview tool by mode)

步骤3:预览(根据模式选择预览工具)

One-to-one (S1) — Call
gate-cli cex flash-swap preview-v1
with
sell_asset
,
buy_asset
, and either
sell_amount
or
buy_amount
.
One-to-many (S2) — Call
gate-cli cex flash-swap preview-one-to-many
with
params
array (per leg amounts). Highlight per-leg preview errors.
Many-to-one (S3) — After filtering legs below min or zero balance, call
gate-cli cex flash-swap preview-many-to-one
with
params
for remaining legs. Present will execute vs skipped summary.
Key data to extract:
  • quote_id
    per successful leg
  • Rates, receive amounts,
    valid_timestamp
  • Any per-leg errors for user-visible highlighting
一对一(S1) —— 调用
gate-cli cex flash-swap preview-v1
,参数包括
sell_asset
buy_asset
,以及
sell_amount
buy_amount
一对多(S2) —— 调用
gate-cli cex flash-swap preview-one-to-many
,参数为
params
数组(每笔交易的金额)。突出显示每笔交易的预览错误。
多对一(S3) —— 过滤掉余额低于最小值或零的交易后,调用
gate-cli cex flash-swap preview-many-to-one
,参数为剩余交易的
params
。呈现将执行已跳过的摘要。
需提取的关键数据:
  • 每笔成功交易的
    quote_id
  • 汇率、到账金额、
    valid_timestamp
  • 任何需向用户显示的每笔交易错误

Step 4: Action Draft and explicit confirmation (all writes)

步骤4:操作草案与明确确认(所有写入操作)

Present an Action Draft listing sell/buy assets, amounts, effective rate or receive estimate, quote validity, and multi-leg status. For S7, the draft must state that the operation is dust to GT via
gate-cli cex wallet balance convert-small
, not USDT flash swap.
Wait for explicit Y to execute or N to cancel. Without Y, call no write tool.
Key data to extract:
  • user_confirmation
    : Y | N
  • Whether parameters still match the last preview (if not, re-preview)
呈现操作草案,列出卖出/买入资产、金额、有效汇率或预估到账金额、报价有效期,以及多笔交易的状态。对于S7,草案必须说明操作是通过
gate-cli cex wallet balance convert-small
将小额资产转换为GT,而非USDT闪电互换。
等待用户明确回复Y执行或N取消。未收到Y时,切勿调用任何写入工具。
需提取的关键数据:
  • user_confirmation
    : Y | N
  • 参数是否与上次预览匹配(若不匹配,重新预览)

Step 5: Execute flash swap creates (after Y, one create family per request)

步骤5:执行闪电互换创建操作(收到Y后,每个请求调用一个创建工具)

Use exactly one of:
Call
gate-cli cex flash-swap create-v1
with body fields including
quote_id
and matching sell/buy amounts from preview.
Call
gate-cli cex flash-swap create-one-to-many
with
params
including each leg
quote_id
and amounts — exclude failed preview legs.
Call
gate-cli cex flash-swap create-many-to-one
with
params
including each leg
quote_id
and amounts — exclude failed preview legs.
Key data to extract:
  • Per-order
    status
    and IDs
  • Errors returned by the API
精确选择以下工具之一:
调用
gate-cli cex flash-swap create-v1
,参数包括
quote_id
和与预览匹配的卖出/买入金额。
调用
gate-cli cex flash-swap create-one-to-many
,参数
params
包括每笔交易的
quote_id
和金额 —— 排除预览失败的交易。
调用
gate-cli cex flash-swap create-many-to-one
,参数
params
包括每笔交易的
quote_id
和金额 —— 排除预览失败的交易。
需提取的关键数据:
  • 每个订单的
    status
    和ID
  • API返回的错误

Step 6: Verify order outcome

步骤6:验证订单结果

For each created order, read
status
. If needed, Call
gate-cli cex flash-swap order
with the order id to confirm details.
Key data to extract:
  • Success vs failure per leg
  • Final received amounts where provided
对于每个创建的订单,读取
status
。必要时,调用
gate-cli cex flash-swap order
并传入订单ID确认详情。
需提取的关键数据:
  • 每笔交易的成功/失败状态
  • 最终到账金额(若提供)

Step 7: Query and history paths (S4)

步骤7:查询与历史路径(S4)

Call
gate-cli cex flash-swap orders
with appropriate
limit
/ filters for history or “latest order”.
Call
gate-cli cex flash-swap order
with
order_id
when the user needs detail on a specific id or you took the latest id from list.
For supported-pair or min/max questions, use
gate-cli cex flash-swap pairs
and
gate-cli cex spot account get
as needed.
For dust history, Call
gate-cli cex wallet balance small-history
with optional filters per MCP.
Key data to extract:
  • Human-readable table: time, sides, amounts, status
调用
gate-cli cex flash-swap orders
,使用合适的
limit
/ 过滤器查询历史或“最新订单”。
当用户需要特定ID的详情,或从列表中获取最新ID时,调用
gate-cli cex flash-swap order
并传入
order_id
对于支持的币种对或最小/最大额度问题,根据需要使用
gate-cli cex flash-swap pairs
gate-cli cex spot account get
对于小额资产历史,调用
gate-cli cex wallet balance small-history
并传入MCP支持的可选过滤器。
需提取的关键数据:
  • 易读表格:时间、交易方向、金额、状态

Step 8: Dust to GT path (S7)

步骤8:小额资产转GT路径(S7)

Call
gate-cli cex wallet balance small
(no substitute for “list all account dust” beyond this tool’s contract).
Present the convertible list. Action Draft must specify
currencies
or
is_all
exactly as the user confirmed.
After Y, Call
gate-cli cex wallet balance convert-small
with the confirmed parameters.
Key data to extract:
  • Conversion result or error; optional follow-up with
    gate-cli cex wallet balance small-history

调用
gate-cli cex wallet balance small
(除该工具外,无其他工具可替代“列出所有账户小额资产”的功能)。
呈现可转换的资产列表。操作草案必须精确指定用户确认的
currencies
is_all
参数。
收到Y后,调用
gate-cli cex wallet balance convert-small
并传入确认的参数。
需提取的关键数据:
  • 转换结果或错误;可选调用
    gate-cli cex wallet balance small-history
    进行后续查询

Judgment Logic Summary

判断逻辑摘要

Signal definitions

信号定义

SignalMeaningPrimary tools
S1One-to-one flash
gate-cli cex flash-swap pairs
,
gate-cli cex spot account get
,
gate-cli cex flash-swap preview-v1
,
gate-cli cex flash-swap create-v1
S2One-to-many flash (user anchors flash/convert/swap, not pure spot buy)
gate-cli cex flash-swap preview-one-to-many
,
gate-cli cex flash-swap create-one-to-many
S3Many-to-one consolidation
gate-cli cex flash-swap preview-many-to-one
,
gate-cli cex flash-swap create-many-to-one
S4Queries: history, support, min check, order status
gate-cli cex flash-swap orders
,
gate-cli cex flash-swap order
,
gate-cli cex flash-swap pairs
,
gate-cli cex wallet balance small-history
S5Below flash minimum / fragile balanceReads only until min met; optional
gate-cli cex wallet balance small
→ offer S7
S6Amount over
sell_max_amount
Same create family as S1/S2/S3 but sequential batches with fresh preview and confirmation per batch
S7Dust to GT
gate-cli cex wallet balance small
,
gate-cli cex wallet balance convert-small
信号含义主要工具
S1一对一闪电互换
gate-cli cex flash-swap pairs
,
gate-cli cex spot account get
,
gate-cli cex flash-swap preview-v1
,
gate-cli cex flash-swap create-v1
S2一对多闪电互换(用户提及闪电/兑换/互换,而非纯现货买入)
gate-cli cex flash-swap preview-one-to-many
,
gate-cli cex flash-swap create-one-to-many
S3多对一资产合并
gate-cli cex flash-swap preview-many-to-one
,
gate-cli cex flash-swap create-many-to-one
S4查询:历史、支持情况、额度检查、订单状态
gate-cli cex flash-swap orders
,
gate-cli cex flash-swap order
,
gate-cli cex flash-swap pairs
,
gate-cli cex wallet balance small-history
S5低于闪电互换最小值 / 余额不足仅读取数据直到满足最小值;可选调用
gate-cli cex wallet balance small
→ 提供S7路径
S6金额超过
sell_max_amount
与S1/S2/S3使用相同的创建工具,但分批串行执行,每批需重新预览并确认
S7小额资产转GT
gate-cli cex wallet balance small
,
gate-cli cex wallet balance convert-small

Out of scope routing (do not use this skill’s tool list)

超出范围的路由(请勿使用本技能的工具列表)

User intentRoute to
Research, “why”, slippage, depth, liquidity, charts
gate-info-research
or
gate-exchange-trading
(no tickers/order book from here)
Spot buy/sell narrative (market/limit, “buy some”, “DCA”, “bid”) without flash/convert anchor
gate-exchange-trading
Futures / margin trading
gate-exchange-trading
or domain futures/margin skills
Transfers between accounts (spot ↔ futures, subaccounts)
gate-exchange-transfer
Full portfolio, margin risk, liquidation context
gate-exchange-assets-manager
or
gate-exchange-assets
Earn / staking
gate-exchange-simpleearn
or relevant earn skill
On-chain DEX swapDEX skills (e.g.
gate-dex-trade
)
用户意图路由至
研究、“原因”、滑点、深度、流动性、图表
gate-info-research
gate-exchange-trading
(此处不提供行情/订单簿查询)
现货买入/卖出表述(市价/限价、“买入一些”、“定投”、“出价”),未提及闪电/兑换关键词
gate-exchange-trading
期货/杠杆交易
gate-exchange-trading
或相关期货/杠杆技能
账户间转账(现货 ↔ 期货、子账户)
gate-exchange-transfer
完整投资组合、杠杆风险、清算相关
gate-exchange-assets-manager
gate-exchange-assets
理财/质押
gate-exchange-simpleearn
或相关理财技能
链上DEX互换DEX技能(如
gate-dex-trade

Mode detection

模式检测

  • One-to-one: One sell asset and one buy asset; no multi-asset split wording.
  • One-to-many: One sell asset, multiple buy assets; user must anchor flash swap / convert, not only “buy multiple”.
  • Many-to-one: Multiple sell assets into one buy asset, or words like “consolidate”, “convert all to USDT”.
  • If unclear: ask whether the user wants one source → many targets or many sources → one target.

  • 一对一:一种卖出资产和一种买入资产;无多资产拆分表述。
  • 一对多:一种卖出资产,多种买入资产;用户必须提及闪电互换/兑换,而非仅“买入多种资产”。
  • 多对一:多种卖出资产兑换为一种买入资产,或使用“合并”、“全部兑换为USDT”等表述。
  • 若不明确:询问用户需要单一源资产→多个目标资产还是多个源资产→单一目标资产

Report Template

报告模板

Flash swap Action Draft (before any fc create)

闪电互换操作草案(执行fc创建前)

  • Mode (one-to-one / one-to-many / many-to-one)
  • Each leg: sell asset and amount → buy asset and expected receive (from preview)
  • Quote validity: reference
    valid_timestamp
    (do not invent seconds)
  • Risk line: instant execution; final result from API
  • Ask: Reply Y to execute or N to cancel
  • 模式(一对一 / 一对多 / 多对一)
  • 每笔交易:卖出资产及金额 → 买入资产及预估到账金额(来自预览)
  • 报价有效期:参考
    valid_timestamp
    (请勿自行设定秒数)
  • 风险提示:即时执行;最终结果以API返回为准
  • 询问:回复Y执行或N取消

S5 diagnostic (no preview)

S5诊断报告(无预览)

  • Asset, available balance,
    sell_min_amount
    , shortfall
  • Next options: accumulate, spot trade via trading copilot, or check dust list for GT path (S7)
  • 资产、可用余额、
    sell_min_amount
    、差额
  • 后续选项:积累资产、通过交易助手进行现货交易,或检查小额资产列表是否适用GT路径(S7)

Dust to GT Action Draft

小额资产转GT操作草案

  • Explicit: operation is small balance convert to GT, not USDT flash
  • Coins or
    is_all
    exactly as user confirmed
  • Y / N
  • 明确说明:操作是小额资产转换为GT,而非USDT闪电互换
  • 用户确认的币种或
    is_all
    参数
  • 询问Y / N

After execution

执行后报告

  • Per-leg status and amounts
  • Reminder: digital asset transactions are generally irreversible; flash fills are immediate

  • 每笔交易的状态和金额
  • 提醒:数字资产交易通常不可逆;闪电互换成交即时生效

Safety Rules

安全规则

Confirmation

确认机制

  • No
    gate-cli cex flash-swap create
    (or
    create-v1
    / multi-currency create variants) and no
    gate-cli cex wallet balance convert-small
    without prior Action Draft and explicit Y.
  • Never use an expired or stale
    quote_id
    ; if the user delayed, re-preview.
  • Never call fc preview solely to mask a below-minimum balance.
  • 若无事先的操作草案和用户明确回复Y不得调用
    gate-cli cex flash-swap create
    (或
    create-v1
    / 多币种创建变体),也不得调用
    gate-cli cex wallet balance convert-small
  • 切勿使用过期或失效的
    quote_id
    ;若用户延迟操作,重新进行预览。
  • 切勿仅为掩盖余额不足而调用fc预览。

Proportionality

比例原则

  • Pass only minimum parameters to MCP tools. Do not send unrelated conversation content as tool input.

  • 仅向MCP工具传递最少必要参数。请勿将无关对话内容作为工具输入。

Error Handling

错误处理

SituationAction
gate-cli cex flash-swap pairs
fails
State limits unknown; warn before preview; avoid guessing min/max
Preview returns errorDo not create; show message; suggest adjusting size or spot path
Create returns failureDo not auto-retry; suggest fresh preview
gate-cli cex spot account get
fails
Warn balance unknown; do not invent balances
gate-cli cex wallet balance small
fails
Do not call convert; explain dust list unavailable
gate-cli cex wallet balance convert-small
fails
Show error; no silent retry
User says N after draftStop; no writes

情况操作
gate-cli cex flash-swap pairs
执行失败
说明额度限制未知;预览前发出警告;切勿猜测最小/最大额度
预览返回错误不执行创建操作;显示错误信息;建议调整金额或使用现货路径
创建操作返回失败不自动重试;建议重新预览
gate-cli cex spot account get
执行失败
警告余额未知;切勿虚构余额
gate-cli cex wallet balance small
执行失败
不调用转换操作;说明无法获取小额资产列表
gate-cli cex wallet balance convert-small
执行失败
显示错误信息;不静默重试
用户在草案后回复N停止操作;不执行写入

Reference

参考资料

  • Normative tool order for mapped stories: Atomic Tool Call Chains (scenarios #1–#21) above
  • Human-readable scenarios and prompt examples:
    references/scenarios.md
  • Shared disambiguation: read
    gate-skills-disambiguation.md
    from your skills root when present
  • 映射场景的标准工具顺序:上述原子工具调用链(场景#1–#21)
  • 易读场景和提示示例:
    references/scenarios.md
  • 共享消歧义文档:若存在,从技能根目录读取
    gate-skills-disambiguation.md