gate-dex-mcpdapp

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gate Wallet DApp Skill

Gate Wallet DApp 技能

DApp interaction domain — Connect wallet, sign messages, execute DApp transactions, ERC20 Approve authorization, with mandatory confirmation gating and contract security review. 4 MCP tools + cross-Skill invocation.
Trigger scenarios: User mentions "connect DApp", "sign message", "sign message", "authorize", "approve", "DApp interaction", "NFT mint", "DeFi operation", "add liquidity", "stake", "stake", "claim", "contract call", or when other Skills guide the user to perform DApp-related operations.
DApp交互领域 — 支持钱包连接、消息签名、执行DApp交易、ERC20 Approve授权,包含强制确认校验和合约安全审核。涉及4个MCP工具+跨Skill调用。
触发场景:用户提及“连接DApp”、“签名消息”、“授权”、“批准”、“DApp交互”、“NFT铸造”、“DeFi操作”、“添加流动性”、“质押”、“领取奖励”、“合约调用”,或其他Skill引导用户执行DApp相关操作时。

Step 0: MCP Server Connection Check (Mandatory)

步骤0:MCP服务器连接检查(强制要求)

Before executing any operation, Gate Wallet MCP Server availability must be confirmed. This step cannot be skipped.
Probe invocation:
CallMcpTool(server="gate-wallet", toolName="chain.config", arguments={chain: "eth"})
ResultHandling
SuccessMCP Server available, proceed with subsequent steps
server not found
/
unknown server
Cursor not configured → Show configuration guide (see below)
connection refused
/
timeout
Remote unreachable → Prompt to check URL and network
401
/
unauthorized
API Key authentication failed → Prompt to check auth configuration
在执行任何操作前,必须确认Gate Wallet MCP服务器的可用性。此步骤不可跳过。
探测调用:
CallMcpTool(server="gate-wallet", toolName="chain.config", arguments={chain: "eth"})
结果处理方式
成功MCP服务器可用,继续后续步骤
server not found
/
unknown server
未配置Cursor → 显示配置指南(见下文)
connection refused
/
timeout
远程服务不可达 → 提示检查URL和网络
401
/
unauthorized
API Key认证失败 → 提示检查认证配置

Display when Cursor is not configured

当未配置Cursor时的显示内容

❌ Gate Wallet MCP Server not configured

The MCP Server named "gate-wallet" was not found in Cursor. Please configure it as follows:

Method 1: Configure via Cursor Settings (recommended)
  1. Open Cursor → Settings → MCP
  2. Click "Add new MCP server"
  3. Fill in:
     - Name: gate-wallet
     - Type: HTTP
     - URL: https://your-mcp-server-domain/mcp
  4. Save and retry

Method 2: Edit configuration file manually
  Edit ~/.cursor/mcp.json and add:
  {
    "mcpServers": {
      "gate-wallet": {
        "url": "https://your-mcp-server-domain/mcp"
      }
    }
  }

If you do not have an MCP Server URL yet, please contact your administrator.
❌ Gate Wallet MCP服务器未配置

在Cursor中未找到名为“gate-wallet”的MCP服务器,请按以下步骤配置:

方法1:通过Cursor设置配置(推荐)
  1. 打开Cursor → 设置 → MCP
  2. 点击“添加新MCP服务器”
  3. 填写:
     - 名称:gate-wallet
     - 类型:HTTP
     - URL:https://your-mcp-server-domain/mcp
  4. 保存后重试

方法2:手动编辑配置文件
  编辑~/.cursor/mcp.json并添加:
  {
    "mcpServers": {
      "gate-wallet": {
        "url": "https://your-mcp-server-domain/mcp"
      }
    }
  }

如果您还没有MCP服务器URL,请联系管理员获取。

Display when remote service is unreachable

当远程服务不可达时的显示内容

⚠️  Gate Wallet MCP Server connection failed

MCP Server configuration was found, but the remote service could not be reached. Please check:
1. Confirm the service URL is correct (is the configured URL accessible)
2. Check network connection (VPN / firewall may affect connectivity)
3. Confirm the remote service is running normally
⚠️ Gate Wallet MCP服务器连接失败

已找到MCP服务器配置,但无法连接到远程服务,请检查:
1. 确认服务URL正确(配置的URL是否可访问)
2. 检查网络连接(VPN/防火墙可能影响连通性)
3. 确认远程服务正常运行

Display when API Key authentication fails

当API Key认证失败时的显示内容

🔑 Gate Wallet MCP Server authentication failed

MCP Server connected but API Key validation failed. This service has AK/SK authentication enabled (x-api-key header).
Please contact your administrator for a valid API Key and confirm the server configuration is correct.
🔑 Gate Wallet MCP服务器认证失败

已连接到MCP服务器,但API Key验证失败。此服务已启用AK/SK认证(x-api-key请求头)。
请联系管理员获取有效的API Key,并确认服务器配置正确。

Authentication

认证机制

All operations in this Skill require
mcp_token
. User must be logged in before calling any tool.
  • If no
    mcp_token
    is present → Guide user to
    gate-dex-mcpauth
    to complete login, then return.
  • If
    mcp_token
    has expired (MCP Server returns token expired error) → First try
    auth.refresh_token
    for silent refresh, if that fails then guide user to re-login.
本Skill中的所有操作均需要
mcp_token
。在调用任何工具前,用户必须已登录。
  • 若不存在
    mcp_token
    → 引导用户前往
    gate-dex-mcpauth
    完成登录,然后返回继续操作。
  • mcp_token
    已过期(MCP服务器返回token过期错误) → 首先尝试调用
    auth.refresh_token
    进行静默刷新,若失败则引导用户重新登录。

DApp Interaction Scenarios Overview

DApp交互场景概述

ScenarioDescriptionCore MCP Tools
Wallet connectionDApp requests wallet address
wallet.get_addresses
Message signingDApp login verification / EIP-712 typed data signing
wallet.sign_message
DApp transaction executionExecute on-chain transactions generated by DApp (mint, stake, claim...)
wallet.sign_transaction
tx.send_raw_transaction
ERC20 ApproveAuthorize DApp contract to use specified token
wallet.sign_transaction
tx.send_raw_transaction
场景描述核心MCP工具
钱包连接DApp请求钱包地址
wallet.get_addresses
消息签名DApp登录验证 / EIP-712结构化数据签名
wallet.sign_message
DApp交易执行执行DApp生成的链上交易(铸造、质押、领取奖励等)
wallet.sign_transaction
tx.send_raw_transaction
ERC20 Approve授权DApp合约使用指定代币
wallet.sign_transaction
tx.send_raw_transaction

MCP Tool Invocation Specification

MCP工具调用规范

1.
wallet.get_addresses
(Cross-Skill) — Get wallet addresses

1.
wallet.get_addresses
(跨Skill)—— 获取钱包地址

