@moonpay/cli 0.5.2 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: moonpay-block-explorer
3
+ description: Open transactions, wallets, and tokens in the correct block explorer. Use after swaps, bridges, or transfers to view results in the browser.
4
+ tags: [explorer]
5
+ ---
6
+
7
+ # Block explorer
8
+
9
+ ## Goal
10
+
11
+ After any swap, bridge, or transfer, open the result in the correct block explorer. Also useful for viewing wallet addresses and token contract pages.
12
+
13
+ ## Explorer URLs
14
+
15
+ | Chain | Transaction | Wallet | Token |
16
+ |-------|------------|--------|-------|
17
+ | solana | `https://solscan.io/tx/{sig}` | `https://solscan.io/account/{addr}` | `https://solscan.io/token/{addr}` |
18
+ | ethereum | `https://etherscan.io/tx/{hash}` | `https://etherscan.io/address/{addr}` | `https://etherscan.io/token/{addr}` |
19
+ | base | `https://basescan.org/tx/{hash}` | `https://basescan.org/address/{addr}` | `https://basescan.org/token/{addr}` |
20
+ | polygon | `https://polygonscan.com/tx/{hash}` | `https://polygonscan.com/address/{addr}` | `https://polygonscan.com/token/{addr}` |
21
+ | arbitrum | `https://arbiscan.io/tx/{hash}` | `https://arbiscan.io/address/{addr}` | `https://arbiscan.io/token/{addr}` |
22
+ | optimism | `https://optimistic.etherscan.io/tx/{hash}` | `https://optimistic.etherscan.io/address/{addr}` | `https://optimistic.etherscan.io/token/{addr}` |
23
+ | bnb | `https://bscscan.com/tx/{hash}` | `https://bscscan.com/address/{addr}` | `https://bscscan.com/token/{addr}` |
24
+ | avalanche | `https://snowscan.xyz/tx/{hash}` | `https://snowscan.xyz/address/{addr}` | `https://snowscan.xyz/token/{addr}` |
25
+ | bitcoin | `https://mempool.space/tx/{txid}` | `https://mempool.space/address/{addr}` | — |
26
+
27
+ ## Open a transaction
28
+
29
+ After a swap or bridge, extract the chain and tx hash, then open:
30
+
31
+ ```bash
32
+ # macOS
33
+ open "https://solscan.io/tx/5rQ52JVb6q7H..."
34
+
35
+ # Linux
36
+ xdg-open "https://etherscan.io/tx/0xabcd..."
37
+ ```
38
+
39
+ ### From swap/bridge output
40
+
41
+ `mp token swap` and `mp token bridge` return a result with the transaction signature. Use the chain to pick the correct explorer.
42
+
43
+ ```bash
44
+ RESULT=$(mp -f compact token swap --wallet main --chain solana \
45
+ --from-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
46
+ --from-amount 1 \
47
+ --to-token So11111111111111111111111111111111111111111)
48
+
49
+ # Open in browser
50
+ SIG=$(echo "$RESULT" | jq -r '.signature')
51
+ open "https://solscan.io/tx/$SIG"
52
+ ```
53
+
54
+ ### From transaction list
55
+
56
+ `mp transaction list` returns transactions with `from.txHash` and `to.txHash`. Use the chain field to pick the explorer:
57
+
58
+ ```bash
59
+ # View most recent transaction
60
+ TX=$(mp -f compact transaction list --wallet <addr> | jq -r '.items[0].from.txHash')
61
+ CHAIN=$(mp -f compact transaction list --wallet <addr> | jq -r '.items[0].from.chain')
62
+ # Build URL from chain → explorer table above
63
+ ```
64
+
65
+ ## Open a wallet
66
+
67
+ View all on-chain activity for a wallet address:
68
+
69
+ ```bash
70
+ # Solana wallet
71
+ open "https://solscan.io/account/N39jn2g1tA7dmdyyoHt9yiQegQoVhnfQzq1ZzuZRF9e"
72
+
73
+ # EVM wallet (same address works on any EVM explorer)
74
+ open "https://etherscan.io/address/0xf9e39F70d7636902e57a89C18B1BE39EBb5b9589"
75
+ ```
76
+
77
+ Get wallet addresses from: `mp wallet list` or `mp wallet retrieve --wallet <name>`
78
+
79
+ ## Open a token page
80
+
81
+ View token contract, holders, and market data on the explorer:
82
+
83
+ ```bash
84
+ # USDC on Solana
85
+ open "https://solscan.io/token/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
86
+
87
+ # USDC on Ethereum
88
+ open "https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
89
+ ```
90
+
91
+ Get token addresses from: `mp token search --query "USDC" --chain solana`
92
+
93
+ ## Open a checkout URL
94
+
95
+ `mp buy` returns a checkout URL. Open it directly:
96
+
97
+ ```bash
98
+ URL=$(mp -f compact buy --token sol --amount 1 --wallet <addr> --email <email> | jq -r '.url')
99
+ open "$URL"
100
+ ```
101
+
102
+ ## Platform detection
103
+
104
+ ```bash
105
+ if [[ "$OSTYPE" == "darwin"* ]]; then
106
+ open "$URL"
107
+ else
108
+ xdg-open "$URL"
109
+ fi
110
+ ```
111
+
112
+ ## Tips
113
+
114
+ - After any swap, bridge, or transfer, offer to open the result in the explorer
115
+ - EVM wallets share one address across all EVM chains — the same address works on etherscan, basescan, polygonscan, etc.
116
+ - Bitcoin uses `mempool.space` — no token pages, just transactions and addresses
117
+ - Solana signatures are base58 strings, EVM tx hashes start with `0x`
118
+
119
+ ## Related skills
120
+
121
+ - **moonpay-swap-tokens** — Swap and bridge commands that produce transaction signatures
122
+ - **moonpay-buy-crypto** — Buy commands that return checkout URLs
123
+ - **moonpay-check-wallet** — Get wallet addresses to view on explorers
@@ -22,7 +22,7 @@ mp buy \
22
22
 
