gate-dex-trade-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gate DEX CLI — Swap

Gate DEX CLI — 兑换功能

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 call MCP tools explicitly listed in this skill. Tools not documented here must NOT be called, even if they exist in the MCP server.
  • Only use the
    gate-dex
    CLI subcommands explicitly listed in this skill and its references.
    Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
One-shot DEX swap via CLI. GV checkin + sign + broadcast are all built into the
swap
command. No external
tx-checkin
binary needed. Supports EVM and Solana.
⚠️ 停止操作 — 在继续之前,您必须阅读并严格遵循共享运行时规则。 在未读完所有规则前,请勿选择或调用任何工具。这些规则具有最高优先级。 → 阅读 gate-runtime-rules.md
  • 仅调用本技能中明确列出的MCP工具。即使MCP服务器中存在其他工具,也不得调用未在此处记录的工具。
  • 仅使用本技能及其参考文档中明确列出的
    gate-dex
    CLI子命令
    。即使其他接口提供了未在此处记录的命令,也不得在这些工作流中运行它们。
通过CLI实现一站式DEX兑换。
swap
命令内置GV核验+签名+广播功能,无需外部
tx-checkin
二进制文件。支持EVM和Solana链。

Skill Boundaries

技能边界

This skillRoute to other skill
Swap tokens (same-chain)Auth / login issues →
gate-dex-wallet-cli
Cross-chain bridgeBalance, address, token list →
gate-dex-wallet-cli
Swap quote (preview)Token transfers (send) →
gate-dex-wallet-cli
Swap / bridge history & order detailK-line, token info, token security →
gate-dex-market-cli
Swappable & bridge token discovery

本技能覆盖场景路由至其他技能的场景
同链代币兑换认证/登录问题 →
gate-dex-wallet-cli
跨链桥接余额、地址、代币列表查询 →
gate-dex-wallet-cli
兑换报价(预览)代币转账(发送) →
gate-dex-wallet-cli
兑换/桥接历史及订单详情K线、代币信息、代币安全查询 →
gate-dex-market-cli
可兑换及可桥接代币查询

Applicable Scenarios

适用场景

  • "Swap ETH for USDT", "exchange tokens", "buy SOL", "convert", "trade"
  • Get a swap quote before executing
  • View swap history or a specific swap order detail
  • List swappable tokens or cross-chain bridge tokens

  • "将ETH兑换为USDT"、"代币交易"、"买入SOL"、"转换代币"、"交易"
  • 执行兑换前获取报价
  • 查看兑换历史或特定兑换订单详情
  • 查询可兑换代币或跨链桥接代币

CLI Commands

CLI命令

Quote (preview only, no signing)

报价(仅预览,无需签名)

bash
undefined
bash
undefined

EVM: swap native ETH → USDT on Ethereum (chain_id = 1)

EVM:在以太坊(chain_id = 1)上将原生ETH兑换为USDT

gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01
gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01

EVM: swap USDT → USDC on Arbitrum

EVM:在Arbitrum上将USDT兑换为USDC

gate-dex quote --from-chain 42161 --to-chain 42161
--from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
--to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
--amount 100
gate-dex quote --from-chain 42161 --to-chain 42161
--from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
--to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
--amount 100

Solana: swap native SOL → USDC

Solana:将原生SOL兑换为USDC

gate-dex quote --from-chain 501 --to-chain 501 --from -
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.1
gate-dex quote --from-chain 501 --to-chain 501 --from -
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.1

Cross-chain bridge: ETH on Ethereum → USDT on Arbitrum

跨链桥接:将以太坊上的ETH桥接至Arbitrum上的USDT

gate-dex quote --from-chain 1 --to-chain 42161 --from -
--to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1
--to-wallet 0xYourArbitrumAddress

Returns estimated output amount, price impact, route, and fee. **No signing.**
gate-dex quote --from-chain 1 --to-chain 42161 --from -
--to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1
--to-wallet 0xYourArbitrumAddress

返回预估输出数量、滑点影响、路由路径和手续费。**无需签名**。

One-Shot Swap (quote + GV checkin + sign + broadcast)

一站式兑换(报价+GV核验+签名+广播)

bash
undefined
bash
undefined

EVM: swap native ETH → USDT

EVM:将原生ETH兑换为USDT

gate-dex swap --from-chain 1 --to-chain 1 --from -
--to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01
gate-dex swap --from-chain 1 --to-chain 1 --from -
--to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01