Get wallet addresses for the account on each chain, for DApp connection. This tool belongs to the
gate-dex-mcpwallet
domain and is invoked cross-Skill here.
FieldDescription
Tool name
wallet.get_addresses
Parameters
{ account_id: string, mcp_token: string }
Return value
{ addresses: { [chain: string]: string } }
Invocation example:
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.get_addresses",
  arguments={ account_id: "acc_12345", mcp_token: "<mcp_token>" }
)
Return example:
json
{
  "addresses": {
    "eth": "0xABCdef1234567890ABCdef1234567890ABCdef12",
    "bsc": "0xABCdef1234567890ABCdef1234567890ABCdef12",
    "sol": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
  }
}
Agent behavior: EVM chains share the same address. Provide the target chain address to the DApp to complete wallet connection.

获取账户在各链上的钱包地址,用于DApp连接。该工具属于
gate-dex-mcpwallet
领域,在此处进行跨Skill调用。
字段描述
工具名称
wallet.get_addresses
参数
{ account_id: string, mcp_token: string }
返回值
{ addresses: { [chain: string]: string } }
调用示例:
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.get_addresses",
  arguments={ account_id: "acc_12345", mcp_token: "<mcp_token>" }
)
返回示例:
json
{
  "addresses": {
    "eth": "0xABCdef1234567890ABCdef1234567890ABCdef12",
    "bsc": "0xABCdef1234567890ABCdef1234567890ABCdef12",
    "sol": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
  }
}
Agent行为:EVM链共享同一地址。将目标链地址提供给DApp以完成钱包连接。

2.
wallet.sign_message
— Sign message

2.
wallet.sign_message
—— 消息签名

Sign arbitrary messages using server-hosted private key. Supports personal_sign and EIP-712 typed data signing.
FieldDescription
Tool name
wallet.sign_message
Parameters
{ message: string, chain: string, account_id: string, mcp_token: string }
Return value
{ signature: string }
Parameter description:
ParameterRequiredDescription
message
YesMessage to sign. For personal_sign pass raw text, for EIP-712 pass JSON string
chain
YesChain identifier (e.g.
"eth"
,
"bsc"
)
account_id
YesUser account ID
mcp_token
YesAuthentication token
Invocation example (personal_sign):
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.sign_message",
  arguments={
    message: "Welcome to Uniswap! Sign this message to verify your wallet. Nonce: abc123",
    chain: "eth",
    account_id: "acc_12345",
    mcp_token: "<mcp_token>"
  }
)
Invocation example (EIP-712):
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.sign_message",
  arguments={
    message: "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"}],\"Permit\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}]},\"primaryType\":\"Permit\",\"domain\":{\"name\":\"USDC\"},\"message\":{\"owner\":\"0xABC...\",\"spender\":\"0xDEF...\",\"value\":\"1000000000\"}}",
    chain: "eth",
    account_id: "acc_12345",
    mcp_token: "<mcp_token>"
  }
)
Return example:
json
{
  "signature": "0x1234abcd...ef5678"
}
Agent behavior: Before signing, show the user the message content and explain the purpose. After signing, return the signature to the user.

使用服务器托管的私钥对任意消息进行签名。支持personal_sign和EIP-712结构化数据签名。
字段描述
工具名称
wallet.sign_message
参数
{ message: string, chain: string, account_id: string, mcp_token: string }
返回值
{ signature: string }
参数说明:
参数是否必填描述
message
待签名的消息。personal_sign传入原始文本,EIP-712传入JSON字符串
chain
链标识符(例如
"eth"
,
"bsc"
account_id
用户账户ID
mcp_token
认证令牌
调用示例(personal_sign):
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.sign_message",
  arguments={
    message: "Welcome to Uniswap! Sign this message to verify your wallet. Nonce: abc123",
    chain: "eth",
    account_id: "acc_12345",
    mcp_token: "<mcp_token>"
  }
)
调用示例(EIP-712):
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.sign_message",
  arguments={
    message: "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"}],\"Permit\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"spender\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}]},\"primaryType\":\"Permit\",\"domain\":{\"name\":\"USDC\"},\"message\":{\"owner\":\"0xABC...\",\"spender\":\"0xDEF...\",\"value\":\"1000000000\"}}",
    chain: "eth",
    account_id: "acc_12345",
    mcp_token: "<mcp_token>"
  }
)
返回示例:
json
{
  "signature": "0x1234abcd...ef5678"
}
Agent行为:签名前,向用户展示消息内容并说明签名用途。签名完成后,将签名结果返回给用户。

3.
wallet.sign_transaction
— Sign DApp transaction

3.
wallet.sign_transaction
—— 签名DApp交易

Sign unsigned transactions built by DApp using server-hosted private key. Only invoke after user explicitly confirms.
FieldDescription
Tool name
wallet.sign_transaction
Parameters
{ raw_tx: string, chain: string, account_id: string, mcp_token: string }
Return value
{ signed_tx: string }
Parameter description:
ParameterRequiredDescription
raw_tx
YesSerialized unsigned transaction data (hex format)
chain
YesChain identifier
account_id
YesUser account ID
mcp_token
YesAuthentication token
Invocation example:
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.sign_transaction",
  arguments={
    raw_tx: "0x02f8...",
    chain: "eth",
    account_id: "acc_12345",
    mcp_token: "<mcp_token>"
  }
)
Return example:
json
{
  "signed_tx": "0x02f8b2...signed..."
}

使用服务器托管的私钥对DApp构建的未签名交易进行签名。仅在用户明确确认后调用。
字段描述
工具名称
wallet.sign_transaction
参数
{ raw_tx: string, chain: string, account_id: string, mcp_token: string }
返回值
{ signed_tx: string }
参数说明:
参数是否必填描述
raw_tx
序列化的未签名交易数据(十六进制格式)
chain
链标识符
account_id
用户账户ID
mcp_token
认证令牌
调用示例:
CallMcpTool(
  server="gate-wallet",
  toolName="wallet.sign_transaction",
  arguments={
    raw_tx: "0x02f8...",
    chain: "eth",
    account_id: "acc_12345",
    mcp_token: "<mcp_token>"
  }
)
返回示例:
json
{
  "signed_tx": "0x02f8b2...signed..."
}

4.
tx.send_raw_transaction
— Broadcast signed transaction

4.
tx.send_raw_transaction
—— 广播已签名交易

