gate-dex-trade-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGate 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 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.
gate-dex
One-shot DEX swap via CLI. GV checkin + sign + broadcast are all built into thecommand. No externalswapbinary needed. Supports EVM and Solana.tx-checkin
⚠️ 停止操作 — 在继续之前,您必须阅读并严格遵循共享运行时规则。
在未读完所有规则前,请勿选择或调用任何工具。这些规则具有最高优先级。
→ 阅读 gate-runtime-rules.md
- 仅调用本技能中明确列出的MCP工具。即使MCP服务器中存在其他工具,也不得调用未在此处记录的工具。
- 仅使用本技能及其参考文档中明确列出的CLI子命令。即使其他接口提供了未在此处记录的命令,也不得在这些工作流中运行它们。
gate-dex
通过CLI实现一站式DEX兑换。命令内置GV核验+签名+广播功能,无需外部swap二进制文件。支持EVM和Solana链。tx-checkin
Skill Boundaries
技能边界
| This skill | Route to other skill |
|---|---|
| Swap tokens (same-chain) | Auth / login issues → |
| Cross-chain bridge | Balance, address, token list → |
| Swap quote (preview) | Token transfers (send) → |
| Swap / bridge history & order detail | K-line, token info, token security → |
| Swappable & bridge token discovery | — |
| 本技能覆盖场景 | 路由至其他技能的场景 |
|---|---|
| 同链代币兑换 | 认证/登录问题 → |
| 跨链桥接 | 余额、地址、代币列表查询 → |
| 兑换报价(预览) | 代币转账(发送) → |
| 兑换/桥接历史及订单详情 | K线、代币信息、代币安全查询 → |
| 可兑换及可桥接代币查询 | — |
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
undefinedbash
undefinedEVM: 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
--from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
--to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
--amount 100
gate-dex quote --from-chain 42161 --to-chain 42161
--from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
--to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
--amount 100
--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
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.1
gate-dex quote --from-chain 501 --to-chain 501 --from -
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.1
--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
--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
--to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1
--to-wallet 0xYourArbitrumAddress
返回预估输出数量、滑点影响、路由路径和手续费。**无需签名**。One-Shot Swap (quote + GV checkin + sign + broadcast)
一站式兑换(报价+GV核验+签名+广播)
bash
undefinedbash
undefinedEVM: swap native ETH → USDT
EVM:将原生ETH兑换为USDT
gate-dex swap --from-chain 1 --to-chain 1 --from -
--to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01
--to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01
gate-dex swap --from-chain 1 --to-chain 1 --from -
--to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01
--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
--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
--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
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.05
gate-dex swap --from-chain 501 --to-chain 501 --from -
--to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.05
--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
--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
--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-historybash
gate-dex swap-historySwap 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 USDCUse to look up a token address by symbol.
--searchbash
gate-dex swap-tokens
gate-dex swap-tokens --chain eth
gate-dex swap-tokens --chain sol --search USDC使用通过代币符号查询代币地址。
--searchList Cross-Chain Bridge Tokens
查询跨链桥接代币
bash
gate-dex bridge-tokens
gate-dex bridge-tokens --src-chain eth --dest-chain arbbash
gate-dex bridge-tokens
gate-dex bridge-tokens --src-chain eth --dest-chain arbInternal Flow of swap
Command
swapswap
命令内部流程
swapThe 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 IDCRITICAL: There is no binary to run. Do NOT attempt to run a checkin binary before . The CLI has GV checkin built in.
tx-checkinswapAgent无需手动执行以下步骤 — 所有操作由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重要提示:不存在需要运行的二进制文件。请勿在执行前尝试运行核验二进制文件,CLI已内置GV核验功能。
tx-checkinswapChain IDs
链ID
| Chain | ID | Native Token |
|---|---|---|
| Ethereum | 1 | ETH |
| BSC | 56 | BNB |
| Polygon | 137 | MATIC |
| Arbitrum | 42161 | ETH |
| Optimism | 10 | ETH |
| Avalanche | 43114 | AVAX |
| Base | 8453 | ETH |
| Solana | 501 | SOL |
Native token address: Use as the token address for native tokens (ETH, SOL, BNB, etc.).
-| 链名称 | ID | 原生代币 |
|---|---|---|
| 以太坊 | 1 | ETH |
| BSC | 56 | BNB |
| Polygon | 137 | MATIC |
| Arbitrum | 42161 | ETH |
| Optimism | 10 | ETH |
| Avalanche | 43114 | AVAX |
| Base | 8453 | ETH |
| Solana | 501 | SOL |
原生代币地址:原生代币(ETH、SOL、BNB等)使用作为代币地址。
-Slippage Guidelines
滑点指南
| Token type | Recommended slippage |
|---|---|
| Stablecoins (USDT ↔ USDC) | 0.005 (0.5%) |
| Major tokens (ETH, BTC, SOL) | 0.01–0.03 (1%–3%) |
| Mid-cap tokens | 0.03 (3%) |
| Meme / low-liquidity tokens | 0.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
常见代币地址
| Chain | USDT | USDC |
|---|---|---|
| Ethereum (1) | | |
| Arbitrum (42161) | | |
| BSC (56) | | |
| Solana (501) | | |
| 链名称 | USDT | USDC |
|---|---|---|
| 以太坊(1) | | |
| Arbitrum(42161) | | |
| BSC(56) | | |
| Solana(501) | | |
Workflow
工作流
Step 1: Auth check
步骤1:认证检查
Call to verify the session.
gate-dex statusKey data to extract:
- : boolean
is_authenticated - If not logged in → instruct the user to run (delegated to
gate-dex login).gate-dex-wallet-cli
调用验证会话状态。
gate-dex status需提取的关键数据:
- :布尔值
is_authenticated - 若未登录 → 指导用户运行(路由至
gate-dex login)。gate-dex-wallet-cli
Step 2: Collect parameters
步骤2:收集参数
Required: , (defaults to ), , , . Optional: , (cross-chain only).
from-chainto-chainfrom-chainfrom-tokento-tokenamountslippageto-walletIf a token symbol is given without an address → call and confirm the resolved address with the user.
gate-dex swap-tokens --chain <chain> --search <symbol>Key data to extract:
- ,
from_chain,to_chain,from_token,to_token,amount,slippageto_wallet
必填参数:、(默认与相同)、、、。可选参数:、(仅跨链场景)。
from-chainto-chainfrom-chainfrom-tokento-tokenamountslippageto-wallet若用户仅提供代币符号未提供地址 → 调用并与用户确认解析后的地址。
gate-dex swap-tokens --chain <chain> --search <symbol>需提取的关键数据:
- 、
from_chain、to_chain、from_token、to_token、amount、slippageto_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,feeslippage_used
调用。
gate-dex quote --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n>需提取的关键数据:
- 、
estimated_out、price_impact、route、feeslippage_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 . The CLI handles GV check-in, signing, and broadcast internally.
gate-dex swap --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n> [--slippage <n>] [--to-wallet <addr>]Key data to extract:
- ,
tx_hash,order_idexplorer_url
调用。CLI会自动处理GV核验、签名和广播。
gate-dex swap --from-chain <id> --to-chain <id> --from <token> --to <token> --amount <n> [--slippage <n>] [--to-wallet <addr>]需提取的关键数据:
- 、
tx_hash、order_idexplorer_url
Step 6: Render the report
步骤6:生成报告
Format the output per Report Template below. Surface the mandatory Risk Disclosure.
NEVER run before receiving explicit user confirmation in Step 4.
gate-dex swap按照以下报告模板格式化输出。需显示强制风险披露内容。
绝对禁止在步骤4收到用户明确确认前运行。
gate-dex swapJudgment Logic Summary
判断逻辑总结
| User Intent | Trigger Phrases | Action |
|---|---|---|
| Same-chain swap | "swap", "exchange", "convert", "buy", "sell" + same chain | quote → confirm → swap (Steps 3–5) |
| Cross-chain bridge | "bridge", "cross-chain", different from-chain / to-chain | bridge-tokens → quote (with |
| Quote only | "how much would I get", "estimate", "preview" with no execution intent | Step 3 only; do not execute |
| Resolve token address | "what's the address", "find token X" | |
| List swappable tokens | "what tokens can I swap" | |
| List bridge pairs | "what cross-chain pairs are supported" | |
| Order history | "my swap history", "past trades" | |
| Order detail | "details of order X", bridge settlement check | |
| Authentication failure | | Route to |
| 用户意图 | 触发短语 | 操作 |
|---|---|---|
| 同链兑换 | "swap"、"exchange"、"convert"、"buy"、"sell" + 同链 | 报价→确认→兑换(步骤3–5) |
| 跨链桥接 | "bridge"、"cross-chain"、源链/目标链不同 | 查询桥接代币→报价(带 |
| 仅获取报价 | "我能得到多少"、"预估"、"预览"且无执行意向 | 仅执行步骤3;不进行兑换 |
| 解析代币地址 | "地址是什么"、"找到代币X" | |
| 查询可兑换代币 | "我可以兑换哪些代币" | |
| 查询跨链桥接对 | "支持哪些跨链交易对" | |
| 订单历史 | "我的兑换历史"、"过往交易" | |
| 订单详情 | "订单X的详情"、桥接到账查询 | |
| 认证失败 | 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 call:
swap========== 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 (preview only):
quote========== Swap Quote (Preview) ==========
{Same fields as Swap Confirmation Template}
==========================================
No transaction has been signed or broadcast.For / : render a compact list/table of order id, chain pair, token pair, status, timestamp.
swap-historyswap-detail成功调用后:
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>跟踪。}
风险披露:数字资产交易存在重大风险,可能导致部分或全部投资损失。本内容仅供参考,不构成投资、财务、税务或法律建议。仅获取报价(预览)时:
========== 兑换报价(预览) ==========
{与兑换确认模板相同的字段}
==========================================
未签署或广播任何交易。对于 / :渲染订单ID、链对、代币对、状态、时间戳的紧凑列表/表格。
swap-historyswap-detailConversation Examples
对话示例
Example 1: Swap ETH → USDT on Ethereum
User: "Swap 0.01 ETH for USDT on Ethereum"
gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01- Show quote to user; wait for "confirm".
gate-dex swap --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01- Display tx hash + etherscan link + order ID.
Example 2: Swap SOL → USDC
User: "Swap 0.1 SOL for USDC"
gate-dex quote --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1- Show quote; user confirms.
gate-dex swap --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1- Display tx hash + solscan link.
Example 3: Unknown token symbol
User: "Swap 10 USDT for ARB on Arbitrum"
- → get ARB contract address.
gate-dex swap-tokens --chain arb --search ARB - 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"
- → confirm the token pair is supported.
gate-dex bridge-tokens --src-chain eth --dest-chain arb gate-dex quote --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress- Show quote to user; wait for "confirm".
gate-dex swap --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress- 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"
gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01- 向用户展示报价;等待用户回复"confirm"。
gate-dex swap --from-chain 1 --to-chain 1 --from - --to 0xdAC17... --amount 0.01- 显示交易哈希 + etherscan链接 + 订单ID。
示例2:将SOL兑换为USDC
用户: "将0.1 SOL兑换为USDC"
gate-dex quote --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1- 展示报价;用户确认。
gate-dex swap --from-chain 501 --to-chain 501 --from - --to EPjFWdd5... --amount 0.1- 显示交易哈希 + solscan链接。
示例3:未知代币符号
用户: "在Arbitrum上将10 USDT兑换为ARB"
- → 获取ARB合约地址。
gate-dex swap-tokens --chain arb --search ARB - 使用解析后的地址进行报价和兑换。
示例4:跨链桥接以太坊ETH至Arbitrum USDT
用户: "将0.1 ETH从以太坊桥接至Arbitrum的USDT"
- → 确认代币对支持桥接。
gate-dex bridge-tokens --src-chain eth --dest-chain arb gate-dex quote --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress- 向用户展示报价;等待用户回复"confirm"。
gate-dex swap --from-chain 1 --to-chain 42161 --from - --to 0xFd086bC7... --amount 0.1 --to-wallet 0xYourAddress- 显示源链交易哈希;提示目标链到账为异步过程 — 用户可通过跟踪。
gate-dex swap-detail <order_id>
Error Handling
错误处理
| Error | Handling |
|---|---|
| Run |
| Insufficient balance | Abort; show shortfall |
| Quote expired | CLI re-quotes automatically before signing |
| Slippage too low | Suggest higher slippage (0.05 for volatile tokens) |
| GV checkin failed (built-in) | CLI displays error; suggest retry |
| Broadcast failed | Display error code; do not auto-retry |
| User cancels | Abort immediately |
| 错误 | 处理方式 |
|---|---|
| 运行 |
| 余额不足 | 终止操作;显示差额 |
| 报价过期 | CLI会在签名前自动重新获取报价 |
| 滑点设置过低 | 建议提高滑点(波动代币建议0.05) |
| GV核验失败(内置) | CLI显示错误;建议重试 |
| 广播失败 | 显示错误代码;不自动重试 |
| 用户取消 | 立即终止操作 |
Security Rules
安全规则
- Confirm before swap: Always get explicit user confirmation before running . Without explicit user confirmation in chat, no
gate-dex swapcommand may be executed — onlyswapand other read-only commands are allowed.quote - Show quote first: Always run first so the user can see estimated output.
quote - No tx-checkin binary: CLI handles GV checkin internally — do not run any external binary.
- Audit unfamiliar tokens: Recommend before swapping unknown tokens.
gate-dex token-risk - 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.
- 兑换前确认:运行前必须获取用户明确确认。未收到聊天中用户的明确确认,不得执行任何
gate-dex swap命令 — 仅允许执行swap及其他只读命令。quote - 先展示报价:必须先运行让用户查看预估输出。
quote - 无tx-checkin二进制文件:CLI已内置GV核验功能 — 不得运行任何外部二进制文件。
- 审核陌生代币:建议在兑换未知代币前运行。
gate-dex token-risk - 交易不可逆:链上兑换和桥接通常不可逆。执行前必须与用户再次核实链、代币地址、数量及(桥接场景)目标钱包。
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周岁且具备完全民事行为能力的用户;可用性可能因司法管辖区而异。