Skip to content

Commit 9290a6b

Browse files
Merge branch 'main' into feat/aave
2 parents b205a42 + 22ebad2 commit 9290a6b

33 files changed

Lines changed: 896 additions & 422 deletions

skills/metamask-agent-wallet/SKILL.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Match the user's intent to a command and reference file, then read the reference
4242
| Show active wallet details | `mm wallet show` | [wallet.md](references/wallet.md) |
4343
| Show active wallet address | `mm wallet address` | [wallet.md](references/wallet.md) |
4444
| Check the active wallet balance | `mm wallet balance` | [wallet.md](references/wallet.md) |
45+
| Show current trading mode and policies | `mm wallet trading-mode get` | [wallet.md](references/wallet.md) |
46+
| Set trading mode (guard or beast) | `mm wallet trading-mode set` | [wallet.md](references/wallet.md) |
4547
| Sign a plaintext message | `mm wallet sign-message` | [signing.md](references/signing.md) |
4648
| Sign EIP-712 typed data | `mm wallet sign-typed-data` | [signing.md](references/signing.md) |
4749
| Send a raw EVM transaction | `mm wallet send-transaction` | [transaction.md](references/transaction.md) |
@@ -69,7 +71,7 @@ Match the user's intent to a command and reference file, then read the reference
6971
| One-time Predict setup | `mm predict setup` | [predict.md](references/predict.md) |
7072
| Create or refresh Predict credentials | `mm predict auth` | [predict.md](references/predict.md) |
7173
| Repair Predict approvals | `mm predict approve` | [predict.md](references/predict.md) |
72-
| Check Predict back-end status | `mm predict status` | [predict.md](references/predict.md) |
74+
| Check Predict back-end status and account setup | `mm predict status` | [predict.md](references/predict.md) |
7375
| Check if Polymarket is geoblocked for your IP | `mm predict geoblock` | [predict.md](references/predict.md) |
7476
| List prediction markets | `mm predict markets list` | [predict.md](references/predict.md) |
7577
| Search prediction markets | `mm predict markets search` | [predict.md](references/predict.md) |
@@ -112,7 +114,12 @@ CLI behavior lives in `references/`. Repeatable patterns live in `workflows/`. L
112114
| Open a perpetual position flow | [perps-open-position.md](workflows/perps-open-position.md) |
113115
| Close a perpetual position flow | [perps-close-position.md](workflows/perps-close-position.md) |
114116
| Modify a perpetual position flow | [perps-modify-position.md](workflows/perps-modify-position.md) |
115-
| Predict setup-fund-quote-place flow | [predict-trading.md](workflows/predict-trading.md) |
117+
| Predict first-time setup and credentials | [predict-setup.md](workflows/predict-setup.md) |
118+
| Deposit or withdraw pUSD from Predict wallet | [predict-funding.md](workflows/predict-funding.md) |
119+
| Search and browse prediction markets | [predict-markets.md](workflows/predict-markets.md) |
120+
| Quote and place a prediction order | [predict-place-order.md](workflows/predict-place-order.md) |
121+
| View or cancel Predict orders and positions | [predict-manage-orders.md](workflows/predict-manage-orders.md) |
122+
| View Predict portfolio and redeem winnings | [predict-portfolio.md](workflows/predict-portfolio.md) |
116123
| Token discovery, prices, and market data | [market-data.md](workflows/market-data.md) |
117124
| Supply assets to Aave V3 | [aave-supply.md](workflows/aave-supply.md) |
118125
| Withdraw assets from Aave V3 | [aave-withdraw.md](workflows/aave-withdraw.md) |
@@ -194,6 +201,7 @@ Before constructing any command, validate all user-provided values:
194201
| `--side` (predict) | Must be `buy` or `sell` |
195202
| `--slippage` | Must be a number between 0 and 100 |
196203
| `--from-chain`, `--to-chain` | Must be a positive integer EVM chain ID |
204+
| `--to-address` | Must match `^0x[0-9a-fA-F]{40}$`. Only valid for cross-chain swaps (`--to-chain` differs from `--from-chain`); rejected for same-chain swaps |
197205
| `--password` | Must be a non-empty string. Never log, display, or store the value. |
198206