EVM: swap ERC20 with custom slippage

EVM:自定义滑点兑换ERC20代币

gate-dex swap --from-chain 42161 --to-chain 42161
--from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
--to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
--amount 100 --slippage 0.005
gate-dex swap --from-chain 42161 --to-chain 42161
--from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
--to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
--amount 100 --slippage 0.005

Solana: swap SOL → USDC

Solana:将SOL兑换为USDC

gate-dex swap --from-chain 501 --to-chain 501 --from -
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.05
gate-dex swap --from-chain 501 --to-chain 501 --from -
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.05

Cross-chain bridge: ETH on Ethereum → USDT on Arbitrum

跨链桥接:将以太坊上的ETH桥接至Arbitrum上的USDT

gate-dex swap --from-chain 1 --to-chain 42161 --from -
--to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1
--to-wallet 0xYourArbitrumAddress

| Option | Required | Description |
|--------|----------|-------------|
| `--from-chain <id>` | Yes | Source chain ID |
| `--to-chain <id>` | No | Destination chain ID (defaults to same as from-chain) |
| `--from <token>` | Yes | Source token contract; use `-` for native token (ETH/SOL/BNB) |
| `--to <token>` | Yes | Destination token contract |
| `--amount <n>` | Yes | Human-readable input amount |
| `--slippage <n>` | No | Slippage tolerance as decimal (default 0.03 = 3%) |
| `--native-in <0\|1>` | No | `1` if source token is native (ETH/SOL); default `0` |
| `--native-out <0\|1>` | No | `1` if destination token is native; default `0` |
| `--wallet <addr>` | No | Source wallet address (auto-detected from auth) |
| `--to-wallet <addr>` | No | Destination wallet address (required for cross-chain bridge) |
gate-dex swap --from-chain 1 --to-chain 42161 --from -
--to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1
--to-wallet 0xYourArbitrumAddress

| 选项 | 是否必填 | 描述 |
|--------|----------|-------------|
| `--from-chain <id>` | 是 | 源链ID |
| `--to-chain <id>` | 否 | 目标链ID(默认与源链相同) |
| `--from <token>` | 是 | 源代币合约地址;原生代币(ETH/SOL/BNB)使用`-`表示 |
| `--to <token>` | 是 | 目标代币合约地址 |
| `--amount <n>` | 是 | 人类可读的输入数量 |
| `--slippage <n>` | 否 | 滑点容忍度(小数形式,默认0.03=3%) |
| `--native-in <0\|1>` | 否 | 若源代币为原生代币(ETH/SOL)则设为`1`;默认`0` |
| `--native-out <0\|1>` | 否 | 若目标代币为原生代币则设为`1`;默认`0` |
| `--wallet <addr>` | 否 | 源钱包地址(从认证信息中自动检测) |
| `--to-wallet <addr>` | 否 | 目标钱包地址(跨链桥接时必填) |

Swap History

兑换历史

bash
gate-dex swap-history
bash
gate-dex swap-history

Swap Order Detail

兑换订单详情

bash
gate-dex swap-detail <order_id>
bash
gate-dex swap-detail <order_id>

List Swappable Tokens

查询可兑换代币

bash
gate-dex swap-tokens
gate-dex swap-tokens --chain eth
gate-dex swap-tokens --chain sol --search USDC
Use
--search
to look up a token address by symbol.
bash
gate-dex swap-tokens
gate-dex swap-tokens --chain eth
gate-dex swap-tokens --chain sol --search USDC
使用
--search
通过代币符号查询代币地址。

List Cross-Chain Bridge Tokens

查询跨链桥接代币

bash
gate-dex bridge-tokens
gate-dex bridge-tokens --src-chain eth --dest-chain arb

bash
gate-dex bridge-tokens
gate-dex bridge-tokens --src-chain eth --dest-chain arb

Internal Flow of
swap
Command

swap
命令内部流程

The agent does not run any of these steps manually — the CLI handles everything:
EVM same-chain flow:
1. Load auth; fetch wallet address
2. Get quote
3. Check if ERC20 approve is needed → auto-approve if needed (GV checkin for approve)
4. Re-quote after approve
5. Build swap transaction
6. GV security checkin (built-in) for swap tx
7. Server-side signing
8. Broadcast
9. Print tx hash + order ID