Broadcast the signed DApp transaction to the on-chain network.
FieldDescription
Tool name
tx.send_raw_transaction
Parameters
{ signed_tx: string, chain: string, mcp_token: string }
Return value
{ hash_id: string }
Parameter description:
ParameterRequiredDescription
signed_tx
YesSigned transaction returned by
wallet.sign_transaction
chain
YesChain identifier
mcp_token
YesAuthentication token
Invocation example:
CallMcpTool(
  server="gate-wallet",
  toolName="tx.send_raw_transaction",
  arguments={
    signed_tx: "0x02f8b2...signed...",
    chain: "eth",
    mcp_token: "<mcp_token>"
  }
)
Return example:
json
{
  "hash_id": "0xa1b2c3d4e5f6...7890"
}
将已签名的DApp交易广播至链上网络。
字段描述
工具名称
tx.send_raw_transaction
参数
{ signed_tx: string, chain: string, mcp_token: string }
返回值
{ hash_id: string }
参数说明:
参数是否必填描述
signed_tx
wallet.sign_transaction
返回的已签名交易
chain
链标识符
mcp_token
认证令牌
调用示例:
CallMcpTool(
  server="gate-wallet",
  toolName="tx.send_raw_transaction",
  arguments={
    signed_tx: "0x02f8b2...signed...",
    chain: "eth",
    mcp_token: "<mcp_token>"
  }
)
返回示例:
json
{
  "hash_id": "0xa1b2c3d4e5f6...7890"
}

Supported DApp Interaction Types

支持的DApp交互类型

TypeExample scenarioDescription
DeFi liquidityUniswap add/remove liquidityBuild Router contract addLiquidity / removeLiquidity call
DeFi lendingAave deposit/borrow/repayBuild Pool contract supply / borrow / repay call
DeFi StakingLido stake ETHBuild stETH contract submit call
NFT MintCustom NFT mintingBuild mint contract call
NFT tradingBuy/sell NFTBuild Marketplace contract call
Token ApproveAuthorize any contract to use tokenBuild ERC20 approve(spender, amount) calldata
Arbitrary contract callUser provides ABI + parametersAgent encodes calldata and builds transaction
Message signingDApp login verification
wallet.sign_message
, no on-chain transaction needed
类型示例场景描述
DeFi流动性操作Uniswap添加/移除流动性构建Router合约的addLiquidity / removeLiquidity调用
DeFi借贷操作Aave存款/借款/还款构建Pool合约的supply / borrow / repay调用
DeFi质押操作Lido质押ETH构建stETH合约的submit调用
NFT铸造自定义NFT铸造构建mint合约调用
NFT交易购买/出售NFT构建Marketplace合约调用
代币授权授权任意合约使用代币构建ERC20 approve(spender, amount)调用数据
任意合约调用用户提供ABI + 参数Agent编码调用数据并构建交易
消息签名DApp登录验证
wallet.sign_message
,无需链上交易

Supported Chains

支持的链

Chain IDNetwork nameTypeNative Gas tokenBlock explorer
eth
EthereumEVMETHetherscan.io
bsc
BNB Smart ChainEVMBNBbscscan.com
polygon
PolygonEVMMATICpolygonscan.com
arbitrum
Arbitrum OneEVMETHarbiscan.io
optimism
OptimismEVMETHoptimistic.etherscan.io
avax
Avalanche C-ChainEVMAVAXsnowtrace.io
base
BaseEVMETHbasescan.org
sol
SolanaNon-EVMSOLsolscan.io
链ID网络名称类型原生Gas代币区块浏览器
eth
EthereumEVMETHetherscan.io
bsc
BNB Smart ChainEVMBNBbscscan.com
polygon
PolygonEVMMATICpolygonscan.com
arbitrum
Arbitrum OneEVMETHarbiscan.io
optimism
OptimismEVMETHoptimistic.etherscan.io
avax
Avalanche C-ChainEVMAVAXsnowtrace.io
base
BaseEVMETHbasescan.org
sol
Solana非EVMSOLsolscan.io

Skill Routing

Skill路由

Based on user intent after DApp operation, route to the corresponding Skill:
User intentRoute target
View updated balance
gate-dex-mcpwallet
View transaction details / history
gate-dex-mcpwallet
(
tx.detail
,
tx.list
)
View contract security info
gate-dex-mcpmarket
(
token_get_risk_info
)
Transfer tokens
gate-dex-mcptransfer
Swap tokens
gate-dex-mcpswap
Login / authentication expired
gate-dex-mcpauth
根据用户在DApp操作后的意图,路由至对应的Skill:
用户意图路由目标
查看更新后的余额
gate-dex-mcpwallet
查看交易详情/历史
gate-dex-mcpwallet
tx.detail
,
tx.list
查看合约安全信息
gate-dex-mcpmarket
token_get_risk_info
转账代币
gate-dex-mcptransfer
兑换代币
gate-dex-mcpswap
登录/认证过期
gate-dex-mcpauth

Operation Flows

操作流程

Flow A: DApp wallet connection

流程A:DApp钱包连接

Step 0: MCP Server connection check
  Call chain.config({chain: "eth"}) to probe availability
  ↓ Success

Step 1: Authentication check
  Confirm valid mcp_token and account_id
  No token → Guide to gate-dex-mcpauth for login

Step 2: Get wallet address
  Call wallet.get_addresses({ account_id, mcp_token })
  Extract target chain address

Step 3: Display address

  ────────────────────────────
  🔗 Wallet Connection Info

  Chain: {chain_name}
  Address: {address}

  Use this address for DApp connection.
  EVM chains (Ethereum/BSC/Polygon etc.) share the same address.
  ────────────────────────────
步骤0:MCP服务器连接检查
  调用chain.config({chain: "eth"})探测可用性
  ↓ 成功

步骤1:认证检查
  确认存在有效的mcp_token和account_id
  无token → 引导至gate-dex-mcpauth登录

步骤2:获取钱包地址
  调用wallet.get_addresses({ account_id, mcp_token })
  提取目标链地址

步骤3:显示地址

  ────────────────────────────
  🔗 钱包连接信息

  链:{chain_name}
  地址:{address}

  使用此地址进行DApp连接。
  EVM链(Ethereum/BSC/Polygon等)共享同一地址。
  ────────────────────────────

Flow B: Message signing

流程B:消息签名

Step 0: MCP Server connection check
  ↓ Success

Step 1: Authentication check

Step 2: Intent recognition + parameter collection
  Extract signing request from user input:
  - message: Content to sign (required)
  - chain: Target chain (optional, default eth)
  - Signing type: personal_sign or EIP-712 (auto-detect from message format)

Step 3: Display signing content for confirmation

  ────────────────────────────
  ✍️ Message Signing Request

  Chain: {chain_name}
  Signing type: {personal_sign / EIP-712}
  Content to sign:
  {message_content}

  This signature does not create an on-chain transaction and does not consume Gas.
  Reply "confirm" to sign, "cancel" to abort.
  ────────────────────────────

  ↓ User confirms

Step 4: Execute signing
  Call wallet.sign_message({ message, chain, account_id, mcp_token })

Step 5: Display signing result

  ────────────────────────────
  ✅ Signing complete

  Signature: {signature}

  Submit this signature to the DApp to complete verification.
  ────────────────────────────
步骤0:MCP服务器连接检查
  ↓ 成功

步骤1:认证检查