23
23
  ## Supported tokens
24
24
 
25
- `sol`, `usdc_sol`, `eth`, `usdc`, `usdc_base`, `usdc_arbitrum`, `usdc_optimism`, `usdc_polygon`, `eth_polygon`, `eth_optimism`, `eth_base`, `eth_arbitrum`
25
+ `btc`, `sol`, `eth`, `trx`, `pol_polygon`, `usdc`, `usdc_sol`, `usdc_base`, `usdc_arbitrum`, `usdc_optimism`, `usdc_polygon`, `usdt_trx`, `eth_polygon`, `eth_optimism`, `eth_base`, `eth_arbitrum`
26
26
 
27
27
  ## Example flow
28
28
 
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: moonpay-export-data
3
+ description: Export portfolio balances and transaction history to CSV or JSON files. Use for spreadsheets, tax reporting, or record-keeping.
4
+ tags: [portfolio, export]
5
+ ---
6
+
7
+ # Export data
8
+
9
+ ## Goal
10
+
11
+ Save portfolio snapshots and transaction history to CSV or JSON files using `mp` output piped through `jq`. Useful for spreadsheets, tax reporting, and record-keeping.
12
+
13
+ ## Prerequisites
14
+
15
+ - `jq` installed: `which jq`
16
+ - Default output directory: `~/Documents/moonpay/` (create if needed)
17
+
18
+ ## Portfolio to CSV
19
+
20
+ Export all token balances for a wallet on a specific chain:
21
+
22
+ ```bash
23
+ mkdir -p ~/Documents/moonpay
24
+
25
+ # Header + data
26
+ echo "symbol,name,amount,usd_value,price" > ~/Documents/moonpay/portfolio-$(date +%Y%m%d).csv
27
+
28
+ mp -f compact token balance list --wallet <address> --chain solana \
29
+ | jq -r '.items[] | [.symbol, .name, .balance.amount, .balance.value, .balance.price] | @csv' \
30
+ >> ~/Documents/moonpay/portfolio-$(date +%Y%m%d).csv
31
+ ```
32
+
33
+ ### Multi-chain portfolio
34
+
35
+ Loop over chains and append to one file:
36
+
37
+ ```bash
38
+ FILE=~/Documents/moonpay/portfolio-$(date +%Y%m%d).csv
39
+ echo "chain,symbol,name,amount,usd_value,price" > "$FILE"
40
+
41
+ for CHAIN in solana ethereum base polygon arbitrum; do
42
+ mp -f compact token balance list --wallet <address> --chain "$CHAIN" \
43
+ | jq -r --arg chain "$CHAIN" '.items[] | [$chain, .symbol, .name, .balance.amount, .balance.value, .balance.price] | @csv' \
44
+ >> "$FILE" 2>/dev/null
45
+ done
46
+ ```
47
+
48
+ Note: EVM wallets share one address across all EVM chains. Solana uses a different address.
49
+
50
+ ## Transaction history to CSV
51
+
52
+ Export swap and bridge history. These are transactions executed via the CLI and registered with swaps.xyz — not all on-chain activity.
53
+
54
+ ```bash
55
+ echo "date,type,from_chain,from_token,from_amount,to_chain,to_token,to_amount,usd,status" \
56
+ > ~/Documents/moonpay/transactions-$(date +%Y%m%d).csv
57
+
58
+ mp -f compact transaction list --wallet <address> \
59
+ | jq -r '.items[] | [
60
+ .transactionId,
61
+ .type,
62
+ .from.chain, .from.token, .from.amount,
63
+ .to.chain, .to.token, .to.amount,
64
+ .usd,
65
+ .status
66
+ ] | @csv' \
67
+ >> ~/Documents/moonpay/transactions-$(date +%Y%m%d).csv
68
+ ```
69
+
70
+ ### Filter by chain
71
+
72
+ ```bash
73
+ mp -f compact transaction list --wallet <address> --chain solana \
74
+ | jq -r '.items[] | ...' >> transactions.csv
75
+ ```
76
+
77
+ ## Portfolio to JSON
78
+
79
+ For structured data or programmatic use:
80
+
81
+ ```bash
82
+ mp -f compact token balance list --wallet <address> --chain solana \
83
+ | jq '.items | map({symbol, amount: .balance.amount, usd: .balance.value})' \
84
+ > ~/Documents/moonpay/portfolio-$(date +%Y%m%d).json
85
+ ```
86
+
87
+ ## Open exported file
88
+
89
+ After writing the file, open it in the default app:
90
+
91
+ ```bash
92
+ # macOS — opens in Numbers/Excel
93
+ open ~/Documents/moonpay/portfolio-$(date +%Y%m%d).csv
94
+
95
+ # Linux
96
+ xdg-open ~/Documents/moonpay/portfolio-$(date +%Y%m%d).csv
97
+ ```
98
+
99
+ ## Tips
100
+
101
+ - `jq @csv` handles proper CSV escaping (quotes, commas in values)
102
+ - Date-stamp filenames to keep a history: `portfolio-20260222.csv`
103
+ - `mp transaction list` only includes CLI-executed swaps/bridges registered via swaps.xyz, not all on-chain transactions
104
+ - For a quick summary without exporting, use `mp token balance list --wallet <addr> --chain <chain>` directly
105
+ - EVM address is the same across ethereum, base, polygon, arbitrum, optimism, bnb, avalanche
106
+
107
+ ## Related skills
108
+
109
+ - **moonpay-check-wallet** — View balances interactively
110
+ - **moonpay-block-explorer** — Open exported transactions in block explorers
111
+ - **moonpay-trading-automation** — Combine with scheduled exports for daily snapshots
@@ -14,7 +14,8 @@ Configure the MoonPay CLI as an MCP server so Claude Desktop, Claude Code, or an
14
14
 
