metamask-agent-wallet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMetaMask Agentic CLI Skill
MetaMask Agentic CLI 技能
This skill documents the CLI surface for MetaMask Agent Wallet authentication, wallet lifecycle, balance queries, token transfers, message and typed-data signing, raw transactions, chain discovery, market data, token discovery, perpetual futures trading, prediction market trading, prediction trade/redeem history, token swaps, cross-chain bridges, DeFi earn/yield vaults, and EVM calldata decoding.
mmUse the routing table to select the relevant reference file. CLI behavior lives in . Repeatable operational patterns live in .
references/workflows/本技能记录了用于MetaMask Agent钱包身份验证、钱包生命周期、余额查询、代币转账、消息与类型数据签名、原始交易、链发现、市场数据、代币发现、永续期货交易、预测市场交易、预测交易/赎回历史、代币兑换、跨链桥、DeFi收益/收益金库以及EVM calldata解码的 CLI接口。
mm使用路由表选择相关参考文件。CLI行为在目录下。可重复的操作模式在目录下。
references/workflows/Command Routing
命令路由
Match the user's intent to a command and reference file, then read the reference before constructing a command. If intent spans multiple domains, load them sequentially in dependency order.
| User Intent | Command | Reference |
|---|---|---|
| Check authentication status | | auth.md |
| Login in MetaMask Agentic CLI | | auth.md |
| Choose a wallet mode and set up policies | | auth.md |
| Show current init settings | | auth.md |
| Sign in via QR code with MetaMask Mobile | | auth.md |
| Sign in via browser (Google or Email) | | auth.md |
| Sign out | | auth.md |
| Reset CLI session | | auth.md |
| Show CLI configuration | | auth.md |
| Set CLI configuration | | auth.md |
| Set BYOK mnemonic encryption password | | auth.md |
| Change BYOK mnemonic encryption password | | auth.md |
| Remove BYOK mnemonic encryption password | | auth.md |
| Interpret raw CLI error codes | | errors.md |
| Inspect CLI, skills, environment, and session health | | doctor.md |
| Decode EVM calldata into a human-readable intent | | decode.md |
| Create a wallet | | wallet.md |
| List all wallets | | wallet.md |
| Switch active wallet | | wallet.md |
| Show active wallet details | | wallet.md |
| Show active wallet address | | wallet.md |
| Check the active wallet balance | | wallet.md |
| Show a QR code and address to fund the active wallet | | wallet.md |
| Show current trading mode | | wallet.md |
| Set trading mode to guard or beast | | wallet.md |
| View wallet policy | | wallet.md |
| Set wallet policy | | wallet.md |
| Show project policy template | | wallet.md |
| Sign a plaintext message | | signing.md |
| Sign EIP-712 typed data | | signing.md |
| Send a raw EVM transaction | | transaction.md |
| Transfer native tokens or ERC-20 tokens | | transfer.md |
| List supported chains by the CLI | | chain.md |
| List pending wallet requests | | polling.md |
| Watch a wallet polling id | | polling.md |
| Query spot or historical prices | | market-data.md |
| Discover tokens, token networks, or token metadata | | market-data.md |
| List perpetual markets | | perps.md |
| Check perps account balance | | perps.md |
| List open perpetual positions | | perps.md |
| Get a quote for a perpetual order | | perps.md |
| List resting perpetual orders | | perps.md |
| Open a perpetual position | | perps.md |
| Close a perpetual position | | perps.md |
| Modify leverage, take-profit, or stop-loss | | perps.md |
| Cancel a resting perps order | | perps.md |
| Deposit USDC into a perps venue | | perps.md |
| Withdraw USDC from a perps venue | | perps.md |
| Transfer USDC between spot and perp accounts | | perps.md |
| List perpetual futures venues | | perps.md |
| List available DEXs for a venue | | perps.md |
| Set Predict trading mode | | predict.md |
| One-time Predict setup | | predict.md |
| Create or refresh Predict credentials | | predict.md |
| Repair Predict approvals | | predict.md |
| Check Predict back-end status and account setup | | predict.md |
| Check if Polymarket is geoblocked for your IP | | predict.md |
| List prediction markets | | predict.md |
| Search prediction markets | | predict.md |
| Inspect a prediction market | | predict.md |
| List Polymarket events | | predict.md |
| Inspect a Polymarket event | | predict.md |
| List Polymarket event series | | predict.md |
| Inspect a Polymarket event series | | predict.md |
| List Polymarket tags | | predict.md |
| Inspect a Polymarket tag | | predict.md |
| Preview a prediction order cost | | predict.md |
| Place a prediction market order | | predict.md |
| Cancel prediction orders | | predict.md |
| View prediction market positions | | predict.md |
| View open prediction orders | | predict.md |
| Show full Predict portfolio snapshot | | predict.md |
| List redeemable winning positions | | predict.md |
| Redeem winning positions | | predict.md |
| Check Predict deposit wallet balance | | predict.md |
| Fund Predict deposit wallet | | predict.md |
| Withdraw pUSD from Predict deposit wallet | | predict.md |
| Fetch prediction order book | | predict.md |
| Watch a Predict job | | predict.md |
| List Predict trade or redeem history | | predict.md |
| Inspect Predict history for a specific market | | predict.md |
| Look up a transaction by hash | | tx-history.md |
| List recent transactions for the active wallet | | tx-history.md |
| Get a swap or bridge quote | | swap.md |
| Execute a token swap or bridge | | swap.md |
| Check swap or bridge status | | swap.md |
| Bridge tokens to another chain | | swap.md |
Pay an HTTP | | x402.md |
| List earn vaults and APYs | | earn.md |
| View earn vault positions | | earn.md |
| Supply tokens to an earn vault | | earn.md |
| Withdraw tokens from an earn vault | | earn.md |
将用户意图匹配到对应的命令和参考文件,然后在构造命令前阅读参考内容。如果意图涉及多个领域,按依赖顺序依次加载相关内容。
| 用户意图 | 命令 | 参考文件 |
|---|---|---|
| 检查身份验证状态 | | auth.md |
| 登录MetaMask Agentic CLI | | auth.md |
| 选择钱包模式并设置策略 | | auth.md |
| 显示当前初始化设置 | | auth.md |
| 通过MetaMask移动端扫码登录 | | auth.md |
| 通过浏览器(谷歌或邮箱)登录 | | auth.md |
| 登出 | | auth.md |
| 重置CLI会话 | | auth.md |
| 显示CLI配置 | | auth.md |
| 设置CLI配置 | | auth.md |
| 设置BYOK助记词加密密码 | | auth.md |
| 修改BYOK助记词加密密码 | | auth.md |
| 移除BYOK助记词加密密码 | | auth.md |
| 解析原始CLI错误码 | | errors.md |
| 检查CLI、技能、环境和会话健康状态 | | doctor.md |
| 将EVM calldata解码为人类可读的意图 | | decode.md |
| 创建钱包 | | wallet.md |
| 列出所有钱包 | | wallet.md |
| 切换活跃钱包 | | wallet.md |
| 显示活跃钱包详情 | | wallet.md |
| 显示活跃钱包地址 | | wallet.md |
| 检查活跃钱包余额 | | wallet.md |
| 显示二维码和地址以给活跃钱包充值 | | wallet.md |
| 显示当前交易模式 | | wallet.md |
| 将交易模式设置为guard或beast | | wallet.md |
| 查看钱包策略 | | wallet.md |
| 设置钱包策略 | | wallet.md |
| 显示项目策略模板 | | wallet.md |
| 签署明文消息 | | signing.md |
| 签署EIP-712类型数据 | | signing.md |
| 发送原始EVM交易 | | transaction.md |
| 转账原生代币或ERC-20代币 | | transfer.md |
| 列出CLI支持的链 | | chain.md |
| 列出待处理的钱包请求 | | polling.md |
| 监听钱包轮询ID | | polling.md |
| 查询现货或历史价格 | | market-data.md |
| 发现代币、代币网络或代币元数据 | | market-data.md |
| 列出永续市场 | | perps.md |
| 检查永续账户余额 | | perps.md |
| 列出未平仓永续头寸 | | perps.md |
| 获取永续订单报价 | | perps.md |
| 列出挂单永续订单 | | perps.md |
| 开永续头寸 | | perps.md |
| 平永续头寸 | | perps.md |
| 修改杠杆、止盈或止损 | | perps.md |
| 取消挂单永续订单 | | perps.md |
| 将USDC存入永续交易场所 | | perps.md |
| 从永续交易场所提取USDC | | perps.md |
| 在现货账户和永续账户之间划转USDC | | perps.md |
| 列出永续期货交易场所 | | perps.md |
| 列出交易场所支持的DEX | | perps.md |
| 设置Predict交易模式 | | predict.md |
| Predict一次性设置 | | predict.md |
| 创建或刷新Predict凭证 | | predict.md |
| 修复Predict授权 | | predict.md |
| 检查Predict后端状态和账户设置 | | predict.md |
| 检查Polymarket是否对当前IP进行地域限制 | | predict.md |
| 列出预测市场 | | predict.md |
| 搜索预测市场 | | predict.md |
| 查看预测市场详情 | | predict.md |
| 列出Polymarket事件 | | predict.md |
| 查看Polymarket事件详情 | | predict.md |
| 列出Polymarket事件系列 | | predict.md |
| 查看Polymarket事件系列详情 | | predict.md |
| 列出Polymarket标签 | | predict.md |
| 查看Polymarket标签详情 | | predict.md |
| 预览预测订单成本 | | predict.md |
| 下达预测市场订单 | | predict.md |
| 取消预测订单 | | predict.md |
| 查看预测市场头寸 | | predict.md |
| 查看未平仓预测订单 | | predict.md |
| 显示完整的Predict投资组合快照 | | predict.md |
| 列出可赎回的盈利头寸 | | predict.md |
| 赎回盈利头寸 | | predict.md |
| 检查Predict存款钱包余额 | | predict.md |
| 给Predict存款钱包充值 | | predict.md |
| 从Predict存款钱包提取pUSD | | predict.md |
| 获取预测订单簿 | | predict.md |
| 监听Predict任务 | | predict.md |
| 列出Predict交易或赎回历史 | | predict.md |
| 查看特定市场的Predict历史 | | predict.md |
| 通过哈希查询交易 | | tx-history.md |
| 列出活跃钱包的近期交易 | | tx-history.md |
| 获取兑换或跨链桥报价 | | swap.md |
| 执行代币兑换或跨链桥操作 | | swap.md |
| 检查兑换或跨链桥状态 | | swap.md |
| 将代币跨链到其他链 | | swap.md |
支付HTTP | | x402.md |
| 列出收益金库和年化收益率(APY) | | earn.md |
| 查看收益金库头寸 | | earn.md |
| 向收益金库存入代币 | | earn.md |
| 从收益金库提取代币 | | earn.md |
Workflows
工作流
CLI behavior lives in . Repeatable patterns live in . Load a workflow file when the user's request is a pattern, not a single command.
references/workflows/| Pattern | Workflow |
|---|---|
| First time setup and onboarding | onboarding.md |
| Login flow | login.md |
| Troubleshooting decision tree | troubleshooting.md |
| Swap quote-review-execute flow | swap.md |
| Bridge quote-review-execute flow | bridge.md |
| Open a perpetual position flow | perps-open-position.md |
| Close a perpetual position flow | perps-close-position.md |
| Modify a perpetual position flow | perps-modify-position.md |
| Predict first-time setup and credentials | predict-setup.md |
| Deposit or withdraw pUSD from Predict wallet | predict-funding.md |
| Search and browse prediction markets | predict-markets.md |
| Quote and place a prediction order | predict-place-order.md |
| View or cancel Predict orders and positions | predict-manage-orders.md |
| View Predict portfolio and redeem winnings | predict-portfolio.md |
| View Predict trade and redeem history | predict-history.md |
| Token discovery, prices, and market data | market-data.md |
| Supply tokens to earn yield | earn-supply.md |
| Withdraw tokens from an earn vault | earn-withdraw.md |
Pay an HTTP | x402-pay.md |
CLI行为在目录下。可重复的操作模式在目录下。当用户请求是一种操作模式而非单一命令时,加载对应的工作流文件。
references/workflows/| 操作模式 | 工作流 |
|---|---|
| 首次设置与入门 | onboarding.md |
| 登录流程 | login.md |
| 故障排除决策树 | troubleshooting.md |
| 兑换报价-审核-执行流程 | swap.md |
| 跨链桥报价-审核-执行流程 | bridge.md |
| 开永续头寸流程 | perps-open-position.md |
| 平永续头寸流程 | perps-close-position.md |
| 修改永续头寸流程 | perps-modify-position.md |
| Predict首次设置与凭证配置 | predict-setup.md |
| 向Predict钱包存入或提取pUSD | predict-funding.md |
| 搜索与浏览预测市场 | predict-markets.md |
| 预测订单报价与下达 | predict-place-order.md |
| 查看或取消Predict订单与头寸 | predict-manage-orders.md |
| 查看Predict投资组合与赎回盈利 | predict-portfolio.md |
| 查看Predict交易与赎回历史 | predict-history.md |
| 代币发现、价格与市场数据 | market-data.md |
| 向收益金库存入代币获取收益 | earn-supply.md |
| 从收益金库提取代币 | earn-withdraw.md |
支付HTTP | x402-pay.md |
Global Flags
全局标志
Every command accepts these flags:
mm| Flag | Short | Description |
|---|---|---|
| | Output format: |
| Shorthand for | |
| Shorthand for | |
| | Show debug logs on stderr. Use for troubleshooting |
Always use for command output unless the user explicitly requests a different format.
--toon每个命令都支持以下标志:
mm| 标志 | 简写 | 描述 |
|---|---|---|
| | 输出格式: |
| | |
| | |
| | 在stderr显示调试日志,用于故障排除 |
除非用户明确要求其他格式,否则始终使用作为命令输出格式。
--toonPreflight
预检
Run these checks before the first CLI operation in a session, in order.
在会话中首次执行CLI操作前,按顺序运行以下检查。
1. Version compatibility
1. 版本兼容性
This skill is written for v6.0.0, as specified by in the frontmatter. Check the installed version:
@metamask/agent-walletcliVersionbash
mm --versionThe installed version is the value after , such as . Compare its against the pinned . Optionally check the latest published version (best-effort, skip silently on network failure:
@metamask/agent-wallet/@metamask/agent-wallet/2.0.0 darwin-arm64 node-v22.18.0major.minorcliVersionbash
npm view @metamask/agent-wallet versionIf the installed differs from the pinned , or the installed version is behind the latest release, warn the user once and continue:
major.minorcliVersionVersion mismatch: installed CLI, this skill is pinned to<installed>, latest release is5.2.1. Command syntax in this skill may be inaccurate until they are aligned. Update the CLI with<latest>, then re-install the skills withnpm install -g @metamask/agent-wallet@latest.npx skills add metaMask/agent-skills
Run this check once per session. Do not block operations on it.
本技能是为 v6.0.0编写的,如前置元数据中的所指定。检查已安装的版本:
@metamask/agent-walletcliVersionbash
mm --version已安装版本是之后的值,例如。将其版本与固定的对比。可选地检查最新发布版本(尽最大努力执行,网络失败时静默跳过):
@metamask/agent-wallet/@metamask/agent-wallet/2.0.0 darwin-arm64 node-v22.18.0major.minorcliVersionbash
npm view @metamask/agent-wallet version如果已安装的版本与固定的不同,或者已安装版本落后于最新发布版本,向用户发出一次警告后继续操作:
major.minorcliVersion版本不匹配:已安装CLI版本为,本技能固定为<installed>,最新发布版本为5.2.1。在版本对齐前,本技能中的命令语法可能不准确。使用<latest>更新CLI,然后使用npm install -g @metamask/agent-wallet@latest重新安装技能。npx skills add metaMask/agent-skills
每个会话仅运行一次此检查,不要阻止后续操作。
2. Readiness gate — authentication and initialization
2. 就绪检查 — 身份验证与初始化
mm doctorbash
mm doctorIt reports an boolean, an boolean, and a list of . Do not run any other command until reports both and . Authentication and initialization are independent gates: a session can be authenticated while the project has no wallet mode selected, in which case any command that needs a wallet aborts before running with — "Project not initialized." with hint: Run to set up wallet and trading modes.
authenticatedinitializedhintsmm doctorauthenticated: trueinitialized: trueNOT_INITIALIZEDmm initA project counts as initialized only when a wallet mode is set — and, for , a trading mode is set as well. needs only the wallet mode. Do not use as the check: it requires an initialized project and throws on an uninitialized one rather than reporting state.
server-walletbyokmm init showNOT_INITIALIZEDRemediate, then re-run and confirm a clean result before doing anything else:
mm doctor- → follow
authenticated: false, orworkflows/login.mdfor first-time setup, to runworkflows/onboarding.md.mm login - and
authenticated: true→ followinitialized: falseto runworkflows/onboarding.mdand select a wallet mode. For server-wallet, also select a trading mode.mm init
mm doctorbash
mm doctor它会返回布尔值、布尔值以及列表。在返回和之前,不要执行任何其他命令。身份验证和初始化是独立的检查项:会话可能已通过身份验证,但项目未选择钱包模式,此时任何需要钱包的命令会在执行前终止并返回 — "项目未初始化。",提示:运行设置钱包和交易模式。
authenticatedinitializedhintsmm doctorauthenticated: trueinitialized: trueNOT_INITIALIZEDmm init只有当设置了钱包模式后,项目才被视为已初始化 — 对于,还需要设置交易模式。仅需设置钱包模式。不要使用作为检查命令:它要求项目已初始化,否则会抛出错误而非报告状态。
server-walletbyokmm init showNOT_INITIALIZED修复问题后,重新运行并确认结果正常后再执行其他操作:
mm doctor- → 遵循
authenticated: false,或首次设置时遵循workflows/login.md,运行workflows/onboarding.md。mm login - 且
authenticated: true→ 遵循initialized: false,运行workflows/onboarding.md并选择钱包模式。对于server-wallet,还需选择交易模式。mm init
Safety Rules
安全规则
These rules apply to every operation, regardless of which reference or workflow is active.
无论使用哪个参考文件或工作流,以下规则适用于所有操作。
Input Validation
输入验证
Before constructing any command, validate all user-provided values:
| Flag | Validation rule |
|---|---|
| Must match |
| Human-readable decimal such as 0.5 or 100. Must match |
| Must be a positive integer ( |
| Must be valid JSON. No unescaped shell metacharacters outside the JSON structure |
| Must be 0x-prefixed hex calldata, matching |
| Must be a valid hex address or known symbol |
| Must be a positive integer ( |
| Human-readable decimal such as 0.01 or 1. Must match |
| Must be |
| Must be |
| Must be a positive integer ( |
| Must be a non-empty outcome token ID string |
| Must be a positive number in range |
| Must be one of |
| Must be |
| Must be a number between 0 and 100 |
| Must be one of |
| Must be a positive integer EVM chain ID |
| Must match |
| Boolean flag, no value. Only meaningful for cross-chain swaps where |
| Comma-separated list from: |
| Must be a positive integer between 1 and 600 |
| Must be a non-empty string. Never log, display, or store the value. |
x402 | Must be a valid contract address on a network returned by |
x402 | Must match |
x402 | Atomic-unit integer that exactly equals the offered amount. The |
| x402 resource URL | Must be |
Do not pass unvalidated user input into any command.
在构造任何命令前,验证所有用户提供的值:
| 标志 | 验证规则 |
|---|---|
| 必须匹配 |
| 人类可读的十进制数,如0.5或100。必须匹配 |
| 必须是正整数( |
用于send-transaction的 | 必须是有效的JSON。JSON结构外不能有未转义的shell元字符 |
用于decode的 | 必须是0x前缀的十六进制calldata,匹配 |
| 必须是有效的十六进制地址或已知符号 |
| 必须是正整数( |
| 人类可读的十进制数,如0.01或1。必须匹配 |
| 必须是 |
用于perps的 | 必须是 |
| 必须是正整数( |
| 必须是非空的结果代币ID字符串 |
| 必须是 |
| 必须是 |
用于predict的 | 必须是 |
| 必须是0到100之间的数字 |
| 必须是 |
| 必须是正整数EVM链ID |
| 必须匹配 |
| 布尔标志,无值。仅对 |
| 逗号分隔的列表,可选值: |
| 必须是1到600之间的正整数 |
| 必须是非空字符串。绝不要记录、显示或存储该值。 |
x402 | 必须是 |
x402 | 必须匹配 |
x402 | 原子单位整数,必须与提供的金额完全一致。 |
| x402资源URL | 必须是 |
不要将未验证的用户输入传入任何命令。
Confirmation Requirements
确认要求
| Operation type | Confirmation rule |
|---|---|
| Transfers | Always confirm recipient, amount, token, and chain before executing |
| Raw transactions | Always confirm transaction payload, chain, recipient, value, and calldata summary before executing |
| Message signing | Always show exact message and chain before signing |
| Typed-data signing | Always show domain, primary type, chain, verifying contract, and message summary before signing |
| Swaps / bridges | Always confirm from/to tokens, amount, source/destination chain, slippage, quoted output, recipient address if |
| x402 payments | Always confirm asset, decimals-correct amount, network, |
| Perps trading | Always confirm symbol, side, size, leverage, venue, order type, and limit price if present before executing |
| Perps deposit/withdraw | Always confirm amount, asset, venue, network, and destination where applicable before executing |
| Predict trading | Always confirm token ID, side, size, price, order type, market, and outcome before executing |
| Predict deposit | Always confirm amount before executing |
| Predict withdraw | Always confirm amount and recipient before executing. |
| Predict redeem | Always confirm the target, either condition ID or |
| Earn supply | Always confirm token, amount, chain, vault/protocol, and APY before executing. For cross-chain supply, also confirm source chain and source token |
| Earn withdraw | Always confirm token, amount or full balance, chain, and vault/protocol before executing |
| Cancel-all operations | Always confirm scope and exact destructive effect before executing |
| Wallet policy changes | Broadening policy changes require MFA approval; non-broadening changes apply immediately |
| Trading mode changes | Broadening from guard to beast requires MFA approval. Tightening from beast to guard applies immediately |
| Auth / wallet management | May execute without confirmation, except |
| Read-only queries | May execute without confirmation |
| 操作类型 | 确认规则 |
|---|---|
| 转账 | 执行前始终确认收款方、金额、代币和链 |
| 原始交易 | 执行前始终确认交易负载、链、收款方、金额和calldata摘要 |
| 消息签名 | 签名前始终显示完整消息和链 |
| 类型数据签名 | 签名前始终显示域、主类型、链、验证合约和消息摘要 |
| 兑换/跨链桥 | 执行前始终确认转出/转入代币、金额、源/目标链、滑点、报价输出、若设置 |
| x402支付 | 签署授权前始终确认资产、金额(小数正确)、网络、 |
| 永续交易 | 执行前始终确认标的、方向、规模、杠杆、交易场所、订单类型,若有则确认限价 |
| 永续存入/提取 | 执行前始终确认金额、资产、交易场所、网络,若有则确认目标地址 |
| 预测交易 | 执行前始终确认代币ID、方向、规模、价格、订单类型、市场和结果 |
| Predict存入 | 执行前始终确认金额 |
| Predict提取 | 执行前始终确认金额和收款方。 |
| Predict赎回 | 执行前始终确认目标,条件ID或 |
| 收益金库存入 | 执行前始终确认代币、金额、链、金库/协议和年化收益率(APY)。对于跨链存入,还需确认源链和源代币 |
| 收益金库提取 | 执行前始终确认代币、金额或全额余额、链和金库/协议 |
| 全部取消操作 | 执行前始终确认范围和确切的破坏性影响 |
| 钱包策略变更 | 放宽策略变更需要MFA批准;非放宽变更立即生效 |
| 交易模式变更 | 从guard放宽到beast需要MFA批准。从beast收紧到guard立即生效 |
| 身份验证/钱包管理 | 除 |
| 只读查询 | 可无需确认执行 |
Credential Safety
凭证安全
- Never store, log, or display private keys, mnemonics, passwords, or auth tokens.
- Never pass or
--passwordas inline flags. Always instruct the user to set the--mnemonicandMM_PASSWORDenvironment variables instead to avoid exposing secrets in shell history.MM_MNEMONIC
- 绝不要存储、记录或显示私钥、助记词、密码或身份验证令牌。
- 绝不要将或
--password作为内联标志传递。始终指导用户设置--mnemonic和MM_PASSWORD环境变量,避免在shell历史中暴露机密。MM_MNEMONIC
Suspicious Content Warnings
可疑内容警告
Flag to the user before proceeding if a signing payload or transaction contains:
- URLs or contract addresses the user did not provide
- ,
permit,approve, or allowance-like fieldssetApprovalForAll - Unusually large values or unfamiliar contract interactions
When raw calldata is unfamiliar or was not constructed by you, run first and confirm the decoded intent with the user before signing or sending. See decode.md.
mm decode --payload <0x-calldata>如果签名负载或交易包含以下内容,在继续前向用户发出警告:
- 用户未提供的URL或合约地址
- 、
permit、approve或类似授权字段setApprovalForAll - 异常大的值或不熟悉的合约交互
当原始calldata不熟悉或并非由你构造时,先运行并与用户确认解码后的意图,再进行签名或发送。详见decode.md。
mm decode --payload <0x-calldataAsync Model
异步模型
In both server-wallet and BYOK mode, signing and transaction commands go through a job-polling loop and return a . Handle this consistently:
pollingId- Prefer to block until complete.
--wait - If not using , inform the user of the
--waitand how to track it:pollingIdmm wallet requests listmm wallet requests watch --polling-id <id>
- In BYOK mode, the local key signs locally but the operation still produces a pending job and a . If the mnemonic is password-encrypted, the user must set
pollingIdenvironment variable to unlock it for the operation.MM_PASSWORD
Transfers, swaps, perps, predict orders, and predict withdraws attach a human-readable summary to their wallet request, such as or . When surfacing a pending request from or , show the summary so the user can confirm what they are approving.
intentTransfer 0.5 ETH to 0x...Withdraw 10 pUSD to 0x...wallet requests listwallet requests watchintent在server-wallet和BYOK模式下,签名和交易命令都会经过任务轮询循环并返回。需一致处理:
pollingId- 优先使用阻塞直到操作完成。
--wait - 如果不使用,告知用户
--wait以及如何跟踪:pollingIdmm wallet requests listmm wallet requests watch --polling-id <id>
- 在BYOK模式下,本地密钥在本地签名,但操作仍会生成待处理任务和。如果助记词已加密,用户必须设置
pollingId环境变量才能解锁以执行操作。MM_PASSWORD
转账、兑换、永续交易、Predict订单和Predict提取操作会在钱包请求中附加人类可读的摘要,例如或。当从或中显示待处理请求时,展示摘要以便用户确认他们要批准的内容。
intentTransfer 0.5 ETH to 0x...Withdraw 10 pUSD to 0x...wallet requests listwallet requests watchintentOutput Rules
输出规则
- Route silently. Do not announce which reference you are loading.
- Surface errors from commands verbatim. Do not mask or reword them.
- If a command fails, check and guide from there.
mm <command> --help
- 静默路由,不要宣布正在加载哪个参考文件。
- 原样展示命令返回的错误,不要掩盖或改写。
- 如果命令失败,检查并据此指导用户。
mm <command> --help