步骤2:意图识别 + 参数收集
  从用户输入中提取签名请求:
  - message:待签名内容(必填)
  - chain:目标链(可选,默认eth)
  - 签名类型:personal_sign或EIP-712(从消息格式自动检测)

步骤3:显示待签名内容供用户确认

  ────────────────────────────
  ✍️ 消息签名请求

  链:{chain_name}
  签名类型:{personal_sign / EIP-712}
  待签名内容:
  {message_content}

  此签名不会产生链上交易,也不会消耗Gas。
  回复“confirm”进行签名,“cancel”取消操作。
  ────────────────────────────

  ↓ 用户确认

步骤4:执行签名
  调用wallet.sign_message({ message, chain, account_id, mcp_token })

步骤5:显示签名结果

  ────────────────────────────
  ✅ 签名完成

  签名:{signature}

  将此签名提交至DApp以完成验证。
  ────────────────────────────

Flow C: DApp transaction execution (main flow)

流程C:DApp交易执行(主流程)

Step 0: MCP Server connection check
  Call chain.config({chain: "eth"}) to probe availability
  ↓ Success

Step 1: Authentication check
  Confirm valid mcp_token and account_id
  No token → Guide to gate-dex-mcpauth for login

Step 2: Intent recognition + parameter collection
  Extract DApp operation intent from user input:
  - Operation type (e.g. "add liquidity", "stake ETH", "mint NFT")
  - Target protocol/contract (e.g. Uniswap, Aave, Lido)
  - Amount and tokens
  - Chain (optional, can infer from context)

  For missing parameters, ask user one by one:

  ────────────────────────────
  Please provide DApp interaction info:
  - Operation: (required, e.g. "add ETH-USDC liquidity on Uniswap")
  - Chain: (optional, default Ethereum)
  - Amount: (may need multiple amounts depending on operation type)
  ────────────────────────────

  ↓ Parameters complete

Step 3: Get wallet info (cross-Skill: gate-dex-mcpwallet)
  Call wallet.get_addresses({ account_id, mcp_token }) → Get from_address
  Call wallet.get_token_list({ account_id, chain, mcp_token }) → Get balance

Step 4: Security review (recommended step)
  Call token_get_risk_info({ chain, address: contract_address }) (cross-Skill: gate-dex-mcpmarket)
  Evaluate contract risk level

Step 5: Agent builds transaction
  Based on DApp operation type, Agent encodes contract call calldata:
  a) Known protocol (Uniswap/Aave/Lido etc.): Encode per protocol ABI
  b) User provides ABI + parameters: Agent parses and encodes
  c) User provides complete calldata: Use directly

  Build transaction parameters:
  - to: Contract address
  - data: calldata
  - value: Amount of native token to send (if any)

Step 6: Determine if Approve is needed
  If operation involves ERC20 token (non-native token):
  - Check if current allowance is sufficient
  - Insufficient → Execute Approve transaction first (see Flow D)

Step 7: Agent balance validation (mandatory)
  Validation rules:
  a) Operation involves native token: native_balance >= amount + estimated_gas
  b) Operation involves ERC20 token: token_balance >= amount AND native_balance >= estimated_gas
  c) Gas only: native_balance >= estimated_gas

  Validation failed → Abort transaction:

  ────────────────────────────
  ❌ Insufficient balance, cannot execute DApp operation

  Required {symbol}: {required_amount}
  Current balance: {current_balance}
  Shortfall: {shortfall}

  Suggestions:
  - Reduce operation amount
  - Deposit tokens to wallet first
  ────────────────────────────

  ↓ Validation passed

Step 8: Display DApp transaction confirmation summary (mandatory gate)
  Display content see "DApp Transaction Confirmation Template" below.
  Must wait for user to explicitly reply "confirm" before proceeding.

  User replies "confirm" → Proceed to Step 9
  User replies "cancel" → Abort transaction
  User requests modification → Return to Step 2

Step 9: Sign transaction
  Call wallet.sign_transaction({ raw_tx, chain, account_id, mcp_token })
  Get signed_tx

Step 10: Broadcast transaction
  Call tx.send_raw_transaction({ signed_tx, chain, mcp_token })
  Get hash_id

Step 11: Display result + follow-up suggestions

  ────────────────────────────
  ✅ DApp transaction broadcast successful!

  Operation: {operation_description}
  Transaction Hash: {hash_id}
  Block explorer: https://{explorer}/tx/{hash_id}

  Transaction submitted to network. Confirmation time depends on network congestion.

  You can:
  - View updated balance
  - View transaction details
  - Continue with other operations
  ────────────────────────────
步骤0:MCP服务器连接检查
  调用chain.config({chain: "eth"})探测可用性
  ↓ 成功

步骤1:认证检查
  确认存在有效的mcp_token和account_id
  无token → 引导至gate-dex-mcpauth登录

步骤2:意图识别 + 参数收集
  从用户输入中提取DApp操作意图:
  - 操作类型(例如“添加流动性”、“质押ETH”、“铸造NFT”)
  - 目标协议/合约(例如Uniswap、Aave、Lido)
  - 数量和代币
  - 链(可选,可从上下文推断)

  对于缺失的参数,逐一询问用户:

  ────────────────────────────
  请提供DApp交互信息:
  - 操作:(必填,例如“在Uniswap上添加ETH-USDC流动性”)
  - 链:(可选,默认Ethereum)
  - 数量:(根据操作类型可能需要多个数量)
  ────────────────────────────

  ↓ 参数齐全

步骤3:获取钱包信息(跨Skill:gate-dex-mcpwallet)
  调用wallet.get_addresses({ account_id, mcp_token }) → 获取from_address
  调用wallet.get_token_list({ account_id, chain, mcp_token }) → 获取余额

步骤4:安全审核(推荐步骤)
  调用token_get_risk_info({ chain, address: contract_address })(跨Skill:gate-dex-mcpmarket)
  评估合约风险等级

步骤5:Agent构建交易
  根据DApp操作类型,Agent编码合约调用数据:
  a) 已知协议(Uniswap/Aave/Lido等):按照协议ABI编码
  b) 用户提供ABI + 参数:Agent解析并编码
  c) 用户提供完整调用数据:直接使用

  构建交易参数:
  - to:合约地址
  - data:调用数据
  - value:需发送的原生代币数量(如有)

步骤6:判断是否需要Approve
  若操作涉及ERC20代币(非原生代币):
  - 检查当前授权额度是否足够
  - 额度不足 → 先执行Approve交易(见流程D)

步骤7:Agent余额校验(强制要求)
  校验规则:
  a) 操作涉及原生代币:native_balance >= 操作金额 + 预估Gas
  b) 操作涉及ERC20代币:token_balance >= 操作金额 且 native_balance >= 预估Gas
  c) 仅需Gas:native_balance >= 预估Gas

  校验失败 → 终止交易:

  ────────────────────────────
  ❌ 余额不足,无法执行DApp操作

  所需{symbol}:{required_amount}
  当前余额:{current_balance}
  差额:{shortfall}

  建议:
  - 减少操作金额
  - 先向钱包存入代币
  ────────────────────────────

  ↓ 校验通过