EVM cross-chain bridge flow (from-chain ≠ to-chain):
1. Load auth; fetch wallet address
2. Get cross-chain bridge quote (--from-chain / --to-chain / --to-wallet required)
3. Check if ERC20 approve is needed on source chain → auto-approve if needed
4. Build bridge transaction on source chain
5. GV security checkin (built-in)
6. Server-side signing
7. Broadcast on source chain
8. Print source tx hash + order ID (destination arrival is async, monitor via swap-detail)

Solana flow:
1. Load auth; fetch Solana address
2. Get quote
3. Build transaction (base64 → base58 conversion handled internally)
4. GV security checkin (built-in, includes priority fee)
5. Server-side signing
6. Broadcast via Solana mainnet RPC
7. Print tx hash + order ID
CRITICAL: There is no
tx-checkin
binary to run. Do NOT attempt to run a checkin binary before
swap
. The CLI has GV checkin built in.

Agent无需手动执行以下步骤 — 所有操作由CLI自动处理:
EVM同链流程:
1. 加载认证信息;获取钱包地址
2. 获取报价
3. 检查是否需要ERC20授权 → 若需要则自动授权(授权操作包含GV核验)
4. 授权完成后重新获取报价
5. 构建兑换交易
6. 对兑换交易进行内置GV安全核验
7. 服务器端签名
8. 广播交易
9. 打印交易哈希 + 订单ID

EVM跨链桥接流程(源链≠目标链):
1. 加载认证信息;获取钱包地址
2. 获取跨链桥接报价(需指定--from-chain / --to-chain / --to-wallet)
3. 检查源链是否需要ERC20授权 → 若需要则自动授权
4. 在源链构建桥接交易
5. 执行内置GV安全核验
6. 服务器端签名
7. 在源链广播交易
8. 打印源链交易哈希 + 订单ID(目标链到账为异步过程,可通过swap-detail监控)

Solana流程:
1. 加载认证信息;获取Solana地址
2. 获取报价
3. 构建交易(内部处理base64→base58转换)
4. 执行内置GV安全核验(包含优先手续费)
5. 服务器端签名
6. 通过Solana主网RPC广播交易
7. 打印交易哈希 + 订单ID
重要提示:不存在需要运行的
tx-checkin
二进制文件。请勿在执行
swap
前尝试运行核验二进制文件,CLI已内置GV核验功能。

Chain IDs

链ID

ChainIDNative Token
Ethereum1ETH
BSC56BNB
Polygon137MATIC
Arbitrum42161ETH
Optimism10ETH
Avalanche43114AVAX
Base8453ETH
Solana501SOL
Native token address: Use
-
as the token address for native tokens (ETH, SOL, BNB, etc.).

链名称ID原生代币
以太坊1ETH
BSC56BNB
Polygon137MATIC
Arbitrum42161ETH
Optimism10ETH
Avalanche43114AVAX
Base8453ETH
Solana501SOL
原生代币地址:原生代币(ETH、SOL、BNB等)使用
-
作为代币地址。

Slippage Guidelines

滑点指南

Token typeRecommended slippage
Stablecoins (USDT ↔ USDC)0.005 (0.5%)
Major tokens (ETH, BTC, SOL)0.01–0.03 (1%–3%)
Mid-cap tokens0.03 (3%)
Meme / low-liquidity tokens0.05–0.10 (5%–10%)

代币类型推荐滑点
稳定币(USDT ↔ USDC)0.005(0.5%)
主流代币(ETH、BTC、SOL)0.01–0.03(1%–3%)
中市值代币0.03(3%)
迷因币/低流动性代币0.05–0.10(5%–10%)

Common Token Addresses

常见代币地址

ChainUSDTUSDC
Ethereum (1)
0xdAC17F958D2ee523a2206206994597C13D831ec7
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arbitrum (42161)
0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
0xaf88d065e77c8cC2239327C5EDb3A432268e5831
BSC (56)
0x55d398326f99059fF775485246999027B3197955
0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d
Solana (501)
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

链名称USDTUSDC
以太坊(1)
0xdAC17F958D2ee523a2206206994597C13D831ec7
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arbitrum(42161)
0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
0xaf88d065e77c8cC2239327C5EDb3A432268e5831
BSC(56)
0x55d398326f99059fF775485246999027B3197955
0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d
Solana(501)
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

Workflow

工作流

Step 1: Auth check

步骤1:认证检查

