gate-dex-mcpdapp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGate 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"})| Result | Handling |
|---|---|
| Success | MCP Server available, proceed with subsequent steps |
| Cursor not configured → Show configuration guide (see below) |
| Remote unreachable → Prompt to check URL and network |
| API Key authentication failed → Prompt to check auth configuration |
在执行任何操作前,必须确认Gate Wallet MCP服务器的可用性。此步骤不可跳过。
探测调用:
CallMcpTool(server="gate-wallet", toolName="chain.config", arguments={chain: "eth"})| 结果 | 处理方式 |
|---|---|
| 成功 | MCP服务器可用,继续后续步骤 |
| 未配置Cursor → 显示配置指南(见下文) |
| 远程服务不可达 → 提示检查URL和网络 |
| 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 . User must be logged in before calling any tool.
mcp_token- If no is present → Guide user to
mcp_tokento complete login, then return.gate-dex-mcpauth - If has expired (MCP Server returns token expired error) → First try
mcp_tokenfor silent refresh, if that fails then guide user to re-login.auth.refresh_token
本Skill中的所有操作均需要。在调用任何工具前,用户必须已登录。
mcp_token- 若不存在→ 引导用户前往
mcp_token完成登录,然后返回继续操作。gate-dex-mcpauth - 若已过期(MCP服务器返回token过期错误) → 首先尝试调用
mcp_token进行静默刷新,若失败则引导用户重新登录。auth.refresh_token
DApp Interaction Scenarios Overview
DApp交互场景概述
| Scenario | Description | Core MCP Tools |
|---|---|---|
| Wallet connection | DApp requests wallet address | |
| Message signing | DApp login verification / EIP-712 typed data signing | |
| DApp transaction execution | Execute on-chain transactions generated by DApp (mint, stake, claim...) | |
| ERC20 Approve | Authorize DApp contract to use specified token | |
| 场景 | 描述 | 核心MCP工具 |
|---|---|---|
| 钱包连接 | DApp请求钱包地址 | |
| 消息签名 | DApp登录验证 / EIP-712结构化数据签名 | |
| DApp交易执行 | 执行DApp生成的链上交易(铸造、质押、领取奖励等) | |
| ERC20 Approve | 授权DApp合约使用指定代币 | |
MCP Tool Invocation Specification
MCP工具调用规范
1. wallet.get_addresses
(Cross-Skill) — Get wallet addresses
wallet.get_addresses1. wallet.get_addresses
(跨Skill)—— 获取钱包地址
wallet.get_addressesGet wallet addresses for the account on each chain, for DApp connection. This tool belongs to the domain and is invoked cross-Skill here.
gate-dex-mcpwallet| Field | Description |
|---|---|
| Tool name | |
| Parameters | |
| Return value | |
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连接。该工具属于领域,在此处进行跨Skill调用。
gate-dex-mcpwallet| 字段 | 描述 |
|---|---|
| 工具名称 | |
| 参数 | |
| 返回值 | |
调用示例:
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
wallet.sign_message2. wallet.sign_message
—— 消息签名
wallet.sign_messageSign arbitrary messages using server-hosted private key. Supports personal_sign and EIP-712 typed data signing.
| Field | Description |
|---|---|
| Tool name | |
| Parameters | |
| Return value | |
Parameter description:
| Parameter | Required | Description |
|---|---|---|
| Yes | Message to sign. For personal_sign pass raw text, for EIP-712 pass JSON string |
| Yes | Chain identifier (e.g. |
| Yes | User account ID |
| Yes | Authentication 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结构化数据签名。
| 字段 | 描述 |
|---|---|
| 工具名称 | |
| 参数 | |
| 返回值 | |
参数说明:
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | 待签名的消息。personal_sign传入原始文本,EIP-712传入JSON字符串 |
| 是 | 链标识符(例如 |
| 是 | 用户账户ID |
| 是 | 认证令牌 |
调用示例(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
wallet.sign_transaction3. wallet.sign_transaction
—— 签名DApp交易
wallet.sign_transactionSign unsigned transactions built by DApp using server-hosted private key. Only invoke after user explicitly confirms.
| Field | Description |
|---|---|
| Tool name | |
| Parameters | |
| Return value | |
Parameter description:
| Parameter | Required | Description |
|---|---|---|
| Yes | Serialized unsigned transaction data (hex format) |
| Yes | Chain identifier |
| Yes | User account ID |
| Yes | Authentication 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构建的未签名交易进行签名。仅在用户明确确认后调用。
| 字段 | 描述 |
|---|---|
| 工具名称 | |
| 参数 | |
| 返回值 | |
参数说明:
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | 序列化的未签名交易数据(十六进制格式) |
| 是 | 链标识符 |
| 是 | 用户账户ID |
| 是 | 认证令牌 |
调用示例:
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
tx.send_raw_transaction4. tx.send_raw_transaction
—— 广播已签名交易
tx.send_raw_transactionBroadcast the signed DApp transaction to the on-chain network.
| Field | Description |
|---|---|
| Tool name | |
| Parameters | |
| Return value | |
Parameter description:
| Parameter | Required | Description |
|---|---|---|
| Yes | Signed transaction returned by |
| Yes | Chain identifier |
| Yes | Authentication 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交易广播至链上网络。
| 字段 | 描述 |
|---|---|
| 工具名称 | |
| 参数 | |
| 返回值 | |
参数说明:
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | |
| 是 | 链标识符 |
| 是 | 认证令牌 |
调用示例:
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交互类型
| Type | Example scenario | Description |
|---|---|---|
| DeFi liquidity | Uniswap add/remove liquidity | Build Router contract addLiquidity / removeLiquidity call |
| DeFi lending | Aave deposit/borrow/repay | Build Pool contract supply / borrow / repay call |
| DeFi Staking | Lido stake ETH | Build stETH contract submit call |
| NFT Mint | Custom NFT minting | Build mint contract call |
| NFT trading | Buy/sell NFT | Build Marketplace contract call |
| Token Approve | Authorize any contract to use token | Build ERC20 approve(spender, amount) calldata |
| Arbitrary contract call | User provides ABI + parameters | Agent encodes calldata and builds transaction |
| Message signing | DApp login verification | |
| 类型 | 示例场景 | 描述 |
|---|---|---|
| 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登录验证 | |
Supported Chains
支持的链
| Chain ID | Network name | Type | Native Gas token | Block explorer |
|---|---|---|---|---|
| Ethereum | EVM | ETH | etherscan.io |
| BNB Smart Chain | EVM | BNB | bscscan.com |
| Polygon | EVM | MATIC | polygonscan.com |
| Arbitrum One | EVM | ETH | arbiscan.io |
| Optimism | EVM | ETH | optimistic.etherscan.io |
| Avalanche C-Chain | EVM | AVAX | snowtrace.io |
| Base | EVM | ETH | basescan.org |
| Solana | Non-EVM | SOL | solscan.io |
| 链ID | 网络名称 | 类型 | 原生Gas代币 | 区块浏览器 |
|---|---|---|---|---|
| Ethereum | EVM | ETH | etherscan.io |
| BNB Smart Chain | EVM | BNB | bscscan.com |
| Polygon | EVM | MATIC | polygonscan.com |
| Arbitrum One | EVM | ETH | arbiscan.io |
| Optimism | EVM | ETH | optimistic.etherscan.io |
| Avalanche C-Chain | EVM | AVAX | snowtrace.io |
| Base | EVM | ETH | basescan.org |
| Solana | 非EVM | SOL | solscan.io |
Skill Routing
Skill路由
Based on user intent after DApp operation, route to the corresponding Skill:
| User intent | Route target |
|---|---|
| View updated balance | |
| View transaction details / history | |
| View contract security info | |
| Transfer tokens | |
| Swap tokens | |
| Login / authentication expired | |
根据用户在DApp操作后的意图,路由至对应的Skill:
| 用户意图 | 路由目标 |
|---|---|
| 查看更新后的余额 | |
| 查看交易详情/历史 | |
| 查看合约安全信息 | |
| 转账代币 | |
| 兑换代币 | |
| 登录/认证过期 | |
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 ~ 11DApp 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 Skill | Scenario | Description |
|---|---|---|
| User wants to connect DApp after viewing address | Carries account_id and address info |
| User wants to participate in DeFi after viewing token | Carries token and chain context |
| User wants to participate in DeFi after Swap | Carries chain and token context |
| 来源Skill | 场景 | 描述 |
|---|---|---|
| 用户查看地址后想要连接DApp | 携带account_id和地址信息 |
| 用户查看代币后想要参与DeFi | 携带代币和链上下文 |
| 用户兑换代币后想要参与DeFi | 携带链和代币上下文 |
Invoking other Skills
调用其他Skill
| Target Skill | Invocation scenario | Tools used |
|---|---|---|
| Get wallet address for DApp connection | |
| Validate balance before DApp transaction | |
| View updated balance after DApp transaction | |
| Not logged in or token expired | |
| Contract security review | |
| View transaction details after DApp transaction | |
| 目标Skill | 调用场景 | 使用工具 |
|---|---|---|
| 获取钱包地址用于DApp连接 | |
| DApp交易前校验余额 | |
| DApp交易后查看更新后的余额 | |
| 未登录或token过期 | |
| 合约安全审核 | |
| DApp交易后查看交易详情 | |
Contract Address Validation Rules
合约地址校验规则
Contract address validation for DApp transactions and Approve:
| Chain type | Format requirement | Validation rule |
|---|---|---|
| EVM (eth/bsc/polygon/...) | Starts with | Regex |
| Solana | Base58 encoded, 32-44 chars | Regex |
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/...) | 以 | 正则 |
| Solana | Base58编码,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^6Exact vs unlimited authorization:
| Method | amount value | Security | Convenience |
|---|---|---|---|
| Exact authorization | Actual amount needed | High (expires when used) | Low (requires re-authorization each time) |
| Unlimited authorization | | 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值 | 安全性 | 便捷性 |
|---|---|---|---|
| 精确授权 | 实际所需金额 | 高(使用后失效) | 低(每次操作需重新授权) |
| 无限授权 | | 低(合约可随时转移代币) | 高(一次授权永久有效) |
除非用户明确要求,否则推荐使用精确授权。
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
解析要点
- Domain info: Extract ,
name,version,chainId, display in table formatverifyingContract - Primary Type: Clearly label the primary type of signature data (e.g. ,
Order,Permit)Vote - Message fields: Display each field; truncate type for display; try to convert
addressto human-readable valuesuint256 - Known type recognition:
- (EIP-2612) → Label "Token authorization permit", highlight spender and value
Permit - (DEX order) → Label "Trading order", highlight trading pair and amount
Order - (governance vote) → Label "Governance vote", highlight vote content
Vote
- 域信息:提取、
name、version、chainId,以表格形式展示verifyingContract - 主类型:明确标注签名数据的主类型(例如、
Order、Permit)Vote - 消息字段:展示每个字段;地址类型字段可截断显示;尝试将转换为人类可读数值
uint256 - 已知类型识别:
- (EIP-2612)→ 标注“代币授权许可”,突出显示被授权方和金额
Permit - (DEX订单)→ 标注“交易订单”,突出显示交易对和金额
Order - (治理投票)→ 标注“治理投票”,突出显示投票内容
Vote
Known EIP-712 signature types
已知EIP-712签名类型
| primaryType | Common source | Risk level | Description |
|---|---|---|---|
| ERC-2612 token | Medium | Off-chain signature authorization, no Gas but grants spender token usage permission |
| DEX (e.g. 0x, Seaport) | Medium | Represents trading order, can be executed on-chain after signing |
| Governance protocol (e.g. Compound) | Low | Governance vote |
| Governance protocol | Low | Voting power delegation |
| Unknown type | Any DApp | High | Additional warning needed for user to carefully review content |
| primaryType | 常见来源 | 风险等级 | 描述 |
|---|---|---|---|
| ERC-2612代币 | 中 | 链下签名授权,无需Gas但授予被授权方代币使用权 |
| DEX(例如0x、Seaport) | 中 | 代表交易订单,签名后可在链上执行 |
| 治理协议(例如Compound) | 低 | 治理投票 |
| 治理协议 | 低 | 投票权委托 |
| 未知类型 | 任意DApp | 高 | 需要额外警告用户仔细审核内容 |
Edge Cases and Error Handling
边缘情况与错误处理
| Scenario | Handling |
|---|---|
| MCP Server not configured | Abort all operations, show Cursor configuration guide |
| MCP Server unreachable | Abort all operations, show network check prompt |
Not logged in (no | Guide to |
| First try |
| Insufficient Gas token balance | Abort transaction/Approve, show insufficient Gas info, suggest deposit |
| Token for Approve not in holdings | Prompt user does not hold this token; Approve can execute but has no practical effect. Confirm whether to continue |
| Spender contract is high risk | Strongly 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 format | Reject transaction, prompt correct address format |
| Show signing error, possible causes: incorrect message format, account anomaly. Do not auto-retry |
| EIP-712 JSON parse failed | Show raw JSON content, prompt format may be incorrect, ask user to confirm or re-fetch from DApp |
| Show signing error, possible causes: invalid transaction data, account permission issue. Do not auto-retry |
| 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 |
| Show error, possible causes: contract call will revert, incorrect parameters. Suggest checking transaction data |
| Approve amount is 0 | Treat as "revoke authorization" operation, confirm with user if they want to revoke authorization for this spender |
| User requests unlimited authorization | Show high-risk warning template, requires user secondary confirmation |
| Duplicate Approve for same spender | Prompt existing authorization, new Approve will overwrite old. Confirm whether to continue |
| Network disconnect after signing, before broadcast | Prompt signed transaction can still be broadcast later, suggest retry after network recovery |
| DApp-provided raw_tx format abnormal | Reject signing, prompt transaction data format incorrect, suggest re-generate from DApp |
| Unsupported chain identifier | Show supported chain list, ask user to re-select |
| Message signing request chain is Solana | Prompt Solana message signing not supported, EVM chains only |
| Network interruption | Show network error, suggest check network and retry |
| 场景 | 处理方式 |
|---|---|
| MCP服务器未配置 | 终止所有操作,显示Cursor配置指南 |
| MCP服务器不可达 | 终止所有操作,显示网络检查提示 |
未登录(无 | 引导至 |
| 首先尝试 |
| Gas代币余额不足 | 终止交易/Approve,显示Gas不足信息,建议存入Gas代币 |
| 待授权代币不在持有列表中 | 提示用户未持有该代币;Approve可执行但无实际效果,确认是否继续 |
| 被授权方合约为高风险 | 强烈警告用户,建议取消操作。若用户坚持,可继续执行(需二次确认) |
| 被授权方合约未知(未被索引) | 显示“未知合约”警告,提示用户验证合约来源 |
| 无效的合约地址格式 | 拒绝交易,提示正确的地址格式 |
| 显示签名错误,可能原因:消息格式错误、账户异常。请勿自动重试 |
| EIP-712 JSON解析失败 | 显示原始JSON内容,提示格式可能错误,询问用户是否确认或从DApp重新获取 |
| 显示签名错误,可能原因:交易数据无效、账户权限问题。请勿自动重试 |
| 显示广播错误(nonce冲突、Gas不足、网络拥堵等),根据错误类型给出对应建议 |
| 用户取消确认(签名/交易/Approve) | 立即终止操作,不执行任何签名或广播。显示取消提示,保持友好 |
| 显示错误,可能原因:合约调用将回滚、参数错误。建议检查交易数据 |
| Approve金额为0 | 视为“撤销授权”操作,确认用户是否要撤销对该被授权方的授权 |
| 用户请求无限授权 | 显示高风险警告模板,需要用户二次确认 |
| 同一被授权方重复Approve | 提示已有授权,新的Approve将覆盖旧授权,确认是否继续 |
| 签名后广播前网络断开 | 提示已签名交易可在后续广播,建议网络恢复后重试 |
| DApp提供的raw_tx格式异常 | 拒绝签名,提示交易数据格式错误,建议从DApp重新生成 |
| 不支持的链标识符 | 显示支持的链列表,询问用户重新选择 |
| 消息签名请求链为Solana | 提示不支持Solana消息签名,仅支持EVM链 |
| 网络中断 | 显示网络错误,建议检查网络并重试 |
Security Rules
安全规则
- confidentiality: Never display
mcp_tokenin plain text to user; use placeholdermcp_tokenin invocation examples only.<mcp_token> - masking: When displaying to user, only show partial characters (e.g.
account_id).acc_12...89 - Token auto-refresh: When expires, prefer silent refresh first; only require re-login if refresh fails.
mcp_token - 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.
- Contract security review: When DApp interaction involves unknown contract, must call for security review and display result to user. High-risk contracts require additional prominent warning.
token_get_risk_info - Default exact authorization: ERC20 Approve defaults to exact authorization amount. Use unlimited only when user explicitly requests, and must display unlimited authorization risk warning.
- 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, amount-type fields).spender - Gas balance validation mandatory: Before DApp transaction and Approve, must validate Gas token balance; prohibit initiating signing and broadcast when balance is insufficient.
- No auto-retry on failed operations: After signing or broadcast fails, clearly show error to user; do not auto-retry in background.
- Prohibit operations when MCP Server not configured or unreachable: If Step 0 connection check fails, abort all subsequent steps.
- MCP Server error transparency: All MCP Server error messages displayed to user as-is; do not hide or alter.
- must not be leaked: Unsigned transaction raw data flows only between Agent and MCP Server; do not display hex original to user.
raw_tx - Broadcast promptly after signing: After successful signing, broadcast immediately; do not hold signed transaction for long.
- 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.
- 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.
- 保密性:不得向用户明文显示
mcp_token;仅在调用示例中使用占位符mcp_token。<mcp_token> - 脱敏:向用户显示时仅展示部分字符(例如
account_id)。acc_12...89 - Token自动刷新:过期时,优先尝试静默刷新;仅在刷新失败时要求用户重新登录。
mcp_token - 签名前需确认:所有签名操作(消息签名、交易签名、Approve)必须向用户展示完整内容并获得明确的“confirm”回复后才能执行。不得跳过、简化或自动确认。
- 合约安全审核:DApp交互涉及未知合约时,必须调用进行安全审核并向用户展示结果。高风险合约需额外突出警告。
token_get_risk_info - 默认精确授权:ERC20 Approve默认使用精确授权金额。仅在用户明确要求时使用无限授权,且必须显示无限授权风险警告。
- EIP-712内容透明:EIP-712签名请求必须完全解析为人类可读格式展示给用户;不得省略任何关键字段(尤其是、
verifyingContract、金额类字段)。spender - Gas余额强制校验:DApp交易和Approve前,必须校验Gas代币余额;禁止在余额不足时发起签名和广播。
- 失败操作不自动重试:签名或广播失败后,向用户明确显示错误;不得在后台自动重试。
- MCP服务器不可用时禁止操作:若步骤0连接检查失败,终止所有后续步骤。
- MCP服务器错误透明:向用户原样展示所有MCP服务器错误消息;不得隐藏或修改。
- 不得泄露:未签名交易原始数据仅在Agent和MCP服务器间传输;不得向用户显示十六进制原始内容。
raw_tx - 签名后及时广播:签名成功后立即广播;不得长时间持有已签名交易。
- Permit签名风险警告:EIP-2612 Permit签名不消耗Gas但等同于授权;必须提醒用户注意被授权方和授权金额。
- 防钓鱼机制:Agent不得主动构建指向未知合约的交易或签名请求。所有DApp交互数据应由用户提供或来自可信来源。