步骤8:显示DApp交易确认摘要(强制校验)
  显示内容见下文“DApp交易确认模板”。
  必须等待用户明确回复“confirm”后再继续。

  用户回复“confirm” → 进入步骤9
  用户回复“cancel” → 终止交易
  用户要求修改 → 返回步骤2

步骤9:签名交易
  调用wallet.sign_transaction({ raw_tx, chain, account_id, mcp_token })
  获取signed_tx

步骤10:广播交易
  调用tx.send_raw_transaction({ signed_tx, chain, mcp_token })
  获取hash_id

步骤11:显示结果 + 后续建议

  ────────────────────────────
  ✅ DApp交易广播成功!

  操作:{operation_description}
  交易哈希:{hash_id}
  区块浏览器:https://{explorer}/tx/{hash_id}

  交易已提交至网络,确认时间取决于网络拥堵情况。

  您可以:
  - 查看更新后的余额
  - 查看交易详情
  - 继续其他操作
  ────────────────────────────

Flow D: ERC20 Approve authorization

流程D:ERC20 Approve授权

Step 0: MCP Server connection check
  ↓ Success

Step 1: Authentication check

Step 2: Determine Approve parameters
  - token_address: Token contract address to authorize
  - spender: Spender contract address (e.g. Uniswap Router)
  - amount: Authorization amount

  Agent recommends exact amount over unlimited:

  ────────────────────────────
  💡 Authorization amount recommendation

  This operation requires authorizing {spender_name} to use your {token_symbol}.

  Recommended options:
  1. Exact authorization: {exact_amount} {token_symbol} (only for this operation, more secure)
  2. Unlimited authorization: unlimited (no need to re-authorize for future operations, but higher risk)

  Please choose authorization method, or specify custom amount.
  ────────────────────────────


Step 3: Build Approve calldata
  Encode ERC20 approve(spender, amount) function call:
  - function selector: 0x095ea7b3
  - spender: Contract address (32 bytes padded)
  - amount: Authorization amount (uint256)

Step 4: Display Approve confirmation

  ────────────────────────────
  ========== Token Authorization Confirmation ==========
  Chain: {chain_name}
  Token: {token_symbol} ({token_address})
  Authorize to: {spender_name} ({spender_address})
  Authorization amount: {amount} {token_symbol}
  Estimated Gas: {estimated_gas} {gas_symbol}
  ===============================
  Reply "confirm" to execute authorization, "cancel" to abort.
  ────────────────────────────

  ↓ User confirms

Step 5: Sign + broadcast Approve transaction
  Call wallet.sign_transaction({ raw_tx: approve_tx, chain, account_id, mcp_token })
  Call tx.send_raw_transaction({ signed_tx, chain, mcp_token })

Step 6: Approve success
  Display Approve transaction hash, continue with subsequent DApp operation (Flow C Step 9)
步骤0:MCP服务器连接检查
  ↓ 成功

步骤1:认证检查

步骤2:确定Approve参数
  - token_address:待授权的代币合约地址
  - spender:被授权方合约地址(例如Uniswap Router)
  - amount:授权金额

  Agent推荐精确授权而非无限授权:

  ────────────────────────────
  💡 授权金额建议

  此操作需要授权{spender_name}使用您的{token_symbol}。

  推荐选项:
  1. 精确授权:{exact_amount} {token_symbol}(仅用于本次操作,安全性更高)
  2. 无限授权:unlimited(未来操作无需重新授权,但风险更高)

  请选择授权方式,或指定自定义金额。
  ────────────────────────────


步骤3:构建Approve调用数据
  编码ERC20 approve(spender, amount)函数调用:
  - 函数选择器:0x095ea7b3
  - spender:合约地址(32字节填充)
  - amount:授权金额(uint256)

步骤4:显示Approve确认信息

  ────────────────────────────
  ========== 代币授权确认 ==========
  链:{chain_name}
  代币:{token_symbol} ({token_address})
  授权至:{spender_name} ({spender_address})
  授权金额:{amount} {token_symbol}
  预估Gas:{estimated_gas} {gas_symbol}
  ===============================
  回复“confirm”执行授权,“cancel”取消操作。
  ────────────────────────────

  ↓ 用户确认

步骤5:签名 + 广播Approve交易
  调用wallet.sign_transaction({ raw_tx: approve_tx, chain, account_id, mcp_token })
  调用tx.send_raw_transaction({ signed_tx, chain, mcp_token })

步骤6:Approve成功
  显示Approve交易哈希,继续后续DApp操作(流程C步骤9)

Flow E: Arbitrary contract call (user provides ABI)

流程E:任意合约调用(用户提供ABI)

Step 0: MCP Server connection check
  ↓ Success

Step 1: Authentication check

Step 2: Collect contract call info
  User provides:
  - Contract address
  - Function name or ABI
  - Function parameters
  - value (optional, needed when sending native token)
  - Chain

Step 3: Agent encodes calldata
  Encode function call data based on ABI and parameters

Step 4: Security review + balance validation + confirmation gate
  Same as Flow C Steps 4 ~ 8

Step 5: Sign + broadcast
  Same as Flow C Steps 9 ~ 11
步骤0:MCP服务器连接检查
  ↓ 成功

步骤1:认证检查

步骤2:收集合约调用信息
  用户提供:
  - 合约地址
  - 函数名称或ABI
  - 函数参数
  - value(可选,发送原生代币时需要)
  - 链

步骤3:Agent编码调用数据
  根据ABI和参数编码函数调用数据

步骤4:安全审核 + 余额校验 + 确认校验
  同流程C步骤4 ~ 8

步骤5:签名 + 广播
  同流程C步骤9 ~ 11

DApp Transaction Confirmation Template

DApp交易确认模板

This confirmation summary must be shown before the user explicitly replies "confirm". Agent must NOT execute signing before that. This is a mandatory gate that cannot be skipped.
在用户明确回复“confirm”前,必须显示此确认摘要。Agent不得在用户确认前执行签名。这是不可跳过的强制校验环节。

Standard DApp transaction confirmation

标准DApp交易确认

========== DApp Transaction Confirmation ==========
Chain: {chain_name}
DApp/Protocol: {protocol_name} (e.g. Uniswap V3)
Operation: {operation} (e.g. Add liquidity)
Contract address: {contract_address}
---------- Transaction Details ----------
{operation_specific_details}
(e.g. Token A: 0.5 ETH, Token B: 1000 USDC)
---------- Authorization Info ----------
{approve_info_if_needed}
(e.g. Approve required: USDC → Uniswap Router, amount: 1000 USDC)
(When no approval needed: No additional authorization required)
---------- Balance Info ----------
{token_symbol} balance: {balance} (sufficient ✅ / insufficient ❌)
{gas_symbol} balance (Gas): {gas_balance} (sufficient ✅)
---------- Fee Info ----------
Estimated Gas (Approve): {approve_gas} (if needed)
Estimated Gas (Transaction): {tx_gas} {gas_symbol}
---------- Security Check ----------
Contract security audit: {risk_level} (e.g. audited/low risk/high risk/unknown)
===============================
Reply "confirm" to execute, "cancel" to abort, or specify modifications.