Call
gate-dex status
to verify the session.
Key data to extract:
  • is_authenticated
    : boolean
  • If not logged in → instruct the user to run
    gate-dex login
    (delegated to
    gate-dex-wallet-cli
    ).
调用
gate-dex status
验证会话状态。
需提取的关键数据:
  • is_authenticated
    :布尔值
  • 若未登录 → 指导用户运行
    gate-dex login
    (路由至
    gate-dex-wallet-cli
    )。

Step 2: Collect parameters

步骤2:收集参数

Required:
from-chain
,
to-chain
(defaults to
from-chain
),
from-token
,
to-token
,
amount
. Optional:
slippage
,
to-wallet
(cross-chain only).
If a token symbol is given without an address → call
gate-dex swap-tokens --chain <chain> --search <symbol>
and confirm the resolved address with the user.
Key data to extract:
  • from_chain
    ,
    to_chain
    ,
    from_token
    ,
    to_token
    ,
    amount
    ,
    slippage
    ,
    to_wallet
必填参数:
from-chain
to-chain
(默认与
from-chain
相同)、
from-token
to-token
amount
。可选参数:
slippage
to-wallet
(仅跨链场景)。
若用户仅提供代币符号未提供地址 → 调用
gate-dex swap-tokens --chain <chain> --search <symbol>
并与用户确认解析后的地址。
需提取的关键数据:
  • from_chain
    to_chain
    from_token
    to_token
    amount
    slippage
    to_wallet

Step 3: Get quote

步骤3:获取报价

Call
gate-dex quote --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n>
.
Key data to extract:
  • estimated_out
    ,
    price_impact
    ,
    route
    ,
    fee
    ,
    slippage_used
调用
gate-dex quote --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n>
需提取的关键数据:
  • estimated_out
    price_impact
    route
    fee
    slippage_used

Step 4: User confirmation in chat (MANDATORY)

步骤4:聊天中获取用户确认(必填)

Render the Swap Confirmation Template and wait for an explicit "confirm" reply.
  • "cancel" → abort.
  • "modify" → return to Step 2.
渲染兑换确认模板并等待用户明确回复"confirm"。
  • "cancel" → 终止操作。
  • "modify" → 返回步骤2。

Step 5: Execute

步骤5:执行兑换

Call
gate-dex swap --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n> [--slippage <n>] [--to-wallet <addr>]
. The CLI handles GV check-in, signing, and broadcast internally.
Key data to extract:
  • tx_hash
    ,
    order_id
    ,
    explorer_url
调用
gate-dex swap --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n> [--slippage <n>] [--to-wallet <addr>]
。CLI会自动处理GV核验、签名和广播。
需提取的关键数据:
  • tx_hash
    order_id
    explorer_url

Step 6: Render the report

步骤6:生成报告

Format the output per Report Template below. Surface the mandatory Risk Disclosure.
NEVER run
gate-dex swap
before receiving explicit user confirmation in Step 4.

按照以下报告模板格式化输出。需显示强制风险披露内容。
绝对禁止在步骤4收到用户明确确认前运行
gate-dex swap

Judgment Logic Summary

判断逻辑总结

User IntentTrigger PhrasesAction
Same-chain swap"swap", "exchange", "convert", "buy", "sell" + same chainquote → confirm → swap (Steps 3–5)
Cross-chain bridge"bridge", "cross-chain", different from-chain / to-chainbridge-tokens → quote (with
--to-wallet
) → confirm → swap
Quote only"how much would I get", "estimate", "preview" with no execution intentStep 3 only; do not execute
Resolve token address"what's the address", "find token X"
gate-dex swap-tokens --search
List swappable tokens"what tokens can I swap"
gate-dex swap-tokens
List bridge pairs"what cross-chain pairs are supported"
gate-dex bridge-tokens
Order history"my swap history", "past trades"
gate-dex swap-history
Order detail"details of order X", bridge settlement check
gate-dex swap-detail <order_id>
Authentication failure
Not logged in
from CLI
Route to
gate-dex-wallet-cli
for login