199207
Do not pass unvalidated user input into any command.
@@ -206,7 +214,7 @@ Do not pass unvalidated user input into any command.
206214
| Raw transactions | Always confirm transaction payload, chain, recipient, value, and calldata summary before executing |
207215
| Message signing | Always show exact message and chain before signing |
208216
| Typed-data signing | Always show domain, primary type, chain, verifying contract, and message summary before signing |
209-
| Swaps / bridges | Always confirm from/to tokens, amount, source/destination chain, slippage, and quoted output before executing |
217+
| Swaps / bridges | Always confirm from/to tokens, amount, source/destination chain, slippage, quoted output, and recipient address (if `--to-address` is set) before executing |
210218
| Perps trading | Always confirm symbol, side, size, leverage, venue, order type, and limit price if present before executing |
211219
| Perps deposit/withdraw | Always confirm amount, asset, venue, network, and destination where applicable before executing |
212220
| Predict trading | Always confirm token ID, side, size, price, order type, market, and outcome before executing |

skills/metamask-agent-wallet/references/decode.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ Decode hex-encoded EVM calldata into its function name, parameters, and a plain-
1212
mm decode --payload <0x-calldata> [--toon]
1313
```
1414

15-
The payload can also be passed positionally: `mm decode <0x-calldata>`.
16-
1715
### Supported Flags
1816

1917
| Name | Required | Description |
2018
| --- | --- | --- |
21-
| `--payload` | Yes | Hex-encoded EVM calldata to decode (e.g. `0x095ea7b3...`). Positional index 0 |
19+
| `--payload` | Yes | Hex-encoded EVM calldata to decode (e.g. `0x095ea7b3...`). |
2220

2321
### Output
2422

@@ -31,8 +29,7 @@ The payload can also be passed positionally: `mm decode <0x-calldata>`.
3129
### Example
3230

3331
```bash
34-
mm decode --payload 0x095ea7b3000000000000000000000000...
35-
mm decode 0x095ea7b3000000000000000000000000... --toon
32+
mm decode --payload 0x095ea7b3000000000000000000000000... --toon
3633
```
3734

3835
## Notes

skills/metamask-agent-wallet/references/errors.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ This reference lists error codes the CLI actually emits. SDK-only or remapped co
6666
| `NO_AUTH_TOKEN` | Missing authentication token for wallet operations |
6767
| `NO_PROJECT_ID` | Project ID not configured for wallet |
6868
| `MISSING_PROJECT_ID` | Project ID is not configured |
69+
| `INVALID_TRADING_MODE` | Invalid trading mode; use `guard` or `beast` |
70+
| `ALREADY_SET_TRADING_MODE` | Trading mode is already set to the requested value |
6971

7072
## Command Errors
7173

skills/metamask-agent-wallet/references/predict.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ mm predict approve --wait
9292

9393
## `predict status` Command
9494

95-
Probe Predict back-end reachability (Gamma + CLOB).
95+
Probe Predict back-end reachability (Gamma + CLOB) and report account setup status: deposit wallet address, on-chain deployment, stored CLOB credentials, and a `setupComplete` flag.
9696

9797
### Syntax
9898

skills/metamask-agent-wallet/references/swap.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Get a swap or bridge quote showing expected output, fees, and route.
99
### Syntax
1010

1111
```bash
12-
mm swap quote --from <token> --to <token> --amount <amount> --from-chain <chain-id> [--to-chain <chain-id>] [--slippage <percent>]
12+
mm swap quote --from <token> --to <token> --amount <amount> --from-chain <chain-id> [--to-chain <chain-id>] [--to-address <address>] [--slippage <percent>]
1313
```
1414

1515
### Supported Flags
@@ -20,7 +20,8 @@ mm swap quote --from <token> --to <token> --amount <amount> --from-chain <chain-
2020
| `--to` | Yes | Destination token symbol (e.g. USDC, USDT) |
2121
| `--amount` | Yes | Human-readable amount to swap (e.g. 0.5, 100) |
2222
| `--from-chain` | Yes | Source EVM chain ID (e.g. 1 for Ethereum, 137 for Polygon) |
23-
| `--to-chain` | No | Destination EVM chain ID; defaults to `--from-chain` for same-chain swaps |
23+
| `--to-chain` | No | Destination EVM chain ID. Defaults to `--from-chain` for same-chain swaps |
24+
| `--to-address` | No | Recipient address for bridged output tokens. Only valid for cross-chain swaps. Defaults to the signer's wallet |
2425
| `--slippage` | No | Maximum slippage as a percentage, 0-100 (defaults to 0.5) |
2526

2627
### Example
@@ -30,6 +31,7 @@ mm swap quote --from ETH --to USDC --amount 0.5 --from-chain 1
3031
mm swap quote --from USDC --to USDT --amount 100 --from-chain 137
3132
mm swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137
3233
mm swap quote --from ETH --to USDC --amount 0.5 --from-chain 1 --slippage 1
34+
mm swap quote --from ETH --to pUSD --amount 0.5 --from-chain 1 --to-chain 137 --to-address 0x742d...f2bD18
3335
```
3436