15
15
  ```bash
16
16
  npm i -g @moonpay/cli
17
- mp login
17
+ mp login --email user@example.com
18
+ mp verify --email user@example.com --code <code>
18
19
  ```
19
20
 
20
21
  ## Claude Code setup
@@ -56,7 +57,7 @@ After setup, ask Claude: "What MoonPay tools do you have?" — it should list al
56
57
 
57
58
  ## Auth
58
59
 
59
- The MCP server uses the same credentials as the CLI (`~/.config/moonpay/credentials.json`). Run `mp login` to authenticate.
60
+ The MCP server uses the same credentials as the CLI (`~/.config/moonpay/credentials.json`). Run `mp login --email <email>` then `mp verify --email <email> --code <code>` to authenticate.
60
61
 
61
62
  ## Related skills
62
63
 
@@ -51,7 +51,7 @@ If the wallet already has POL and USDC.e, they're set.
51
51
  Buy POL directly with fiat — easiest way to get gas on Polygon:
52
52
 
53
53
  ```bash
54
- mp buy --token pol --amount 5 --wallet <eth-address> --email <email>
54
+ mp buy --token pol_polygon --amount 5 --wallet <eth-address> --email <email>
55
55
  ```
56
56
 
57
57
  Alternatively, bridge ETH → POL if the user already has ETH:
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: moonpay-price-alerts
3
+ description: Set up desktop price alerts that notify you when tokens hit target prices. Observe-only — no trading, just notifications.
4
+ tags: [alerts, research]
5
+ ---
6
+
7
+ # Price alerts
8
+
9
+ ## Goal
10
+
11
+ Monitor token prices and get desktop notifications when they cross a threshold. Uses `mp token retrieve` for price checks and OS notifications (`osascript`/`notify-send`) for alerts. Observe-only — no funds at risk.
12
+
13
+ ## Prerequisites
14
+
15
+ - `mp` binary on PATH: `which mp`
16
+ - `jq` installed: `which jq`
17
+ - macOS: `osascript` (built-in) or Linux: `notify-send` (`sudo apt install libnotify-bin`)
18
+
19
+ ## One-shot alert
20
+
21
+ "Tell me when SOL drops below $80" — checks every 5 minutes, fires once, then disables itself.
22
+
23
+ ### Script: `~/.config/moonpay/scripts/alert-sol-below-80.sh`
24
+
25
+ ```bash
26
+ #!/bin/bash
27
+ set -euo pipefail
28
+
29
+ MP="$(which mp)"
30
+ LOG="$HOME/.config/moonpay/logs/alerts.log"
31
+ mkdir -p "$(dirname "$LOG")"
32
+ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" >> "$LOG"; }
33
+
34
+ # --- Config ---
35
+ TOKEN="So11111111111111111111111111111111111111111"
36
+ CHAIN="solana"
37
+ SYMBOL="SOL"
38
+ TARGET=80
39
+ DIRECTION="below" # "above" or "below"
40
+ SCRIPT_NAME="alert-sol-below-80"
41
+
42
+ # --- Check price ---
43
+ PRICE=$("$MP" -f compact token retrieve --token "$TOKEN" --chain "$CHAIN" | jq -r '.marketData.price')
44
+
45
+ if [ -z "$PRICE" ] || [ "$PRICE" = "null" ]; then
46
+ log "ALERT $SCRIPT_NAME: price fetch failed, skipping"
47
+ exit 0
48
+ fi
49
+
50
+ # --- Compare ---
51
+ TRIGGERED=false
52
+ if [ "$DIRECTION" = "below" ] && (( $(echo "$PRICE < $TARGET" | bc -l) )); then
53
+ TRIGGERED=true
54
+ elif [ "$DIRECTION" = "above" ] && (( $(echo "$PRICE > $TARGET" | bc -l) )); then
55
+ TRIGGERED=true
56
+ fi
57
+
58
+ if [ "$TRIGGERED" = true ]; then
59
+ MSG="$SYMBOL is $DIRECTION \$$TARGET — currently \$$PRICE"
60
+ log "ALERT $SCRIPT_NAME: $MSG"
61
+
62
+ # Desktop notification
63
+ if [[ "$OSTYPE" == "darwin"* ]]; then
64
+ osascript -e "display notification \"$MSG\" with title \"MoonPay Alert\" sound name \"Glass\""
65
+ else
66
+ notify-send "MoonPay Alert" "$MSG"
67
+ fi
68
+
69
+ # Self-disable (one-shot)
70
+ if [[ "$OSTYPE" == "darwin"* ]]; then
71
+ launchctl unload "$HOME/Library/LaunchAgents/com.moonpay.${SCRIPT_NAME}.plist" 2>/dev/null || true
72
+ else
73
+ crontab -l | grep -v "$SCRIPT_NAME" | crontab -
74
+ fi
75
+ log "ALERT $SCRIPT_NAME: disabled after trigger"
76
+ else
77
+ log "ALERT $SCRIPT_NAME: $SYMBOL at \$$PRICE — not triggered ($DIRECTION $TARGET)"
78
+ fi
79
+ ```
80
+
81
+ ### Schedule
82
+
83
+ Check every 5 minutes:
84
+
85
+ ```bash
86
+ # cron (Linux)
87
+ */5 * * * * ~/.config/moonpay/scripts/alert-sol-below-80.sh # moonpay:alert-sol-below-80
88
+
89
+ # launchd (macOS) — use StartInterval of 300 seconds in the plist
90
+ ```
91
+
92
+ Launchd plist at `~/Library/LaunchAgents/com.moonpay.alert-sol-below-80.plist`:
93
+
94
+ ```xml
95
+ <?xml version="1.0" encoding="UTF-8"?>
96
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
97
+ <plist version="1.0">
98
+ <dict>
99
+ <key>Label</key>
100
+ <string>com.moonpay.alert-sol-below-80</string>
101
+ <key>ProgramArguments</key>
102
+ <array>
103
+ <string>/bin/bash</string>
104
+ <string>/Users/USERNAME/.config/moonpay/scripts/alert-sol-below-80.sh</string>
105
+ </array>
106
+ <key>StartInterval</key>
107
+ <integer>300</integer>
108
+ <key>StandardErrorPath</key>
109
+ <string>/Users/USERNAME/.config/moonpay/logs/alert-sol-below-80.err</string>
110
+ </dict>
111
+ </plist>
112
+ ```
113
+
114
+ Load: `launchctl load ~/Library/LaunchAgents/com.moonpay.alert-sol-below-80.plist`
115
+
116
+ **Important:** Replace `USERNAME` with the actual username. Tilde does not expand in plist files.
117
+
118
+ ## Recurring alert
119
+
120
+ "Alert me every hour while ETH is above $2000" — keeps firing on each check, doesn't self-disable.
121
+
122
+ Same script as above but remove the self-disable block. The alert fires every time the condition is met, until the user manually removes it.
123
+
124
+ ## Managing alerts
125
+
126
+ ### List active alerts
127
+
128
+ ```bash
129
+ # macOS
130
+ launchctl list | grep moonpay
131
+
132
+ # Linux
133
+ crontab -l | grep moonpay
134
+ ```
135
+
136
+ ### Remove an alert
137
+
138
+ ```bash
139
+ # macOS
140
+ launchctl unload ~/Library/LaunchAgents/com.moonpay.alert-sol-below-80.plist
141
+ rm ~/Library/LaunchAgents/com.moonpay.alert-sol-below-80.plist
142
+
143
+ # Linux
144
+ crontab -l | grep -v "alert-sol-below-80" | crontab -
145
+ ```
146
+
147
+ ### View alert history
148
+
149
+ ```bash
150
+ tail -50 ~/.config/moonpay/logs/alerts.log
151
+ ```
152
+
153
+ ## Tips
154
+
155
+ - Price checks via `mp token retrieve` are free — no gas costs
156
+ - 5-minute intervals are reasonable; don't go below 1 minute
157
+ - Use `mp token search --query "SOL" --chain solana` to resolve token addresses
158
+ - Alerts log to `~/.config/moonpay/logs/alerts.log` — check this to verify they're running
159
+ - The machine must be logged in for notifications and keychain access to work
160
+ - `bc -l` handles decimal comparison; if unavailable, use `awk "BEGIN {exit !($PRICE < $TARGET)}"`
161
+ - This skill is observe-only — for automated buying/selling, see **moonpay-trading-automation**
162
+
163
+ ## Related skills
164
+
165
+ - **moonpay-trading-automation** — Automated trading (DCA, limit orders, stop losses)
166
+ - **moonpay-discover-tokens** — Research tokens and get current prices
167
+ - **moonpay-check-wallet** — Check portfolio before setting alerts