用户意图触发短语操作
同链兑换"swap"、"exchange"、"convert"、"buy"、"sell" + 同链报价→确认→兑换(步骤3–5)
跨链桥接"bridge"、"cross-chain"、源链/目标链不同查询桥接代币→报价(带
--to-wallet
)→确认→兑换
仅获取报价"我能得到多少"、"预估"、"预览"且无执行意向仅执行步骤3;不进行兑换
解析代币地址"地址是什么"、"找到代币X"
gate-dex swap-tokens --search
查询可兑换代币"我可以兑换哪些代币"
gate-dex swap-tokens
查询跨链桥接对"支持哪些跨链交易对"
gate-dex bridge-tokens
订单历史"我的兑换历史"、"过往交易"
gate-dex swap-history
订单详情"订单X的详情"、桥接到账查询
gate-dex swap-detail <order_id>
认证失败CLI返回
Not logged in
路由至
gate-dex-wallet-cli
进行登录

Swap Confirmation Template

兑换确认模板

========== Swap Confirmation ==========
From:     {amount} {from_symbol} on {from_chain}
To:       ~{estimated_out} {to_symbol} on {to_chain}
Slippage: {slippage}%
Route:    {route_path}
Fee:      {fee_usd} USD
========================================
Reply "confirm" to execute, "cancel" to abort.

========== 兑换确认 ==========
转出:     {amount} {from_symbol}({from_chain}链)
转入:     ~{estimated_out} {to_symbol}({to_chain}链)
滑点:     {slippage}%
路由路径:    {route_path}
手续费:      {fee_usd} USD
========================================
回复"confirm"执行兑换,"cancel"终止操作。

Report Template

报告模板

After a successful
swap
call:
========== Swap Result ==========
Status:       Submitted
From:         {amount} {from_symbol} on {from_chain}
To:           ~{estimated_out} {to_symbol} on {to_chain}
Tx hash:      {tx_hash}
Explorer:     {explorer_url}
Order ID:     {order_id}
=================================
{Cross-chain note (if applicable): destination arrival is asynchronous; track via gate-dex swap-detail <order_id>.}

Risk Disclosure: Digital asset trading involves significant risk and may result in partial or total loss of your investment. For informational purposes only; not investment, financial, tax, or legal advice.
For
quote
(preview only):
========== Swap Quote (Preview) ==========
{Same fields as Swap Confirmation Template}
==========================================
No transaction has been signed or broadcast.
For
swap-history
/
swap-detail
: render a compact list/table of order id, chain pair, token pair, status, timestamp.

成功调用
swap
后:
========== 兑换结果 ==========
状态:       已提交
转出:         {amount} {from_symbol}({from_chain}链)
转入:           ~{estimated_out} {to_symbol}({to_chain}链)
交易哈希:      {tx_hash}
区块链浏览器:     {explorer_url}
订单ID:     {order_id}
=================================
{跨链提示(若适用):目标链到账为异步过程;可通过gate-dex swap-detail <order_id>跟踪。}

风险披露:数字资产交易存在重大风险,可能导致部分或全部投资损失。本内容仅供参考,不构成投资、财务、税务或法律建议。
仅获取报价(预览)时:
========== 兑换报价(预览) ==========
{与兑换确认模板相同的字段}
==========================================
未签署或广播任何交易。
对于
swap-history
/
swap-detail
:渲染订单ID、链对、代币对、状态、时间戳的紧凑列表/表格。

Conversation Examples

对话示例

Example 1: Swap ETH → USDT on Ethereum User: "Swap 0.01 ETH for USDT on Ethereum"
  1. gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01
  2. Show quote to user; wait for "confirm".
  3. gate-dex swap --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01
  4. Display tx hash + etherscan link + order ID.
Example 2: Swap SOL → USDC User: "Swap 0.1 SOL for USDC"
  1. gate-dex quote --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1
  2. Show quote; user confirms.
  3. gate-dex swap --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1
  4. Display tx hash + solscan link.
Example 3: Unknown token symbol User: "Swap 10 USDT for ARB on Arbitrum"
  1. gate-dex swap-tokens --chain arb --search ARB
    → get ARB contract address.
  2. Proceed with quote and swap using the resolved address.
Example 4: Cross-chain bridge ETH (Ethereum) → USDT (Arbitrum) User: "Bridge 0.1 ETH from Ethereum to USDT on Arbitrum"
  1. gate-dex bridge-tokens --src-chain eth --dest-chain arb
    → confirm the token pair is supported.
  2. gate-dex quote --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress
  3. Show quote to user; wait for "confirm".
  4. gate-dex swap --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress
  5. Display source chain tx hash; note that destination arrival is async — user can track via
    gate-dex swap-detail <order_id>
    .