3537
## `swap execute` Command
@@ -40,7 +42,7 @@ Execute a swap or bridge, either by referencing a previous quote ID or by provid
4042

4143
```bash
4244
mm swap execute --quote-id <id> [--password <password>]
43-
mm swap execute --from <token> --to <token> --amount <amount> --from-chain <chain-id> [--to-chain <chain-id>] [--slippage <percent>] [--password <password>]
45+
mm swap execute --from <token> --to <token> --amount <amount> --from-chain <chain-id> [--to-chain <chain-id>] [--to-address <address>] [--slippage <percent>] [--password <password>]
4446
```
4547

4648
### Supported Flags
@@ -52,7 +54,8 @@ mm swap execute --from <token> --to <token> --amount <amount> --from-chain <chai
5254
| `--to` | Yes (unless `--quote-id`) | Destination token symbol |
5355
| `--amount` | Yes (unless `--quote-id`) | Amount to swap |
5456
| `--from-chain` | Yes (unless `--quote-id`) | Source EVM chain ID |
55-
| `--to-chain` | No | Destination EVM chain ID; defaults to `--from-chain` for same-chain swaps |
57+
| `--to-chain` | No | Destination EVM chain ID. Defaults to `--from-chain` for same-chain swaps |
58+
| `--to-address` | No | Recipient address for bridged output tokens. Only valid for cross-chain swaps. Defaults to the signer's wallet. Persisted quotes retain the recipient for `--quote-id` execution |
5659
| `--slippage` | No | Maximum slippage as a percentage, 0-100 (defaults to 0.5) |
5760
| `--password` | No | Password to unlock the BYOK mnemonic (BYOK mode only) [env: `MM_PASSWORD`] |
5861

@@ -84,7 +87,7 @@ mm swap status --quote-id <id> [--tx-hash <hash>]
8487
| Name | Required | Description |
8588
| --- | --- | --- |
8689
| `--quote-id` | Yes | Quote ID returned by `mm swap quote` |
87-
| `--tx-hash` | No | Source transaction hash; overrides the stored hash from execute |
90+
| `--tx-hash` | No | Source transaction hash. Overrides the stored hash from execute |
8891

8992
### Example
9093