Note: DApp interaction involves smart contract calls. Please confirm contract address and operation are correct.
========== DApp交易确认 ==========
链:{chain_name}
DApp/协议:{protocol_name}(例如Uniswap V3)
操作:{operation}(例如添加流动性)
合约地址:{contract_address}
---------- 交易详情 ----------
{operation_specific_details}
(例如代币A:0.5 ETH,代币B:1000 USDC)
---------- 授权信息 ----------
{approve_info_if_needed}
(例如需要授权:USDC → Uniswap Router,金额:1000 USDC)
(无需授权时显示:无额外授权需求)
---------- 余额信息 ----------
{token_symbol}余额:{balance}(充足✅ / 不足❌)
{gas_symbol}余额(Gas):{gas_balance}(充足✅)
---------- 手续费信息 ----------
预估Gas(Approve):{approve_gas}(如有需要)
预估Gas(交易):{tx_gas} {gas_symbol}
---------- 安全检查 ----------
合约安全审计:{risk_level}(例如已审计/低风险/高风险/未知)
===============================
回复“confirm”执行操作,“cancel”取消操作,或说明修改内容。

注意:DApp交互涉及智能合约调用,请确认合约地址和操作无误。

Unknown contract warning confirmation

未知合约警告确认

When target contract is unaudited or audit result is high risk:
========== ⚠️ DApp Transaction Confirmation (Security Warning) ==========
Chain: {chain_name}
Contract address: {contract_address}

⚠️ Security warning: This contract is unaudited or marked as high risk.
Interacting with unknown contracts may result in asset loss. Please confirm you trust this contract.

---------- Transaction Details ----------
{operation_details}
---------- Balance Info ----------
{balance_info}
---------- Fee Info ----------
{gas_info}
---------- Security Check ----------
Contract audit status: {risk_detail}
=================================================
Reply "confirm" to proceed anyway (at your own risk), "cancel" to abort.
当目标合约未经过审计或审计结果为高风险时:
========== ⚠️ DApp交易确认(安全警告) ==========
链:{chain_name}
合约地址:{contract_address}

⚠️ 安全警告:此合约未经过审计或被标记为高风险。
与未知合约交互可能导致资产损失,请确认您信任此合约。

---------- 交易详情 ----------
{operation_details}
---------- 余额信息 ----------
{balance_info}
---------- 手续费信息 ----------
{gas_info}
---------- 安全检查 ----------
合约审计状态:{risk_detail}
=================================================
回复“confirm”继续操作(风险自担),“cancel”取消操作。

Cross-Skill Workflow

跨Skill工作流

Complete DApp interaction flow (from login to completion)

完整DApp交互流程(从登录到完成)

gate-dex-mcpauth (login, get mcp_token + account_id)
  → gate-dex-mcpwallet (wallet.get_addresses → get address)
    → gate-dex-mcpwallet (wallet.get_token_list → validate balance)
      → gate-dex-mcpmarket (token_get_risk_info → contract security review)
        → gate-dex-mcpdapp (Approve? → confirm → sign → broadcast)
          → gate-dex-mcpwallet (view updated balance)
gate-dex-mcpauth(登录,获取mcp_token + account_id)
  → gate-dex-mcpwallet(wallet.get_addresses → 获取地址)
    → gate-dex-mcpwallet(wallet.get_token_list → 校验余额)
      → gate-dex-mcpmarket(token_get_risk_info → 合约安全审核)
        → gate-dex-mcpdapp(Approve?→ 确认 → 签名 → 广播)
          → gate-dex-mcpwallet(查看更新后的余额)

DApp message signing (no transaction)

DApp消息签名(无交易)

gate-dex-mcpauth (login)
  → gate-dex-mcpdapp (wallet.sign_message → return signature result)
gate-dex-mcpauth(登录)
  → gate-dex-mcpdapp(wallet.sign_message → 返回签名结果)

Guided by other Skills

由其他Skill引导

Source SkillScenarioDescription
gate-dex-mcpwallet
User wants to connect DApp after viewing addressCarries account_id and address info
gate-dex-mcpmarket
User wants to participate in DeFi after viewing tokenCarries token and chain context
gate-dex-mcpswap
User wants to participate in DeFi after SwapCarries chain and token context
来源Skill场景描述
gate-dex-mcpwallet
用户查看地址后想要连接DApp携带account_id和地址信息
gate-dex-mcpmarket
用户查看代币后想要参与DeFi携带代币和链上下文
gate-dex-mcpswap
用户兑换代币后想要参与DeFi携带链和代币上下文

Invoking other Skills

调用其他Skill

Target SkillInvocation scenarioTools used
gate-dex-mcpwallet
Get wallet address for DApp connection
wallet.get_addresses
gate-dex-mcpwallet
Validate balance before DApp transaction
wallet.get_token_list
gate-dex-mcpwallet
View updated balance after DApp transaction
wallet.get_token_list
gate-dex-mcpauth
Not logged in or token expired
auth.refresh_token
or full login flow
gate-dex-mcpmarket
Contract security review
token_get_risk_info
gate-dex-mcpwallet
View transaction details after DApp transaction
tx.detail
,
tx.list
目标Skill调用场景使用工具
gate-dex-mcpwallet
获取钱包地址用于DApp连接
wallet.get_addresses
gate-dex-mcpwallet
DApp交易前校验余额
wallet.get_token_list
gate-dex-mcpwallet
DApp交易后查看更新后的余额
wallet.get_token_list
gate-dex-mcpauth
未登录或token过期
auth.refresh_token
或完整登录流程
gate-dex-mcpmarket
合约安全审核
token_get_risk_info
gate-dex-mcpwallet
DApp交易后查看交易详情
tx.detail
,
tx.list

Contract Address Validation Rules

合约地址校验规则

Contract address validation for DApp transactions and Approve:
Chain typeFormat requirementValidation rule
EVM (eth/bsc/polygon/...)Starts with
0x
, 40 hex chars (42 chars total)
Regex
^0x[0-9a-fA-F]{40}$
, recommend EIP-55 checksum validation
SolanaBase58 encoded, 32-44 charsRegex
^[1-9A-HJ-NP-Za-km-z]{32,44}$
When validation fails:
❌ Invalid contract address format

Provided address: {user_input}
Expected format: {expected_format}