示例1:在以太坊上将ETH兑换为USDT 用户: "在以太坊上将0.01 ETH兑换为USDT"
  1. gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01
  2. 向用户展示报价;等待用户回复"confirm"。
  3. gate-dex swap --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01
  4. 显示交易哈希 + etherscan链接 + 订单ID。
示例2:将SOL兑换为USDC 用户: "将0.1 SOL兑换为USDC"
  1. gate-dex quote --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1
  2. 展示报价;用户确认。
  3. gate-dex swap --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1
  4. 显示交易哈希 + solscan链接。
示例3:未知代币符号 用户: "在Arbitrum上将10 USDT兑换为ARB"
  1. gate-dex swap-tokens --chain arb --search ARB
    → 获取ARB合约地址。
  2. 使用解析后的地址进行报价和兑换。
示例4:跨链桥接以太坊ETH至Arbitrum USDT 用户: "将0.1 ETH从以太坊桥接至Arbitrum的USDT"
  1. gate-dex bridge-tokens --src-chain eth --dest-chain arb
    → 确认代币对支持桥接。
  2. gate-dex quote --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress
  3. 向用户展示报价;等待用户回复"confirm"。
  4. gate-dex swap --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress
  5. 显示源链交易哈希;提示目标链到账为异步过程 — 用户可通过
    gate-dex swap-detail <order_id>
    跟踪。

Error Handling

错误处理

ErrorHandling
Not logged in
Run
gate-dex login
Insufficient balanceAbort; show shortfall
Quote expiredCLI re-quotes automatically before signing
Slippage too lowSuggest higher slippage (0.05 for volatile tokens)
GV checkin failed (built-in)CLI displays error; suggest retry
Broadcast failedDisplay error code; do not auto-retry
User cancelsAbort immediately

错误处理方式
Not logged in
运行
gate-dex login
余额不足终止操作;显示差额
报价过期CLI会在签名前自动重新获取报价
滑点设置过低建议提高滑点(波动代币建议0.05)
GV核验失败(内置)CLI显示错误;建议重试
广播失败显示错误代码;不自动重试
用户取消立即终止操作

Security Rules

安全规则

  1. Confirm before swap: Always get explicit user confirmation before running
    gate-dex swap
    . Without explicit user confirmation in chat, no
    swap
    command may be executed — only
    quote
    and other read-only commands are allowed.
  2. Show quote first: Always run
    quote
    first so the user can see estimated output.
  3. No tx-checkin binary: CLI handles GV checkin internally — do not run any external binary.
  4. Audit unfamiliar tokens: Recommend
    gate-dex token-risk
    before swapping unknown tokens.
  5. Transaction irreversibility: On-chain swaps and bridges are generally irreversible. Always re-verify chain, token addresses, amount, and (for bridge) destination wallet with the user before executing.

  1. 兑换前确认:运行
    gate-dex swap
    前必须获取用户明确确认。未收到聊天中用户的明确确认,不得执行任何
    swap
    命令 — 仅允许执行
    quote
    及其他只读命令。
  2. 先展示报价:必须先运行
    quote
    让用户查看预估输出。
  3. 无tx-checkin二进制文件:CLI已内置GV核验功能 — 不得运行任何外部二进制文件。
  4. 审核陌生代币:建议在兑换未知代币前运行
    gate-dex token-risk
  5. 交易不可逆:链上兑换和桥接通常不可逆。执行前必须与用户再次核实链、代币地址、数量及(桥接场景)目标钱包。

Risk Disclosure

风险披露

Mandatory in trade output: Digital asset trading involves significant risk and may result in partial or total loss of your investment. Cross-chain bridge transactions add settlement-time and counterparty risk; destination arrival is asynchronous.
The above is for informational purposes only and does not constitute investment, financial, tax, or legal advice. AI-assisted outputs are for general information only and do not constitute any representation, warranty, or guarantee by Gate. This skill is intended for users aged 18 or above with full civil capacity; availability may vary by jurisdiction.
交易输出中必须包含:数字资产交易存在重大风险,可能导致部分或全部投资损失。跨链桥接交易额外存在结算时间和对手方风险;目标链到账为异步过程。
以上内容仅供参考,不构成投资、财务、税务或法律建议。AI辅助输出仅作通用信息,不代表Gate作出任何陈述、保证或承诺。本技能面向年满18周岁且具备完全民事行为能力的用户;可用性可能因司法管辖区而异。