From 15ee99308ee3aa25191ac0d10d34ff3d08d8c246 Mon Sep 17 00:00:00 2001 From: AyushBherwani1998 Date: Thu, 23 Jul 2026 13:59:58 +0530 Subject: [PATCH 1/2] update docs --- agent-wallet-sidebar.js | 1 + agent-wallet/README.mdx | 7 + agent-wallet/guides/earn-yield-vaults.md | 104 +++++++++++++ agent-wallet/guides/send-tokens.md | 11 ++ agent-wallet/guides/swap-and-bridge.md | 21 +++ agent-wallet/quickstart.md | 17 ++- agent-wallet/reference/architecture.md | 12 ++ agent-wallet/reference/commands.md | 162 ++++++++++++++++----- agent-wallet/reference/error-codes.md | 19 +++ agent-wallet/reference/supported-chains.md | 33 +++-- agent-wallet/troubleshooting.md | 25 +++- agent-wallet/use-the-cli-directly.md | 2 +- 12 files changed, 361 insertions(+), 53 deletions(-) create mode 100644 agent-wallet/guides/earn-yield-vaults.md diff --git a/agent-wallet-sidebar.js b/agent-wallet-sidebar.js index fc882f4be4a..644b9af1906 100644 --- a/agent-wallet-sidebar.js +++ b/agent-wallet-sidebar.js @@ -27,6 +27,7 @@ const sidebar = { 'guides/swap-and-bridge', 'guides/trade-perpetuals', 'guides/trade-prediction-markets', + 'guides/earn-yield-vaults', 'guides/lend-and-borrow-aave', 'guides/check-balances-and-prices', 'guides/sign-messages-and-transactions', diff --git a/agent-wallet/README.mdx b/agent-wallet/README.mdx index 818de3ad9b0..79e373e7afb 100644 --- a/agent-wallet/README.mdx +++ b/agent-wallet/README.mdx @@ -27,6 +27,7 @@ After setup, prompt your agent in plain language: | "Swap 0.1 ETH to USDC on Base" | Your agent fetches a quote, confirms with you, then executes. | | "Open a 5x long on BTC with $100 on Hyperliquid" | Your agent deposits if needed, quotes, and opens the position. | | "Bet 10 USDT on YES for BTC 5-min price up" | Your agent searches markets, confirms odds, and places the order. | +| "Supply 100 USDC to a yield vault on Base" | Your agent finds vaults, compares APYs, and supplies your tokens. | @@ -79,6 +80,7 @@ Your agent routes natural-language requests to these commands through installed | [Swap / bridge](guides/swap-and-bridge.md) | Quote, execute, and track swaps and cross-chain bridges | | [Perpetuals](guides/trade-perpetuals.md) | Trade on Hyperliquid (deposit, open, modify, close) | | [Prediction markets](guides/trade-prediction-markets.md) | Search, quote, trade, and redeem on Polymarket | +| [Earn (yield vaults)](guides/earn-yield-vaults.md) | Supply and withdraw from yield vaults across chains | | [Aave V3](guides/lend-and-borrow-aave.md) | Supply, borrow, repay, and manage lending positions | | [Market data](guides/check-balances-and-prices.md) | Spot prices, token discovery, supported chains | @@ -113,6 +115,11 @@ See [Supported chains](reference/supported-chains.md) for typical networks. title: 'Trade perpetuals', description: 'Deposit, open, modify, and close Hyperliquid positions.', }, + { + href: '/agent-wallet/guides/earn-yield-vaults', + title: 'Earn with yield vaults', + description: 'Supply and withdraw from yield vaults across chains and protocols.', + }, { href: '/agent-wallet/guides/lend-and-borrow-aave', title: 'Lend and borrow with Aave V3', diff --git a/agent-wallet/guides/earn-yield-vaults.md b/agent-wallet/guides/earn-yield-vaults.md new file mode 100644 index 00000000000..424feae7387 --- /dev/null +++ b/agent-wallet/guides/earn-yield-vaults.md @@ -0,0 +1,104 @@ +--- +description: Supply and withdraw from yield vaults using mm earn commands. +keywords: [MetaMask, Agent Wallet, earn, yield, DeFi, vaults, mm] +--- + +# Earn with yield vaults + +Browse yield vaults, supply tokens, and withdraw positions using the `mm earn` commands. +Agent Wallet routes supply and withdraw operations through LiFi for cross-chain support. + +## Ask your agent + +```text +You (to your agent): "Show me the best yield vaults for USDC on Base" +``` + +```text +You (to your agent): "Supply 100 USDC to a vault on Base" +``` + +```text +You (to your agent): "Withdraw all my USDC from the Aave vault on Base" +``` + +Your agent lists available vaults, compares APYs and TVL, confirms your choice, then executes. + +## Prerequisites + +- [Quickstart](../quickstart.md) completed +- Sufficient token balance on the source chain + +## Browse vaults + +List available yield vaults with APY and TVL data: + +```bash +mm earn markets [--chain ] [--protocol ] [--min-tvl ] +``` + +Filter by chain, protocol, or minimum TVL to find the best opportunities. + +## Check your positions + +View your current yield positions: + +```bash +mm earn positions +``` + +## Supply to a vault + +Supply tokens to a yield vault: + +```bash +mm earn supply --token --amount [--chain ] [--from-chain ] +``` + +| Flag | Required | Description | +| -------------- | -------- | ------------------------------------- | +| `--token` | Yes | Token symbol or contract address | +| `--amount` | Yes | Human-readable amount to supply | +| `--chain` | No | Destination chain for the vault | +| `--from-chain` | No | Source chain if supplying cross-chain | + +The CLI automatically handles ERC-20 approval when the vault's allowance is insufficient. + +## Withdraw from a vault + +Withdraw tokens from a yield vault: + +```bash +mm earn withdraw --token --amount [--chain ] +``` + +Use `--amount all` to withdraw your full position. +For Aave rebasing aTokens, `--all` applies a small dust buffer to avoid revert from interest +accrual between the query and the transaction. + +## Cross-chain supply + +Supply from a different chain than the vault's chain by passing `--from-chain`: + +```bash +mm earn supply --token USDC --amount 100 --chain 8453 --from-chain 1 +``` + +This bridges and supplies in a single operation. + +## Common pitfalls + +:::caution Approval required +When supplying for the first time, the CLI sends an ERC-20 approval transaction before the supply +transaction. In server-wallet mode, this may require 2FA approval depending on your trading mode. +::: + +:::note Withdraw reverts +If a full withdrawal reverts, retry with a slightly smaller amount. Rebasing tokens (like Aave +aTokens) accrue interest between the balance query and transaction execution. +::: + +## Related commands + +- [`mm earn`](../reference/commands.md#mm-earn) in the commands reference +- [Check balances and prices](check-balances-and-prices.md) diff --git a/agent-wallet/guides/send-tokens.md b/agent-wallet/guides/send-tokens.md index 23611b89834..860d60a940e 100644 --- a/agent-wallet/guides/send-tokens.md +++ b/agent-wallet/guides/send-tokens.md @@ -49,6 +49,17 @@ Your agent confirms the recipient, amount, token, and chain before executing. 4. Confirm the transaction hash in the command output. +## Gasless ERC-20 transfers + +When your wallet's native balance cannot cover gas, the CLI automatically routes ERC-20 transfers +through a gasless relay. You can optionally pay relay fees in an ERC-20 token: + +```bash +mm transfer --to
--amount 10 --token USDC --chain-id 8453 --gas-token USDC --wait +``` + +Gasless transfers are not available for native token sends. + ## Common pitfalls :::note Per-chain balances diff --git a/agent-wallet/guides/swap-and-bridge.md b/agent-wallet/guides/swap-and-bridge.md index 18e2b4ea549..d72e8a75d74 100644 --- a/agent-wallet/guides/swap-and-bridge.md +++ b/agent-wallet/guides/swap-and-bridge.md @@ -80,6 +80,27 @@ Do not use `--refuel` when the destination token is the destination chain's nati example, bridging ETH to Arbitrum ETH). The backend returns `NO_QUOTES` in that case. +## Compare quotes + +Use `--all-quotes` to see all available routes ranked by your preferred strategy: + +```bash +mm swap quote --from ETH --to USDC --amount 0.5 --from-chain 1 --all-quotes --strategy cost,speed +``` + +The recommended quote is marked with ★. Execute a specific quote by its ID: + +```bash +mm swap execute --quote-id +``` + +Available strategies: `cost`, `speed`, `impact`, `output`. The default is `cost,speed`. + +## Gasless swaps + +When your wallet's native balance cannot cover gas, the CLI automatically uses gasless execution +via the EIP-7702 relay for eligible quotes. No additional flags are required. + ## Common pitfalls :::caution Verify the quote step succeeded diff --git a/agent-wallet/quickstart.md b/agent-wallet/quickstart.md index 808101db672..8d2f3731a9d 100644 --- a/agent-wallet/quickstart.md +++ b/agent-wallet/quickstart.md @@ -1,5 +1,5 @@ --- -description: Install CLI v3, add agent skills, verify readiness with mm doctor, and complete browser sign-in and wallet setup. +description: Install the latest CLI, add agent skills, verify readiness with mm doctor, and complete browser sign-in and wallet setup. keywords: [MetaMask, Agent Wallet, quickstart, mm, mm doctor, skills, server-wallet] --- @@ -19,11 +19,15 @@ After setup, use natural language for day-to-day wallet operations. ## 1. Install the CLI ```bash npm2yarn -npm install -g @metamask/agentic-cli@3 +npm install -g @metamask/agentic-cli@latest ``` Run `mm doctor` after install to confirm the CLI version and skill compatibility. +:::note Node.js requirement +The CLI requires **Node.js 22.18** or later. +::: + ## 2. Add skills to your agent Skills teach your agent how to route natural-language requests to `mm` commands and follow safety @@ -35,8 +39,8 @@ npx skills add MetaMask/agent-skills When prompted, install `metamask-agent-wallet`. -Reinstall skills if you previously installed an older version (for example, v2.x). -The current skills target CLI v3.0.0. +Reinstall skills if you previously installed an older version. +The current skills target CLI v5.0.0. ## 3. Complete setup @@ -72,12 +76,15 @@ skills), then run `mm doctor` again. During `mm login`, choose **Dashboard (browser)** or **QR code (MetaMask Mobile)**. -- **Browser** (`mm login browser`): sign in through the MetaMask dashboard with Google or email. +- **Browser** (`mm login browser`): opens the MetaMask dashboard in your browser. After signing in + with Google or email, a CLI token is displayed that you paste back into the terminal. Use this method in production. - **QR code** (`mm login qr`): scan the QR code with MetaMask Mobile. QR sign-in is not available in production; the CLI returns `COMING_SOON` and you should use browser sign-in instead. +To use the legacy OTP pairing flow instead, pass `--otp-pair` to `mm login browser`. + Your sign-in method also determines how you receive 2-factor authentication approvals when a transaction needs your confirmation. diff --git a/agent-wallet/reference/architecture.md b/agent-wallet/reference/architecture.md index 575e1d07a27..5b69a91f16b 100644 --- a/agent-wallet/reference/architecture.md +++ b/agent-wallet/reference/architecture.md @@ -84,6 +84,18 @@ MetaMask's subscription that pairs Transaction Protection with priority support. See [Transaction Shield](https://support.metamask.io/manage-crypto/transactions/transaction-shield/) for subscription details, eligibility, coverage limits, and terms. +## Gasless execution + +For ERC-20 transfers and swaps where the wallet's native balance cannot cover gas, the CLI +automatically routes through a gasless relay using EIP-7702. The relay submits the transaction on +your behalf and deducts fees from the transferred ERC-20 token or a `--gas-token` you specify. + +## ERC-7821 batch execution + +On eligible chains and accounts, the CLI combines ERC-20 approval and trade into a single atomic +`execute()` call using ERC-7821. This reduces the number of transactions and avoids approval +front-running. The CLI falls back to sequential submission when batching is not available. + ## Smart Transactions [Smart Transactions](https://support.metamask.io/manage-crypto/transactions/smart-transactions/) diff --git a/agent-wallet/reference/commands.md b/agent-wallet/reference/commands.md index 1d465e07c76..3b32313c815 100644 --- a/agent-wallet/reference/commands.md +++ b/agent-wallet/reference/commands.md @@ -61,20 +61,24 @@ Policy is not included in `mm init show` output. Sign in to MetaMask Agent Wallet. ```bash -mm login [qr | browser] [--token ] [--timeout ] [--no-wait] +mm login [qr | browser] [--token ] [--timeout ] [--no-wait] [--otp-pair] mm login browser [--no-wait] mm login qr [--timeout ] ``` On a TTY, bare `mm login` shows a method picker (Dashboard and QR). Use `mm login browser` for Google or email sign-in through the MetaMask dashboard. +The default browser flow opens the dashboard and prompts you to paste a CLI token back into the +terminal. +Use `--otp-pair` for the legacy 6-digit OTP pairing flow. QR sign-in (`mm login qr`) is not available in production (`COMING_SOON`). -| Flag | Required | Description | -| ----------- | -------- | -------------------------------------------------------------------------------------- | -| `--token` | No | Pre-minted token as `cliToken:cliRefreshToken`. Environment variable: `MM_CLI_TOKEN` | -| `--timeout` | No | Seconds to wait for QR or browser callback | -| `--no-wait` | No | Print sign-in URL and exit. Use with `browser` in headless mode. Not supported with QR | +| Flag | Required | Description | +| ------------ | -------- | -------------------------------------------------------------------------------------- | +| `--token` | No | Pre-minted token as `cliToken:cliRefreshToken`. Environment variable: `MM_CLI_TOKEN` | +| `--timeout` | No | Seconds to wait for QR or browser callback | +| `--no-wait` | No | Print sign-in URL and exit. Use with `browser` in headless mode. Not supported with QR | +| `--otp-pair` | No | Use legacy 6-digit OTP pairing instead of the default paste-token flow | After you sign in successfully in server-wallet mode, the CLI syncs existing remote wallets from the server. @@ -94,6 +98,8 @@ Clear local session and wallet state files. ## `mm chains list` List supported EVM networks. No auth required. +The output includes a `features` field per chain (for example, `swap`, `predict`, `perps`) and a +`relaySupported` flag indicating gasless relay availability. ## `mm wallet` @@ -161,6 +167,8 @@ mm wallet trading-mode get Set the trading mode for the active server wallet. Prompts for confirmation when switching to Beast mode. +This command blocks until the mode change is approved via MetaMask Mobile or email (2FA). +Use `--no-wait` to return immediately after the approval is requested. ```bash mm wallet trading-mode set @@ -179,6 +187,8 @@ mm wallet policy get Set the policy for the active server wallet. Server-wallet mode only. +This command blocks until the policy change is approved via MetaMask Mobile or email (2FA). +Use `--no-wait` to return immediately after the approval is requested. ```bash mm wallet policy set --policy @@ -232,38 +242,47 @@ mm wallet password remove --current= ## `mm transfer` Send native currency or ERC-20 tokens on one EVM chain. +For ERC-20 transfers, the CLI automatically uses gasless relay when the wallet's native balance +cannot cover gas fees. ```bash -mm transfer --to
--amount --chain-id --token [--wait] +mm transfer --to
--amount --chain-id --token [--gas-token ] [--wait] ``` -| Flag | Required | Description | -| ------------ | -------- | ---------------------------------------- | -| `--to` | Yes | Recipient hex address. ENS not supported | -| `--amount` | Yes | Human-readable amount | -| `--chain-id` | Yes | EVM chain ID | -| `--token` | Yes | `native`, symbol, or ERC-20 address | -| `--wait` | No | Block until complete (server-wallet) | +| Flag | Required | Description | +| ------------- | -------- | ----------------------------------------------------- | +| `--to` | Yes | Recipient hex address. ENS not supported | +| `--amount` | Yes | Human-readable amount | +| `--chain-id` | Yes | EVM chain ID | +| `--token` | Yes | `native`, symbol, or ERC-20 address | +| `--gas-token` | No | Pay relay fees in an ERC-20 token (gasless transfers) | +| `--wait` | No | Block until complete (server-wallet) | ## `mm swap` ### `mm swap quote` ```bash -mm swap quote --from --to --amount --from-chain [--to-chain ] [--to-address
] [--slippage ] [--refuel] +mm swap quote --from --to --amount --from-chain [--to-chain ] [--to-address
] [--slippage ] [--refuel] [--all-quotes] [--strategy ] ``` -| Flag | Required | Description | -| -------------- | -------- | ------------------------------------------------------------------------------- | -| `--to-chain` | No | Destination chain ID. The default is `--from-chain` for same-chain swaps | -| `--to-address` | No | Recipient for bridged output tokens. Cross-chain only. The default is signer | -| `--slippage` | No | Maximum slippage as a percentage, 0–100 (default 0.5) | -| `--refuel` | No | Bundle destination native-gas top-up into a cross-chain quote. Cross-chain only | +| Flag | Required | Description | +| -------------- | -------- | --------------------------------------------------------------------------------------------- | +| `--to-chain` | No | Destination chain ID. The default is `--from-chain` for same-chain swaps | +| `--to-address` | No | Recipient for bridged output tokens. Cross-chain only. The default is signer | +| `--slippage` | No | Maximum slippage as a percentage, 0–100 (default 0.5) | +| `--refuel` | No | Bundle destination native-gas top-up into a cross-chain quote. Cross-chain only | +| `--all-quotes` | No | Show all ranked candidate quotes with the recommended quote marked (★) | +| `--strategy` | No | Comma-separated ranking strategy: `cost`, `speed`, `impact`, `output` (default: `cost,speed`) | `--refuel` is opt-in and cross-chain only. Do not use it when the destination token is the destination chain's native gas asset; the backend returns `NO_QUOTES`. +Quotes are streamed via SSE for faster response times. +Use `--all-quotes` to compare routes, then execute a specific one with `--quote-id`. +Old quote artifacts are automatically pruned after 24 hours. + ### `mm swap execute` ```bash @@ -274,27 +293,22 @@ mm swap execute --from --to --amount --from-chain [--tx-hash ] -``` +When the wallet's native balance cannot cover gas, the CLI uses **gasless execution** via the +EIP-7702 relay for gas-included quotes. -## `mm tx history` +The CLI runs an `INSUFFICIENT_FUNDS` preflight check before execution and returns actionable hints +if the source token balance is insufficient. -List recent transactions for the active wallet or specific addresses. +### `mm swap status` ```bash -mm tx history [--addresses ] [--chain ] [--type ] [--limit ] +mm swap status --quote-id [--tx-hash ] ``` -| Flag | Required | Description | -| ------------- | -------- | ------------------------------------------------------------------------- | -| `--addresses` | No | Comma-separated EVM addresses. The default is all EVM wallets for account | -| `--chain` | No | Comma-separated chain filters (for example, `1,137`) | -| `--type` | No | Filter by direction (`in`, `out`, `self`) or transaction category | -| `--limit` | No | Maximum transactions to return (1–500, default 50) | - ## `mm perps` @@ -395,6 +409,84 @@ mm decode <0x-calldata> | `mm token list search` | `--query [--chain ]` | | `mm token list top-gainer` | `--chain ` | +## `mm earn` + +Yield vault operations. Supply and withdraw from vaults across supported chains and protocols. + +| Command | Usage summary | +| ------------------- | ---------------------------------------------------------------------------- | +| `mm earn markets` | `[--chain ] [--protocol ] [--min-tvl ]` | +| `mm earn positions` | View current yield positions | +| `mm earn supply` | `--token --amount [--chain ] [--from-chain ]` | +| `mm earn withdraw` | `--token --amount [--chain ]` | + +### `mm earn markets` + +List available yield vaults with APY and TVL data. + +```bash +mm earn markets [--chain ] [--protocol ] [--min-tvl ] +``` + +### `mm earn positions` + +View your current yield vault positions. + +```bash +mm earn positions +``` + +### `mm earn supply` + +Supply tokens to a yield vault. The CLI handles ERC-20 approval automatically when the vault's +allowance is insufficient. + +```bash +mm earn supply --token --amount [--chain ] [--from-chain ] +``` + +Use `--from-chain` for cross-chain supply operations that bridge and supply in one step. + +### `mm earn withdraw` + +Withdraw tokens from a yield vault. + +```bash +mm earn withdraw --token --amount [--chain ] +``` + +Use `--amount all` to withdraw your full position. +Failed withdrawals are automatically retried (up to 3 attempts with backoff). + +## `mm config` + +Get or set CLI configuration values. + +```bash +mm config get +mm config set +``` + +## `mm tx` + +### `mm tx history` + +List recent transactions for the active wallet or specific addresses. + +```bash +mm tx history [--addresses ] [--chain ] [--type ] [--limit ] +``` + +### `mm tx get` + +Look up a specific transaction by hash. + +```bash +mm tx get +``` + +Returns `TX_NOT_FOUND` for unknown hashes and `INVALID_TX_HASH` for malformed input. + ## Help Every command supports `--help`: diff --git a/agent-wallet/reference/error-codes.md b/agent-wallet/reference/error-codes.md index 9ff69684956..d8575998694 100644 --- a/agent-wallet/reference/error-codes.md +++ b/agent-wallet/reference/error-codes.md @@ -24,6 +24,7 @@ Run `mm --help` for command-specific validation rules. | `INVALID_OTP` | Invalid one-time password | | `MWP_TIMEOUT` | Mobile Wallet Protocol timeout | | `MWP_CANCELLED` | Mobile Wallet Protocol cancelled (pairing aborted) | +| `PAIRING_CANCELLED` | Browser pairing cancelled by the user | | `LOGOUT_FAILED` | Sign-out operation failed (includes token revoke failures) | ## Validation errors (`ValidationError`) @@ -43,6 +44,9 @@ Run `mm --help` for command-specific validation rules. | `INVALID_MNEMONIC` | Bring your own wallet mnemonic is invalid | | `NOT_INITIALIZED` | Project not initialized; run `mm init` | | `INVALID_LIMIT` | Invalid `--limit` value for `mm tx history` (must be 1–500) | +| `INVALID_CONFIG_KEY` | Unknown CLI config key | +| `INVALID_NETWORK` | Unsupported or unknown network | +| `UNKNOWN_FLAG` | Unrecognized CLI flag | ## Wallet errors (`WalletError`) @@ -56,6 +60,8 @@ Run `mm --help` for command-specific validation rules. | `NO_AUTH_TOKEN` | Missing authentication token | | `NO_PROJECT_ID` | Project ID not configured | | `NO_HISTORY_WALLETS` | No EVM wallets found for `mm tx history` | +| `TX_NOT_FOUND` | Transaction hash not found onchain | +| `INVALID_TX_HASH` | Malformed transaction hash | ## Swap errors (`SwapCommandError`) @@ -68,6 +74,10 @@ Run `mm --help` for command-specific validation rules. | `NO_TRADE_DATA` | Selected quote has no trade transaction | | `EXECUTE_FAILED` | Swap execution failed | | `STATUS_UNAVAILABLE` | Swap status unavailable | +| `INSUFFICIENT_FUNDS` | Source token balance insufficient | +| `INSUFFICIENT_GAS` | Native balance cannot cover gas fees | +| `AMOUNT_TOO_LOW` | Swap amount below minimum threshold | +| `SLIPPAGE_TOO_HIGH` | Slippage exceeds acceptable range | | `SWAP_ERROR` | Generic swap error | ## Perpetuals errors @@ -90,6 +100,15 @@ Common Hyperliquid failures include `ORDER_REJECTED`, `DEPOSIT_FAILED`, `INSUFFI | `PREDICT_INSUFFICIENT_FUNDING_BALANCE` | Insufficient USDC.e for `mm predict deposit` | | `PREDICT_ERROR` | Generic predict error | +## Earn errors + +| Code | Meaning | +| --------------------------- | ----------------------------------------------------- | +| `EARN_VAULT_NOT_FOUND` | Yield vault not found for the specified token/chain | +| `EARN_INSUFFICIENT_BALANCE` | Insufficient balance for earn supply | +| `EARN_WITHDRAW_REVERTED` | Withdraw transaction reverted (retried automatically) | +| `EARN_ERROR` | Generic earn error | + ## Network errors | Code | Meaning | diff --git a/agent-wallet/reference/supported-chains.md b/agent-wallet/reference/supported-chains.md index f4c9bded7ca..04007922002 100644 --- a/agent-wallet/reference/supported-chains.md +++ b/agent-wallet/reference/supported-chains.md @@ -30,17 +30,28 @@ The tables below list every network from `mm chains list`. Availability varies by CLI version. Always confirm with `mm chains list` before scripting against a specific network. -| Network | Mainnet chain ID | Testnet | Testnet chain ID | -| ------------ | ---------------- | ---------------- | ---------------- | -| Arbitrum One | `42161` | Arbitrum Sepolia | `421614` | -| Avalanche | `43114` | Avalanche Fuji | `43113` | -| Base | `8453` | Base Sepolia | `84532` | -| BSC | `56` | BSC Testnet | `97` | -| Ethereum | `1` | Sepolia | `11155111` | -| Linea | `59144` | Linea Sepolia | `59141` | -| Optimism | `10` | Optimism Sepolia | `11155420` | -| Polygon | `137` | Polygon Amoy | `80002` | -| Celo | `42220` | | | +| Network | Mainnet chain ID | Testnet | Testnet chain ID | +| --------------- | ---------------- | ---------------- | ---------------- | +| Arbitrum One | `42161` | Arbitrum Sepolia | `421614` | +| Avalanche | `43114` | Avalanche Fuji | `43113` | +| Base | `8453` | Base Sepolia | `84532` | +| BSC | `56` | BSC Testnet | `97` | +| Ethereum | `1` | Sepolia | `11155111` | +| HyperEVM | `999` | | | +| Linea | `59144` | Linea Sepolia | `59141` | +| MegaETH | `4326` | | | +| Monad | `143` | | | +| Optimism | `10` | Optimism Sepolia | `11155420` | +| Polygon | `137` | Polygon Amoy | `80002` | +| Robinhood Chain | `4663` | | | +| Celo | `42220` | | | + +The `mm chains list` output includes a `features` field per chain indicating support for `swap`, +`predict`, `perps`, and other capabilities. Use `mm chains list --json` to inspect feature +availability programmatically. + +For chains not covered by the Accounts API, `mm wallet balance` falls back to direct RPC queries +via Multicall3. ## Per-chain balances diff --git a/agent-wallet/troubleshooting.md b/agent-wallet/troubleshooting.md index 037bcb0c0c6..b7729a92def 100644 --- a/agent-wallet/troubleshooting.md +++ b/agent-wallet/troubleshooting.md @@ -115,9 +115,32 @@ When bridging with `--refuel`, do not use the flag if the destination token is t chain's native gas asset (for example, bridging ETH to Arbitrum ETH). The backend returns no quotes in that case. +### `INSUFFICIENT_FUNDS` or `INSUFFICIENT_GAS` on swap execute + +The CLI runs a preflight check before execution. If the source token balance is insufficient, you +receive `INSUFFICIENT_FUNDS` with guidance on the required amount. If native gas balance is too low, +`INSUFFICIENT_GAS` is returned. Bridge or transfer the needed tokens before retrying. + +For gas-insufficient swaps, the CLI may offer a gasless route via the EIP-7702 relay when the quote +is gas-included. + ### Swap execute fails after a quote -Re-run `mm swap quote` and execute immediately. Quotes can expire. +Re-run `mm swap quote` and execute immediately. Quotes expire and are auto-pruned after 24 hours. + +## Earn + +### Withdraw reverts on full withdrawal + +For rebasing tokens (like Aave aTokens), interest accrues between the balance query and transaction +execution. The CLI applies a small dust buffer for `--all` withdrawals, but if the transaction still +reverts, it automatically retries up to 3 times. If retries fail, try withdrawing a slightly smaller +amount. + +### Approval required for supply + +When supplying for the first time, the CLI sends an ERC-20 approval transaction before the supply. +In server-wallet mode with Guard Mode, this may require 2FA approval. ## Transfers diff --git a/agent-wallet/use-the-cli-directly.md b/agent-wallet/use-the-cli-directly.md index a778e0b177f..01a7807911b 100644 --- a/agent-wallet/use-the-cli-directly.md +++ b/agent-wallet/use-the-cli-directly.md @@ -16,7 +16,7 @@ For day-to-day use, prefer [Quickstart](quickstart.md) and prompt your agent in ## 1. Install the CLI ```bash npm2yarn -npm install -g @metamask/agentic-cli@3 +npm install -g @metamask/agentic-cli@latest ``` ## 2. Sign in From 1b1d2f2feacbd2115a2ac0dbc8af58adf391e257 Mon Sep 17 00:00:00 2001 From: AyushBherwani1998 Date: Thu, 23 Jul 2026 14:13:11 +0530 Subject: [PATCH 2/2] minor fixes --- agent-wallet/guides/earn-yield-vaults.md | 4 ++-- agent-wallet/guides/swap-and-bridge.md | 2 +- agent-wallet/reference/commands.md | 4 ++-- agent-wallet/troubleshooting.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/agent-wallet/guides/earn-yield-vaults.md b/agent-wallet/guides/earn-yield-vaults.md index 424feae7387..c8dad8e97fb 100644 --- a/agent-wallet/guides/earn-yield-vaults.md +++ b/agent-wallet/guides/earn-yield-vaults.md @@ -1,5 +1,5 @@ --- -description: Supply and withdraw from yield vaults using mm earn commands. +description: Supply and withdraw from yield vaults using `mm earn` commands. keywords: [MetaMask, Agent Wallet, earn, yield, DeFi, vaults, mm] --- @@ -73,7 +73,7 @@ mm earn withdraw --token --amount [--chain ] ``` Use `--amount all` to withdraw your full position. -For Aave rebasing aTokens, `--all` applies a small dust buffer to avoid revert from interest +For Aave rebasing aTokens, `--amount all` applies a small dust buffer to avoid revert from interest accrual between the query and the transaction. ## Cross-chain supply diff --git a/agent-wallet/guides/swap-and-bridge.md b/agent-wallet/guides/swap-and-bridge.md index d72e8a75d74..bdd88b88db6 100644 --- a/agent-wallet/guides/swap-and-bridge.md +++ b/agent-wallet/guides/swap-and-bridge.md @@ -88,7 +88,7 @@ Use `--all-quotes` to see all available routes ranked by your preferred strategy mm swap quote --from ETH --to USDC --amount 0.5 --from-chain 1 --all-quotes --strategy cost,speed ``` -The recommended quote is marked with ★. Execute a specific quote by its ID: +A ★ marks the recommended quote. Execute a specific quote by its ID: ```bash mm swap execute --quote-id diff --git a/agent-wallet/reference/commands.md b/agent-wallet/reference/commands.md index 3b32313c815..dfa04f66465 100644 --- a/agent-wallet/reference/commands.md +++ b/agent-wallet/reference/commands.md @@ -279,7 +279,7 @@ mm swap quote --from --to --amount --from-chain --amount [--chain ] ``` Use `--amount all` to withdraw your full position. -Failed withdrawals are automatically retried (up to 3 attempts with backoff). +The CLI automatically retries failed withdrawals (up to 3 attempts with backoff). ## `mm config` diff --git a/agent-wallet/troubleshooting.md b/agent-wallet/troubleshooting.md index b7729a92def..a3edf2e74ac 100644 --- a/agent-wallet/troubleshooting.md +++ b/agent-wallet/troubleshooting.md @@ -117,9 +117,9 @@ The backend returns no quotes in that case. ### `INSUFFICIENT_FUNDS` or `INSUFFICIENT_GAS` on swap execute -The CLI runs a preflight check before execution. If the source token balance is insufficient, you +The CLI runs a preflight check before execution. If you don't have enough of the source token, you receive `INSUFFICIENT_FUNDS` with guidance on the required amount. If native gas balance is too low, -`INSUFFICIENT_GAS` is returned. Bridge or transfer the needed tokens before retrying. +the CLI returns `INSUFFICIENT_GAS`. Bridge or transfer the needed tokens before retrying. For gas-insufficient swaps, the CLI may offer a gasless route via the EIP-7702 relay when the quote is gas-included. @@ -133,7 +133,7 @@ Re-run `mm swap quote` and execute immediately. Quotes expire and are auto-prune ### Withdraw reverts on full withdrawal For rebasing tokens (like Aave aTokens), interest accrues between the balance query and transaction -execution. The CLI applies a small dust buffer for `--all` withdrawals, but if the transaction still +execution. The CLI applies a small dust buffer for `--amount all` withdrawals, but if the transaction still reverts, it automatically retries up to 3 times. If retries fail, try withdrawing a slightly smaller amount.