Please check the address is correct, complete, and matches the target chain.
DApp交易和Approve的合约地址校验:
链类型格式要求校验规则
EVM(eth/bsc/polygon/...)
0x
开头,40个十六进制字符(共42个字符)
正则
^0x[0-9a-fA-F]{40}$
,推荐使用EIP-55校验和验证
SolanaBase58编码,32-44个字符正则
^[1-9A-HJ-NP-Za-km-z]{32,44}$
校验失败时:
❌ 无效的合约地址格式

提供的地址:{user_input}
预期格式:{expected_format}

请检查地址是否正确、完整,且与目标链匹配。

ERC20 Approve Calldata Encoding Specification

ERC20 Approve调用数据编码规范

When building Approve transactions, Agent must encode calldata per the following rules:
Function signature: approve(address spender, uint256 amount)
Selector: 0x095ea7b3

Calldata structure:
0x095ea7b3
+ spender address (32 bytes, left-padded with zeros)
+ amount (32 bytes, uint256)

Example (approve Uniswap Router to use 1000 USDT, 6 decimals):
0x095ea7b3
000000000000000000000000 68b3465833fb72A70ecDF485E0e4C7bD8665Fc45  ← spender
00000000000000000000000000000000000000000000000000000000 3B9ACA00  ← 1000 * 10^6
Exact vs unlimited authorization:
Methodamount valueSecurityConvenience
Exact authorizationActual amount neededHigh (expires when used)Low (requires re-authorization each time)
Unlimited authorization
2^256 - 1
(
0xfff...fff
)
Low (contract can transfer tokens anytime)High (one-time authorization, permanent)
Recommend exact authorization unless user explicitly requests unlimited.
构建Approve交易时,Agent必须按照以下规则编码调用数据:
函数签名:approve(address spender, uint256 amount)
选择器:0x095ea7b3

调用数据结构:
0x095ea7b3
+ spender地址(32字节,左侧补零)
+ amount(32字节,uint256)

示例(授权Uniswap Router使用1000 USDT,6位小数):
0x095ea7b3
000000000000000000000000 68b3465833fb72A70ecDF485E0e4C7bD8665Fc45  ← 被授权方
00000000000000000000000000000000000000000000000000000000 3B9ACA00  ← 1000 * 10^6
精确授权 vs 无限授权:
方式amount值安全性便捷性
精确授权实际所需金额高(使用后失效)低(每次操作需重新授权)
无限授权
2^256 - 1
0xfff...fff
低(合约可随时转移代币)高(一次授权永久有效)
除非用户明确要求,否则推荐使用精确授权

EIP-712 Signature Data Parsing Specification

EIP-712签名数据解析规范

When displaying EIP-712 signing requests, Agent must parse JSON structured data into human-readable format:
显示EIP-712签名请求时,Agent必须将JSON结构化数据解析为人类可读格式:

Parsing points

