gate-exchange-flashswap-assistant
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseResolving gate-cli
(binary path)
gate-cli解析gate-cli
(二进制路径)
gate-cliResolve in order: (1) and succeeds; (2) if executable; (3) if executable. Canonical rules: §4 (or §4).
gate-clicommand -v gate-cligate-cli --version${HOME}/.local/bin/gate-cli${HOME}/.openclaw/skills/bin/gate-cliexchange-runtime-rules.mdgate-runtime-rules.md按以下顺序解析****:(1) **和执行成功;(2) 若可执行则使用该路径;(3) 若**可执行则使用该路径。标准规则:第4节(或第4节)。
gate-clicommand -v gate-cligate-cli --version${HOME}/.local/bin/gate-cli${HOME}/.openclaw/skills/bin/gate-cliexchange-runtime-rules.mdgate-runtime-rules.mdgate-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 commands explicitly listed in this skill. Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
gate-cli
⚠️ 停止操作——在继续之前,您必须阅读并严格遵守共享运行时规则。
在未阅读所有规则前,请勿选择或调用任何工具。这些规则具有最高优先级。
→ 阅读gate-runtime-rules.md
- 仅使用本技能中明确列出的命令。即使其他接口提供了未在此处记录的命令,也不得在这些工作流中运行。
gate-cli
Skill Dependencies
技能依赖
gate-cli commands used
使用的gate-cli命令
Query Operations (Read-only)
gate-cli cex flash-swap ordergate-cli cex flash-swap pairsgate-cli cex flash-swap ordersgate-cli cex flash-swap preview-many-to-onegate-cli cex flash-swap preview-one-to-manygate-cli cex flash-swap preview-v1gate-cli cex spot account getgate-cli cex wallet balance smallgate-cli cex wallet balance small-history
Execution Operations (Write)
gate-cli cex flash-swap create-many-to-onegate-cli cex flash-swap create-one-to-manygate-cli cex flash-swap create-v1gate-cli cex wallet balance convert-small
查询操作(只读)
gate-cli cex flash-swap ordergate-cli cex flash-swap pairsgate-cli cex flash-swap ordersgate-cli cex flash-swap preview-many-to-onegate-cli cex flash-swap preview-one-to-manygate-cli cex flash-swap preview-v1gate-cli cex spot account getgate-cli cex wallet balance smallgate-cli cex wallet balance small-history
执行操作(写入)
gate-cli cex flash-swap create-many-to-onegate-cli cex flash-swap create-one-to-manygate-cli cex flash-swap create-v1gate-cli cex wallet balance convert-small
Authentication
身份验证
- Interactive file setup: when and
GATE_API_KEYare not both set on the host, runGATE_API_SECRETto complete the wizard for API key, secret, profiles, and defaults (see gate-cli).gate-cli config init - Env / flags: is not required when credentials are already supplied — e.g. both
gate-cli config initandGATE_API_KEYset on the host, orGATE_API_SECRET/--api-keywhere supported — never ask the user to paste secrets into chat.--api-secret - API Key Required: Yes (authenticated Gate Exchange MCP)
- Permissions: Flash convert write (/
gate-cli cex flash-swap previeworcreate/preview-v1/ multi-currency variants; MCPcreate-v1when using Exchange MCP), spot account read, wallet small-balance read and convert as required by the gateway (configure keys with least privilege)cex_fc_* - Portal: create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage
- 交互式文件设置:当主机上未同时设置**和
GATE_API_KEY时,运行GATE_API_SECRET**完成API密钥、密钥、配置文件和默认设置的向导(参见gate-cli)。gate-cli config init - 环境变量/标志:当凭证已提供时,无需运行**——例如主机上已同时设置
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/ 多币种变体;使用Exchange MCP时需MCPcreate-v1权限)、现货账户读取权限、钱包小额余额读取和转换权限(根据网关要求配置最小权限密钥)cex_fc_* - 入口:在聊天外创建或轮换密钥:https://www.gate.com/myaccount/profile/api-key/manage
Installation Check
安装检查
- Required: Gate (main); when using CLI-backed flows (install via
gate-clifrom this skill when applicable).setup.sh - Install (MCP / IDE): Cursor: ; Codex:
gate-mcp-cursor-installer; Claude:gate-mcp-codex-installer; OpenClaw:gate-mcp-claude-installer.gate-mcp-openclaw-installer - Credentials: When and
GATE_API_KEYare both set (non-empty) for the host, do not requireGATE_API_SECRET. When both are unset or empty, remind the operator to rungate-cli config initor to configuregate-cli config init/GATE_API_KEYin the matching skill from the skill library (never ask the user to paste secrets into chat).GATE_API_SECRET - Sanity check: Before mutating flash-swap or small-balance calls, confirm the runtime works (e.g. or a read-only check appropriate to this skill).
gate-cli --version
- 必需组件:Gate(主平台);使用CLI驱动工作流时需****(适用时可通过本技能的
gate-cli安装)。setup.sh - 安装(MCP / IDE):Cursor: ;Codex:
gate-mcp-cursor-installer;Claude:gate-mcp-codex-installer;OpenClaw:gate-mcp-claude-installer。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 for the sell-side (and USDT side for one-to-many) only for this flow. Do not pull full portfolio views here.
gate-cli cex spot account get - Two different “small balance” paths (must explain to the user):
- Flash swap: Subject to per-pair /
sell_min_amountfromsell_max_amount. If below minimum, do not call fc preview to fake a quote.gate-cli cex flash-swap pairs - Wallet dust → GT: /
gate-cli cex wallet balance smallconverts platform-classified dust to GT (not USDT). Rules differ from flash minima; never silently substitute this when the user asked for USDT flash swap.gate-cli cex wallet balance convert-small
- Flash swap: Subject to per-pair
- 闪电互换(fc):先预览再创建的即时兑换。三种模式:一对一、一对多(一种卖出资产兑换多种买入资产)、多对一(多种卖出资产兑换一种买入资产,即合并资产)。
- 路径内余额检查:仅在此工作流中使用查询卖出方(以及一对多模式下的USDT方)余额。请勿在此处获取完整投资组合视图。
gate-cli cex spot account get - 两种不同的“小额余额”处理路径(必须向用户说明):
- 闪电互换:受返回的每对币种
gate-cli cex flash-swap pairs/sell_min_amount限制。若余额低于最小值,请勿调用fc预览来生成虚假报价。sell_max_amount - 钱包小额资产转GT:/
gate-cli cex wallet balance small将平台认定的小额资产转换为GT(而非USDT)。规则与闪电互换最小值不同,当用户要求USDT闪电互换时,切勿静默替换为此路径。gate-cli cex wallet balance convert-small
- 闪电互换:受
Core concepts
核心概念
- quote_id: From preview; required for create. Validity comes from in the response — never assume a fixed TTL.
valid_timestamp - sell_amount / buy_amount: Use one per leg as required by the API; one-to-many can use per-target or
sell_amount; many-to-one uses per-sourcebuy_amount.sell_amount - Order status: success,
status=1failure — verify after each create.status=2 - 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, orgate-cli cex spot market orderbookfrom this skill. Market depth, “is it a good time”, and full asset audits belong to other skills (see Judgment Logic Summary).gate-cli cex wallet balance total
- 请勿从本技能调用、
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, , preview before create).
sell_min_amountNotation
- : Invoke the listed tools in the same wave (any order among them is acceptable unless a later step depends on their output).
[P1] Parallel - : Serial — complete the previous step before starting the next.
→ - : No MCP call — parse amounts, split ratios, or restrict the coin set (e.g. user-supplied list only).
[P0] Plan - : Present Action Draft; wait for explicit Y before any write tool in that branch.
[Confirm] - : Write tool — only after Confirm unless the scenario explicitly ends at preview-only.
(W)
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 instead of fc tools.
gate-exchange-trading - #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 - :串行——完成前一步骤后再开始下一步。
→ - :无需调用MCP——解析金额、拆分比例或限制币种集合(例如仅使用用户提供的列表)。
[P0] Plan - :呈现操作草案;在该分支中执行任何写入工具前,等待用户明确回复Y。
[Confirm] - :写入工具——除非场景明确以仅预览结束,否则需在Confirm之后执行。
(W)
路由提醒(来自规范)
- 一对多场景**#4**、#5、#11:若用户仅使用现货买入/市价买入表述,未提及闪电互换/兑换/互换相关关键词,则路由至****而非fc工具。
gate-exchange-trading - #8、#20:仅进行预览,直到用户选择进行创建操作。
- #21:在未向用户说明不同产品路径的情况下,切勿将小额资产转GT操作静默混入“兑换为USDT”流程。
Base scenarios (#1–#8)
基础场景(#1–#8)
| # | User intent (paraphrase) | Mode | Signal | Atomic chain |
|---|---|---|---|---|
| 1 | Swap a fixed amount (e.g. 1 BTC) to USDT | 1→1 | S1 | [P1] |
| 2 | Swap full available balance of one asset to USDT (e.g. take-profit SOL) | 1→1 | S1 | [P1] |
| 3 | After deposit, swap asset A to USDT | 1→1 | S1 | [P1] |
| 4 | One source (e.g. 3000 USDT) flash into multiple targets with set spend per target (e.g. 1000 USDT each to BTC, ETH, SOL) | 1→N | S2 | [P1] |
| 5 | One source split by ratio (e.g. 1000 USDT: half BTC, half ETH) | 1→N | S2 | [P0] Compute per-leg |
| 6 | Named multiple assets → one target (e.g. BTC, ETH, DOGE → USDT), full balances | N→1 | S3 | [P1] |
| 7 | List recent flash swap history | Query | S4 | [P1] |
| 8 | Preview only: how much USDT for asset X (e.g. SOL), decide later | 1→1 | S1 | [P1] |
| # | 用户意图(转述) | 模式 | 信号 | 原子调用链 |
|---|---|---|---|---|
| 1 | 将固定金额(如1 BTC)兑换为USDT | 1→1 | S1 | [P1] |
| 2 | 将某一资产的全部可用余额兑换为USDT(如止盈SOL) | 1→1 | S1 | [P1] |
| 3 | 存款后,将资产A兑换为USDT | 1→1 | S1 | [P1] |
| 4 | 单一源资产(如3000 USDT)闪电兑换为多个目标资产,每个目标设置固定支出(如分别向BTC、ETH、SOL各支出1000 USDT) | 1→N | S2 | [P1] |
| 5 | 单一源资产按比例拆分(如1000 USDT:一半兑换BTC,一半兑换ETH) | 1→N | S2 | [P0] 根据用户比例计算每笔交易的 |
| 6 | 指定多种资产兑换为单一目标资产(如BTC、ETH、DOGE → USDT),使用全部余额 | N→1 | S3 | [P1] |
| 7 | 查询近期闪电互换历史 | 查询 | S4 | [P1] |
| 8 | 仅预览:资产X(如SOL)可兑换多少USDT,后续再决定是否执行 | 1→1 | S1 | [P1] |
Extended scenarios (#9–#13)
扩展场景(#9–#13)
| # | User intent (paraphrase) | Signal | Atomic chain |
|---|---|---|---|
| 9 | Whether a coin (e.g. APT) supports flash swap / pair limits | S4 | [P1] |
| 10 | Did the latest flash swap succeed | S4 | [P1] |
| 11 | USDT flash into target buy amounts (e.g. 0.1 BTC and 1 ETH) | S2 | [P0] Build params with |
| 12 | One-to-one non-USDT leg (e.g. 2 ETH → BTC) | S1 | [P1] |
| 13 | Multiple named alts → USDT; user may not know balances | N→1 | S3 |
| # | 用户意图(转述) | 信号 | 原子调用链 |
|---|---|---|---|
| 9 | 某币种(如APT)是否支持闪电互换 / 币种对限制 | S4 | [P1] |
| 10 | 最近一次闪电互换是否成功 | S4 | [P1] |
| 11 | USDT闪电兑换为目标资产的指定买入金额(如0.1 BTC和1 ETH) | S2 | [P0] 构建每笔交易的 |
| 12 | 一对一非USDT交易(如2 ETH → BTC) | S1 | [P1] |
| 13 | 多种指定替代币兑换为USDT;用户可能不清楚余额 | N→1 | S3 |
Dust, small size, and split scenarios (#14–#21)
小额资产、额度不足与拆分场景(#14–#21)
| # | User intent (paraphrase) | Signal | Atomic chain |
|---|---|---|---|
| 14 | “Too small” / may be below flash min (e.g. PEPE) | S5 | [P1] |
| 15 | Small 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] |
| 16 | Single-asset amount exceeds | S6 | [P1] |
| 17 | Several tickers → USDT; “swap everything that can” | N→1 | S3 |
| 18 | Ask min flash amount and whether current balance qualifies | S4 | [P1] |
| 19 | User supplies an explicit coin list in session (paste / list); flash all that can to USDT | N→1 | S3 |
| 20 | Tiny amount preview only (e.g. 5 USDT → SAT), not urgent to fill | S1 | [P1] |
| 21 | Clear wallet dust to GT | S7 | [P1] |
| # | 用户意图(转述) | 信号 | 原子调用链 |
|---|---|---|---|
| 14 | “金额太小” / 可能低于闪电互换最小值(如PEPE) | S5 | [P1] |
| 15 | 小额总额的一对多交易(如30 USDT拆分兑换DOGE和SHIB) | S2 | [P0] 若拆分比例不明确,与用户确认每笔USDT拆分金额 → [P1] |
| 16 | 单一资产金额超过 | S6 | [P1] |
| 17 | 多个币种兑换为USDT;“兑换所有可兑换的资产” | N→1 | S3 |
| 18 | 查询闪电互换最小金额以及当前余额是否符合要求 | S4 | [P1] |
| 19 | 用户在会话中提供明确的币种列表(粘贴/列出);将所有可兑换的资产闪电兑换为USDT | N→1 | S3 |
| 20 | 仅预览小额金额(如5 USDT → SAT),不急于成交 | S1 | [P1] |
| 21 | 将钱包小额资产转换为GT | S7 | [P1] |
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 , S7 dust to GT.
sell_max_amountKey data to extract:
- : S1 | S2 | S3 | S4 | S5 | S6 | S7 (combinations allowed, e.g. S5 then S1)
signal - ,
sell_assets, amounts, and whether the user asked for preview onlybuy_asset - : user used flash swap / convert / swap narrative vs pure spot buy wording (see routing table)
user_confirmed_flash_language
首先,尝试匹配原子工具调用链中的场景#1–#21,并严格按照编写的流程执行(并行/串行、预览检查、写入前确认)。
若没有匹配的场景,则回退:对请求进行分类。若属于超出范围(参见判断逻辑摘要),则停止操作并指明适用的技能,切勿调用fc或钱包转换工具。
若在范围内但未列入表格,则分配一个或多个信号:S1一对一闪电互换、S2一对多闪电互换、S3多对一资产合并、S4查询或历史、S5额度不足或小额资产诊断、S6超过拆分、S7小额资产转GT。
sell_max_amount需提取的关键数据:
- : S1 | S2 | S3 | S4 | S5 | S6 | S7(允许组合,如S5后接S1)
signal - 、
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 with:
gate-cli cex flash-swap pairs- (or equivalent filter per MCP): each sell asset (and targets as needed)
currency
Call with:
gate-cli cex spot account get- Parameters needed to read available balance for each relevant currency (sell side and USDT for one-to-many)
Key data to extract:
- ,
sell_min_amountper pairsell_max_amount - balances
available - Whether each leg passes min gate before preview
S5 rule: If < for a flash leg, do not call (or any preview variant) for that leg. Present a clear table (balance vs min gap) and optionally call to see if S7 applies.
availablesell_min_amountgate-cli cex flash-swap previewgate-cli cex wallet balance smallS6 rule: If 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.
sell_max_amount调用,参数:
gate-cli cex flash-swap pairs- (或MCP支持的等效过滤器):每个卖出资产(必要时包括目标资产)
currency
调用,参数:
gate-cli cex spot account get- 读取每个相关币种(卖出方和一对多模式下的USDT)可用余额所需的参数
需提取的关键数据:
- 每个币种对的、
sell_min_amountsell_max_amount - 余额
available - 在预览之前,每笔交易是否通过最小值检查
S5规则:若某笔闪电交易的 < ,请勿为该交易调用(或任何预览变体)。呈现清晰的表格(余额与最小值的差额),并可选调用查看是否适用S7路径。
availablesell_min_amountgate-cli cex flash-swap previewgate-cli cex wallet balance smallS6规则:若金额> ,规划连续批次;每个批次需要独立的预览、操作草案、用户回复Y、创建操作,以及创建后刷新余额才能进行下一次预览。将计划的批次数量限制在合理最大值(例如20),或在用户取消时停止——切勿无限循环。
sell_max_amountStep 3: Preview (choose one preview tool by mode)
步骤3:预览(根据模式选择预览工具)
One-to-one (S1) — Call with , , and either or .
gate-cli cex flash-swap preview-v1sell_assetbuy_assetsell_amountbuy_amountOne-to-many (S2) — Call with array (per leg amounts). Highlight per-leg preview errors.
gate-cli cex flash-swap preview-one-to-manyparamsMany-to-one (S3) — After filtering legs below min or zero balance, call with for remaining legs. Present will execute vs skipped summary.
gate-cli cex flash-swap preview-many-to-oneparamsKey data to extract:
- per successful leg
quote_id - Rates, receive amounts,
valid_timestamp - Any per-leg errors for user-visible highlighting
一对一(S1) —— 调用,参数包括、,以及或。
gate-cli cex flash-swap preview-v1sell_assetbuy_assetsell_amountbuy_amount一对多(S2) —— 调用,参数为数组(每笔交易的金额)。突出显示每笔交易的预览错误。
gate-cli cex flash-swap preview-one-to-manyparams多对一(S3) —— 过滤掉余额低于最小值或零的交易后,调用,参数为剩余交易的。呈现将执行与已跳过的摘要。
gate-cli cex flash-swap preview-many-to-oneparams需提取的关键数据:
- 每笔成功交易的
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 , not USDT flash swap.
gate-cli cex wallet balance convert-smallWait for explicit Y to execute or N to cancel. Without Y, call no write tool.
Key data to extract:
- : Y | N
user_confirmation - Whether parameters still match the last preview (if not, re-preview)
呈现操作草案,列出卖出/买入资产、金额、有效汇率或预估到账金额、报价有效期,以及多笔交易的状态。对于S7,草案必须说明操作是通过将小额资产转换为GT,而非USDT闪电互换。
gate-cli cex wallet balance convert-small等待用户明确回复Y执行或N取消。未收到Y时,切勿调用任何写入工具。
需提取的关键数据:
- : Y | N
user_confirmation - 参数是否与上次预览匹配(若不匹配,重新预览)
Step 5: Execute flash swap creates (after Y, one create family per request)
步骤5:执行闪电互换创建操作(收到Y后,每个请求调用一个创建工具)
Use exactly one of:
Call with body fields including and matching sell/buy amounts from preview.
gate-cli cex flash-swap create-v1quote_idCall with including each leg and amounts — exclude failed preview legs.
gate-cli cex flash-swap create-one-to-manyparamsquote_idCall with including each leg and amounts — exclude failed preview legs.
gate-cli cex flash-swap create-many-to-oneparamsquote_idKey data to extract:
- Per-order and IDs
status - Errors returned by the API
精确选择以下工具之一:
调用,参数包括和与预览匹配的卖出/买入金额。
gate-cli cex flash-swap create-v1quote_id调用,参数包括每笔交易的和金额 —— 排除预览失败的交易。
gate-cli cex flash-swap create-one-to-manyparamsquote_id调用,参数包括每笔交易的和金额 —— 排除预览失败的交易。
gate-cli cex flash-swap create-many-to-oneparamsquote_id需提取的关键数据:
- 每个订单的和ID
status - API返回的错误
Step 6: Verify order outcome
步骤6:验证订单结果
For each created order, read . If needed, Call with the order id to confirm details.
statusgate-cli cex flash-swap orderKey data to extract:
- Success vs failure per leg
- Final received amounts where provided
对于每个创建的订单,读取。必要时,调用并传入订单ID确认详情。
statusgate-cli cex flash-swap order需提取的关键数据:
- 每笔交易的成功/失败状态
- 最终到账金额(若提供)
Step 7: Query and history paths (S4)
步骤7:查询与历史路径(S4)
Call with appropriate / filters for history or “latest order”.
gate-cli cex flash-swap orderslimitCall with when the user needs detail on a specific id or you took the latest id from list.
gate-cli cex flash-swap orderorder_idFor supported-pair or min/max questions, use and as needed.
gate-cli cex flash-swap pairsgate-cli cex spot account getFor dust history, Call with optional filters per MCP.
gate-cli cex wallet balance small-historyKey data to extract:
- Human-readable table: time, sides, amounts, status
调用,使用合适的 / 过滤器查询历史或“最新订单”。
gate-cli cex flash-swap orderslimit当用户需要特定ID的详情,或从列表中获取最新ID时,调用并传入。
gate-cli cex flash-swap orderorder_id对于支持的币种对或最小/最大额度问题,根据需要使用和。
gate-cli cex flash-swap pairsgate-cli cex spot account get对于小额资产历史,调用并传入MCP支持的可选过滤器。
gate-cli cex wallet balance small-history需提取的关键数据:
- 易读表格:时间、交易方向、金额、状态
Step 8: Dust to GT path (S7)
步骤8:小额资产转GT路径(S7)
Call (no substitute for “list all account dust” beyond this tool’s contract).
gate-cli cex wallet balance smallPresent the convertible list. Action Draft must specify or exactly as the user confirmed.
currenciesis_allAfter Y, Call with the confirmed parameters.
gate-cli cex wallet balance convert-smallKey data to extract:
- Conversion result or error; optional follow-up with
gate-cli cex wallet balance small-history
调用(除该工具外,无其他工具可替代“列出所有账户小额资产”的功能)。
gate-cli cex wallet balance small呈现可转换的资产列表。操作草案必须精确指定用户确认的或参数。
currenciesis_all收到Y后,调用并传入确认的参数。
gate-cli cex wallet balance convert-small需提取的关键数据:
- 转换结果或错误;可选调用进行后续查询
gate-cli cex wallet balance small-history
Judgment Logic Summary
判断逻辑摘要
Signal definitions
信号定义
| Signal | Meaning | Primary tools |
|---|---|---|
| S1 | One-to-one flash | |
| S2 | One-to-many flash (user anchors flash/convert/swap, not pure spot buy) | |
| S3 | Many-to-one consolidation | |
| S4 | Queries: history, support, min check, order status | |
| S5 | Below flash minimum / fragile balance | Reads only until min met; optional |
| S6 | Amount over | Same create family as S1/S2/S3 but sequential batches with fresh preview and confirmation per batch |
| S7 | Dust to GT | |
| 信号 | 含义 | 主要工具 |
|---|---|---|
| S1 | 一对一闪电互换 | |
| S2 | 一对多闪电互换(用户提及闪电/兑换/互换,而非纯现货买入) | |
| S3 | 多对一资产合并 | |
| S4 | 查询:历史、支持情况、额度检查、订单状态 | |
| S5 | 低于闪电互换最小值 / 余额不足 | 仅读取数据直到满足最小值;可选调用 |
| S6 | 金额超过 | 与S1/S2/S3使用相同的创建工具,但分批串行执行,每批需重新预览并确认 |
| S7 | 小额资产转GT | |
Out of scope routing (do not use this skill’s tool list)
超出范围的路由(请勿使用本技能的工具列表)
| User intent | Route to |
|---|---|
| Research, “why”, slippage, depth, liquidity, charts | |
| Spot buy/sell narrative (market/limit, “buy some”, “DCA”, “bid”) without flash/convert anchor | |
| Futures / margin trading | |
| Transfers between accounts (spot ↔ futures, subaccounts) | |
| Full portfolio, margin risk, liquidation context | |
| Earn / staking | |
| On-chain DEX swap | DEX skills (e.g. |
| 用户意图 | 路由至 |
|---|---|
| 研究、“原因”、滑点、深度、流动性、图表 | |
| 现货买入/卖出表述(市价/限价、“买入一些”、“定投”、“出价”),未提及闪电/兑换关键词 | |
| 期货/杠杆交易 | |
| 账户间转账(现货 ↔ 期货、子账户) | |
| 完整投资组合、杠杆风险、清算相关 | |
| 理财/质押 | |
| 链上DEX互换 | DEX技能(如 |
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 (do not invent seconds)
valid_timestamp - 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, , shortfall
sell_min_amount - 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 exactly as user confirmed
is_all - 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 (or
gate-cli cex flash-swap create/ multi-currency create variants) and nocreate-v1without prior Action Draft and explicit Y.gate-cli cex wallet balance convert-small - Never use an expired or stale ; if the user delayed, re-preview.
quote_id - 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
错误处理
| Situation | Action |
|---|---|
| State limits unknown; warn before preview; avoid guessing min/max |
| Preview returns error | Do not create; show message; suggest adjusting size or spot path |
| Create returns failure | Do not auto-retry; suggest fresh preview |
| Warn balance unknown; do not invent balances |
| Do not call convert; explain dust list unavailable |
| Show error; no silent retry |
| User says N after draft | Stop; no writes |
| 情况 | 操作 |
|---|---|
| 说明额度限制未知;预览前发出警告;切勿猜测最小/最大额度 |
| 预览返回错误 | 不执行创建操作;显示错误信息;建议调整金额或使用现货路径 |
| 创建操作返回失败 | 不自动重试;建议重新预览 |
| 警告余额未知;切勿虚构余额 |
| 不调用转换操作;说明无法获取小额资产列表 |
| 显示错误信息;不静默重试 |
| 用户在草案后回复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 from your skills root when present
gate-skills-disambiguation.md
- 映射场景的标准工具顺序:上述原子工具调用链(场景#1–#21)
- 易读场景和提示示例:
references/scenarios.md - 共享消歧义文档:若存在,从技能根目录读取
gate-skills-disambiguation.md