skills/metamask-agent-wallet/references/wallet.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mm wallet create [--chain-namespace <namespace>] [--name <name>] [--trading-mode
1818
| --- | --- | --- |
1919
| `--chain-namespace` | No | Wallet chain namespace: `evm` (EIP-155) (allowed: `evm`) |
2020
| `--name` | No | Display name for the wallet |
21-
| `--trading-mode` | No | Trading mode for server wallets: `guard` (enforces outflow/whitelist policies) or `beast` (skips policy checks). Only applies to server-wallet mode (allowed: `guard`, `beast`) |
21+
| `--trading-mode` | No | `guard` enforces outflow/whitelist policies and blocks malicious transactions. `beast` skips policy checks but still blocks malicious transactions. Only applies to server-wallet mode (allowed: `guard`, `beast`) |
2222
| `--password` | No | Password to unlock the BYOK mnemonic (BYOK mode only) [env: `MM_PASSWORD`] |
2323

2424
### Example
@@ -127,6 +127,45 @@ mm wallet address
127127
mm wallet address --chain-namespace evm
128128
```
129129
130+
## `wallet trading-mode get` Command
131+
132+
Show the current trading mode, active server-wallet address, and policies for the selected wallet. Server-wallet mode only.
133+
134+
### Syntax
135+
136+
```bash
137+
mm wallet trading-mode get
138+
```
139+
140+
### Example
141+
142+
```bash
143+
mm wallet trading-mode get
144+
```
145+
146+
## `wallet trading-mode set` Command
147+
148+
Set the trading mode for the active server wallet. Prompts for confirmation when switching to Beast mode. Rejects if the mode is already set or the session isn't in server-wallet mode.
149+
150+
### Syntax
151+
152+
```bash
153+
mm wallet trading-mode set <guard|beast>
154+
```
155+
156+
### Supported Flags
157+
158+
| Name | Required | Description |
159+
| --- | --- | --- |
160+
| `<mode>` | Yes | `guard` enforces outflow/whitelist policies and blocks malicious transactions. `beast` skips policy checks but still blocks malicious transactions |
161+
162+
### Example
163+
164+
```bash
165+
mm wallet trading-mode set guard
166+
mm wallet trading-mode set beast
167+
```
168+
130169
## `wallet balance` Command
131170
132171
Show native and token balances for the active wallet.

skills/metamask-agent-wallet/workflows/bridge.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Bridge Workflow
1+
# Bridge workflow
22

33
Use this workflow when the user wants to bridge tokens across chains.
44

@@ -10,7 +10,7 @@ Reference command syntax in `references/swap.md`. The CLI uses the same `swap` c
1010
2. Confirm with the user.
1111
3. Execute and track status.
1212

13-
Do not skip the quote review step. It is where the user sees output amount, fees, route, and slippage.
13+
Don't skip the quote review step. The user needs to see output amount, fees, route, and slippage before executing.
1414

1515
## Quote
1616

@@ -20,8 +20,14 @@ mm swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137 --sl
2020

2121
Required flags: `--from`, `--to`, `--amount`, `--from-chain`, and `--to-chain`.
2222

23+
If the user wants the bridged tokens sent to a different wallet on the destination chain, add `--to-address`:
24+
25+
```bash
26+
mm swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137 --to-address 0x742d...f2bD18
27+
```
28+
2329
Persist the quote id for execution. Show the quote to the user before execution.
24-
Confirm source token, destination token, amount, source chain, destination chain, slippage, expected output, fees, and route.
30+
Confirm source token, destination token, amount, source chain, destination chain, slippage, expected output, fees, route, and recipient address (if `--to-address` was set).
2531

2632
## Execute
2733

@@ -40,7 +46,7 @@ mm swap status --quote-id "QUOTE_ID" --tx-hash 0xabc123
4046

4147
Use status polling for bridges where the destination side can lag behind the source transaction.
4248

43-
## Edge Cases
49+
## Edge cases
4450

4551
- Quote expired: re-quote and ask the user to review the new quote.
4652
- Insufficient balance: surface the error verbatim.

skills/metamask-agent-wallet/workflows/login.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ Reference command syntax in `references/auth.md`.
66

77
## Flow
88

9-
1. Confirm the target environment with `mm config get env` (set with `mm config set env` before login if not `prod`).
10-
2. Ask the user which login method they want: MetaMask Mobile QR, Google, or Email.
11-
3. Execute login.
12-
4. Verify with token.
9+
1. Ask the user which login method they want: MetaMask Mobile QR, Google, or Email.
10+
2. Execute login.
11+
3. Verify with token.
1312

1413
## Login
1514

skills/metamask-agent-wallet/workflows/onboarding.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ Reference command syntax in `references/auth.md` and `references/wallet.md`.
77
## Flow
88

99
1. Check CLI installation.
10-
2. Configure environment (if not using production).
11-
3. Login.
12-
4. Initialize wallet mode.
13-
5. Verify auth status.
14-
6. Show wallet address.
10+
2. Login.
11+
3. Initialize wallet mode.
12+
4. Verify auth status.
13+
5. Show wallet address.
1514

1615
## Check CLI Installation
1716

@@ -23,19 +22,6 @@ If this fails, the CLI is not installed. Guide the user to install it with `npm
2322

2423
Then run the version compatibility check from the skill `Preflight` section: compare the installed `major.minor` against the pinned `cliVersion` and the latest published release, and warn the user if they are out of sync.
2524

26-
## Configure Environment
27-
28-
Production (`prod`) is the default. Set the target environment **before** login if the user needs dev or uat:
29-
30-
```bash
31-
mm config get env
32-
mm config set env dev
33-
```
34-
35-
For a one-off override without persisting, use `MM_ENV=dev mm login` (or `uat`).
36-
37-
To switch environments, run `mm config set env <prod|dev|uat>`.
38-
3925
## Login Flow
4026

4127
Ask the user which login method they want to use: MetaMask Mobile QR, Google, or Email. QR (`mm login qr`) is available on non-production builds (dev/uat); on production it returns `COMING_SOON`, so fall back to Google or email there.

skills/metamask-agent-wallet/workflows/perps-open-position.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Perps Open Position Workflow
1+
# Perps open position workflow
22

33
Use this workflow when the user wants to open a new perpetual position.
44

@@ -11,29 +11,63 @@ Reference command syntax in `references/perps.md`.
1111
3. Dry run.
1212
4. Confirm with the user and open.
1313

14-
## Confirm Symbol
14+
## Confirm symbol
1515

16-
If the user does not mention a token symbol, list available markets and confirm with the user:
16+
If the user doesn't mention a token symbol, list available markets and confirm with the user:
1717

1818
```bash
1919
mm perps markets
2020
```
2121

22-
## Check Balance
22+
## Check balance
2323

24-
`--venue` defaults to `hyperliquid`. It can be omitted.
24+
`--venue` defaults to `hyperliquid`. You can omit it.
2525

2626
```bash
2727
mm perps balance
2828
```
2929

3030
If available margin is zero or insufficient, deposit USDC before proceeding. Hyperliquid only supports deposits from Arbitrum mainnet (`eip155:42161`).
3131

32+
Check the user's Arbitrum balance for USDC and ETH (for gas).
33+
34+
```bash
35+
mm wallet balance --chain 42161
36+
```
37+
38+
### No ETH and no USDC on Arbitrum
39+
40+
Inform the user that ETH on Arbitrum is required for gas. Without ETH, no on-chain transaction is possible. Bridge from another chain.
41+
42+
```bash
43+
mm swap quote --from <TOKEN> --to ETH --amount 0.001 --from-chain <SOURCE_CHAIN_ID> --to-chain 42161
44+
mm swap execute --quote-id "$QUOTE_ID" # quote ID from the swap quote command
45+
```
46+
47+
Once the user has ETH for gas, swap or bridge to get USDC on Arbitrum.
48+
49+
```bash
50+
mm swap quote --from <TOKEN> --to USDC --amount <AMOUNT> --from-chain <SOURCE_CHAIN_ID> --to-chain 42161
51+
mm swap execute --quote-id "$QUOTE_ID" # quote ID from the swap quote command
52+
```
53+
54+
### Has ETH or another token on Arbitrum (but no USDC)
55+
56+
Swap to USDC on Arbitrum.
57+
58+
```bash
59+
mm swap quote --from <TOKEN> --to USDC --amount <AMOUNT> --from-chain 42161
60+
mm swap execute --quote-id "$QUOTE_ID" # quote ID from the swap quote command
61+
```
62+
63+
### Has ETH and USDC on Arbitrum
64+
65+
Deposit USDC directly into Hyperliquid.
66+
3267
```bash
33-
mm perps deposit --amount <amount> --asset USDC
68+
mm perps deposit --amount <AMOUNT> --asset USDC
3469
```
3570

36-
To confirm a deposit, wait briefly and poll `mm perps balance`.
3771

3872
## Quote
3973

@@ -45,7 +79,7 @@ mm perps quote --symbol BTC --side long --size 0.01 --leverage 5
4579

4680
Show the user estimated entry, notional, fees, liquidation price, side, size, leverage, and venue before proceeding.
4781

48-
## Dry Run
82+
## Dry run
4983

5084
Preview the order before signing:
5185

@@ -65,4 +99,4 @@ Remove `--dry-run` only after explicit user confirmation:
6599
mm perps open --symbol BTC --side long --size 0.01 --leverage 5
66100
```
67101

68-
Do not add `--yes` unless the user explicitly asked for unattended execution.
102+
Don't add `--yes` unless the user explicitly asked for unattended execution.

0 commit comments

Comments
 (0)