解析要点

  1. Domain info: Extract
    name
    ,
    version
    ,
    chainId
    ,
    verifyingContract
    , display in table format
  2. Primary Type: Clearly label the primary type of signature data (e.g.
    Order
    ,
    Permit
    ,
    Vote
    )
  3. Message fields: Display each field; truncate
    address
    type for display; try to convert
    uint256
    to human-readable values
  4. Known type recognition:
    • Permit
      (EIP-2612) → Label "Token authorization permit", highlight spender and value
    • Order
      (DEX order) → Label "Trading order", highlight trading pair and amount
    • Vote
      (governance vote) → Label "Governance vote", highlight vote content
  1. 域信息:提取
    name
    version
    chainId
    verifyingContract
    ,以表格形式展示
  2. 主类型:明确标注签名数据的主类型(例如
    Order
    Permit
    Vote
  3. 消息字段:展示每个字段;地址类型字段可截断显示;尝试将
    uint256
    转换为人类可读数值
  4. 已知类型识别:
    • Permit
      (EIP-2612)→ 标注“代币授权许可”,突出显示被授权方和金额
    • Order
      (DEX订单)→ 标注“交易订单”,突出显示交易对和金额
    • Vote
      (治理投票)→ 标注“治理投票”,突出显示投票内容

Known EIP-712 signature types

已知EIP-712签名类型

primaryTypeCommon sourceRisk levelDescription
Permit
ERC-2612 tokenMediumOff-chain signature authorization, no Gas but grants spender token usage permission
Order
DEX (e.g. 0x, Seaport)MediumRepresents trading order, can be executed on-chain after signing
Vote
Governance protocol (e.g. Compound)LowGovernance vote
Delegation
Governance protocolLowVoting power delegation
Unknown typeAny DAppHighAdditional warning needed for user to carefully review content
primaryType常见来源风险等级描述
Permit
ERC-2612代币链下签名授权,无需Gas但授予被授权方代币使用权
Order
DEX(例如0x、Seaport)代表交易订单,签名后可在链上执行
Vote
治理协议(例如Compound)治理投票
Delegation
治理协议投票权委托
未知类型任意DApp需要额外警告用户仔细审核内容

Edge Cases and Error Handling

边缘情况与错误处理

ScenarioHandling
MCP Server not configuredAbort all operations, show Cursor configuration guide
MCP Server unreachableAbort all operations, show network check prompt
Not logged in (no
mcp_token
)
Guide to
gate-dex-mcpauth
to complete login, then automatically return to continue DApp operation
mcp_token
expired
First try
auth.refresh_token
for silent refresh, if fails then guide to re-login
Insufficient Gas token balanceAbort transaction/Approve, show insufficient Gas info, suggest deposit
Token for Approve not in holdingsPrompt user does not hold this token; Approve can execute but has no practical effect. Confirm whether to continue
Spender contract is high riskStrongly warn user, recommend cancel. If user insists, can still proceed (requires re-confirmation)
Spender contract is unknown (not indexed)Show "unknown contract" warning, prompt user to verify contract source
Invalid contract address formatReject transaction, prompt correct address format
wallet.sign_message
failed
Show signing error, possible causes: incorrect message format, account anomaly. Do not auto-retry
EIP-712 JSON parse failedShow raw JSON content, prompt format may be incorrect, ask user to confirm or re-fetch from DApp
wallet.sign_transaction
failed
Show signing error, possible causes: invalid transaction data, account permission issue. Do not auto-retry
tx.send_raw_transaction
failed
Show broadcast error (nonce conflict, insufficient gas, network congestion, etc.), suggest corresponding measures based on error type
User cancels confirmation (signing/transaction/Approve)Abort immediately, do not execute any signing or broadcast. Show cancellation prompt, remain friendly
tx.gas
estimation failed
Show error, possible causes: contract call will revert, incorrect parameters. Suggest checking transaction data
Approve amount is 0Treat as "revoke authorization" operation, confirm with user if they want to revoke authorization for this spender
User requests unlimited authorizationShow high-risk warning template, requires user secondary confirmation
Duplicate Approve for same spenderPrompt existing authorization, new Approve will overwrite old. Confirm whether to continue
Network disconnect after signing, before broadcastPrompt signed transaction can still be broadcast later, suggest retry after network recovery
DApp-provided raw_tx format abnormalReject signing, prompt transaction data format incorrect, suggest re-generate from DApp
Unsupported chain identifierShow supported chain list, ask user to re-select
Message signing request chain is SolanaPrompt Solana message signing not supported, EVM chains only
Network interruptionShow network error, suggest check network and retry
场景处理方式
MCP服务器未配置终止所有操作,显示Cursor配置指南
MCP服务器不可达终止所有操作,显示网络检查提示
未登录(无
mcp_token
引导至
gate-dex-mcpauth
完成登录,登录后自动返回继续DApp操作
mcp_token
过期
首先尝试
auth.refresh_token
静默刷新,若失败则引导重新登录
Gas代币余额不足终止交易/Approve,显示Gas不足信息,建议存入Gas代币
待授权代币不在持有列表中提示用户未持有该代币;Approve可执行但无实际效果,确认是否继续
被授权方合约为高风险强烈警告用户,建议取消操作。若用户坚持,可继续执行(需二次确认)
被授权方合约未知(未被索引)显示“未知合约”警告,提示用户验证合约来源
无效的合约地址格式拒绝交易,提示正确的地址格式
wallet.sign_message
失败
显示签名错误,可能原因:消息格式错误、账户异常。请勿自动重试
EIP-712 JSON解析失败显示原始JSON内容,提示格式可能错误,询问用户是否确认或从DApp重新获取
wallet.sign_transaction
失败
显示签名错误,可能原因:交易数据无效、账户权限问题。请勿自动重试
tx.send_raw_transaction
失败
显示广播错误(nonce冲突、Gas不足、网络拥堵等),根据错误类型给出对应建议
用户取消确认(签名/交易/Approve)立即终止操作,不执行任何签名或广播。显示取消提示,保持友好
tx.gas
预估失败
显示错误,可能原因:合约调用将回滚、参数错误。建议检查交易数据
Approve金额为0视为“撤销授权”操作,确认用户是否要撤销对该被授权方的授权
用户请求无限授权显示高风险警告模板,需要用户二次确认
同一被授权方重复Approve提示已有授权,新的Approve将覆盖旧授权,确认是否继续
签名后广播前网络断开提示已签名交易可在后续广播,建议网络恢复后重试
DApp提供的raw_tx格式异常拒绝签名,提示交易数据格式错误,建议从DApp重新生成
不支持的链标识符显示支持的链列表,询问用户重新选择
消息签名请求链为Solana提示不支持Solana消息签名,仅支持EVM链
网络中断显示网络错误,建议检查网络并重试

Security Rules

安全规则

  1. mcp_token
    confidentiality
    : Never display
    mcp_token
    in plain text to user; use placeholder
    <mcp_token>
    in invocation examples only.
  2. account_id
    masking
    : When displaying to user, only show partial characters (e.g.
    acc_12...89
    ).
  3. Token auto-refresh: When
    mcp_token
    expires, prefer silent refresh first; only require re-login if refresh fails.
  4. Confirmation required before signing: All signing operations (message signing, transaction signing, Approve) must display full content to user and obtain explicit "confirm" reply before execution. Cannot skip, simplify, or auto-confirm.
  5. Contract security review: When DApp interaction involves unknown contract, must call
    token_get_risk_info
    for security review and display result to user. High-risk contracts require additional prominent warning.
  6. Default exact authorization: ERC20 Approve defaults to exact authorization amount. Use unlimited only when user explicitly requests, and must display unlimited authorization risk warning.
  7. EIP-712 content transparency: EIP-712 signing requests must be fully parsed and displayed in human-readable format to user; cannot omit any key fields (especially
    verifyingContract
    ,
    spender
    , amount-type fields).
  8. Gas balance validation mandatory: Before DApp transaction and Approve, must validate Gas token balance; prohibit initiating signing and broadcast when balance is insufficient.
  9. No auto-retry on failed operations: After signing or broadcast fails, clearly show error to user; do not auto-retry in background.
  10. Prohibit operations when MCP Server not configured or unreachable: If Step 0 connection check fails, abort all subsequent steps.
  11. MCP Server error transparency: All MCP Server error messages displayed to user as-is; do not hide or alter.
  12. raw_tx
    must not be leaked
    : Unsigned transaction raw data flows only between Agent and MCP Server; do not display hex original to user.
  13. Broadcast promptly after signing: After successful signing, broadcast immediately; do not hold signed transaction for long.
  14. Permit signature risk warning: EIP-2612 Permit signature consumes no Gas but is equivalent to authorization; must remind user to note spender and authorization amount.
  15. Phishing prevention: Agent does not actively construct transactions or signing requests pointing to unknown contracts. All DApp interaction data should be provided by user or from trusted sources.
  1. mcp_token
    保密性
    :不得向用户明文显示
    mcp_token
    ;仅在调用示例中使用占位符
    <mcp_token>
  2. account_id
    脱敏
    :向用户显示时仅展示部分字符(例如
    acc_12...89
    )。
  3. Token自动刷新
    mcp_token
    过期时,优先尝试静默刷新;仅在刷新失败时要求用户重新登录。
  4. 签名前需确认:所有签名操作(消息签名、交易签名、Approve)必须向用户展示完整内容并获得明确的“confirm”回复后才能执行。不得跳过、简化或自动确认。
  5. 合约安全审核:DApp交互涉及未知合约时,必须调用
    token_get_risk_info
    进行安全审核并向用户展示结果。高风险合约需额外突出警告。
  6. 默认精确授权:ERC20 Approve默认使用精确授权金额。仅在用户明确要求时使用无限授权,且必须显示无限授权风险警告。
  7. EIP-712内容透明:EIP-712签名请求必须完全解析为人类可读格式展示给用户;不得省略任何关键字段(尤其是
    verifyingContract
    spender
    、金额类字段)。
  8. Gas余额强制校验:DApp交易和Approve前,必须校验Gas代币余额;禁止在余额不足时发起签名和广播。
  9. 失败操作不自动重试:签名或广播失败后,向用户明确显示错误;不得在后台自动重试。
  10. MCP服务器不可用时禁止操作:若步骤0连接检查失败,终止所有后续步骤。
  11. MCP服务器错误透明:向用户原样展示所有MCP服务器错误消息;不得隐藏或修改。
  12. raw_tx
    不得泄露
    :未签名交易原始数据仅在Agent和MCP服务器间传输;不得向用户显示十六进制原始内容。
  13. 签名后及时广播:签名成功后立即广播;不得长时间持有已签名交易。
  14. Permit签名风险警告:EIP-2612 Permit签名不消耗Gas但等同于授权;必须提醒用户注意被授权方和授权金额。
  15. 防钓鱼机制:Agent不得主动构建指向未知合约的交易或签名请求。所有DApp交互数据应由用户提供或来自可信来源。