@secretkeylabs/xverse-agent-wallet 0.1.6

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,774 @@
1
+ ---
2
+ name: xverse-agent-wallet
3
+ description: 'Use the xverse-wallet CLI to manage Bitcoin, Stacks, Starknet, Spark, and Runes wallets. Trigger when the user wants to check crypto balances, send crypto, manage wallet accounts, swap tokens, stake, or interact with Lightning Network via CLI.'
4
+ ---
5
+
6
+ # xverse-wallet CLI
7
+
8
+ A headless wallet CLI for Bitcoin, Stacks, Starknet, Spark L2, Runes, and Lightning.
9
+
10
+ ## Prerequisites
11
+
12
+ - The `xverse-wallet` binary must be on PATH (installed via `npm i -g @secretkeylabs/xverse-agent-wallet`)
13
+ - **Auth check:** On first wallet interaction, run `xverse-wallet bitcoin balance --json` as a quick probe. If it fails with "XVERSE_PASSWORD env var is required" or "Vault not initialised", tell the user:
14
+
15
+ > Wallet is not authenticated in this session. Run `xverse-wallet agent` in your terminal to start Claude Code with wallet access. It will handle wallet setup and password authentication automatically.
16
+ > For other AI agents, use `xverse-wallet agent --agent <provider>`.
17
+
18
+ Then stop — do not proceed with wallet operations until the user restarts via `xverse-wallet agent`.
19
+
20
+ - Data is stored at `~/.local/share/xverse-headless/` by default (override with `XDG_DATA_HOME`)
21
+
22
+ ## Output Modes
23
+
24
+ ALWAYS use `--json` when you need to parse command output programmatically.
25
+
26
+ - Default: human-readable tables
27
+ - `--json`: structured JSON output
28
+ - `-q` / `--quiet`: single value output (e.g. just a txid or address)
29
+
30
+ ## Global Options
31
+
32
+ All commands accept these options:
33
+
34
+ - `-a, --account <index>` — temporarily run a command on a different account without switching (default: current selected account)
35
+ - `-p, --profile <name>` — run against a specific wallet profile without switching (default: active profile)
36
+ - `--json` — JSON output
37
+ - `-q, --quiet` — minimal single-value output
38
+
39
+ ### Profiles vs Accounts
40
+
41
+ The CLI supports **profiles** (separate wallets) and **accounts** (derived addresses within a wallet). Every command runs against the currently active profile and account by default.
42
+
43
+ **Profiles** are independent wallets — each has its own mnemonic, accounts, and data. Use profiles to manage multiple wallets (e.g. `default`, `trading`, `savings`).
44
+
45
+ **Accounts** are BIP-44 derived addresses within a single wallet. Account 0 is created automatically. Derive more with `account derive`.
46
+
47
+ ### Switching vs On-Demand
48
+
49
+ There are two ways to target a different profile or account:
50
+
51
+ **Switching (persistent)** — changes the default for all subsequent commands:
52
+
53
+ ```bash
54
+ wallet switch trading # switch active profile
55
+ account switch 2 # switch active account
56
+ ```
57
+
58
+ **On-demand (one-off)** — runs a single command without changing the default:
59
+
60
+ ```bash
61
+ xverse-wallet -a 2 bitcoin balance --json # different account
62
+ xverse-wallet -p trading spark balance --json # different profile
63
+ xverse-wallet -p trading -a 2 bitcoin balance --json # both
64
+ ```
65
+
66
+ Use on-demand (`-a`, `-p`) when checking balances or running quick queries. Use switching when you want all subsequent commands to target a specific profile/account.
67
+
68
+ ## Transaction Safety
69
+
70
+ All send/execute commands support a **dry-run pattern**: without `--yes` they show a preview and return `"dryRun": true` in `--json` mode. Add `--yes` to actually execute.
71
+
72
+ **CRITICAL RULE: NEVER run any command with `--yes` without explicitly asking the user first if they want to execute it.** Always run the command without `--yes` first to get a preview, show the preview to the user, and only add `--yes` after the user explicitly confirms they want to proceed. This applies to ALL commands that accept `--yes` — sends, swaps, deposits, withdrawals, staking, Lightning payments, and wallet reset.
73
+
74
+ ## Commands
75
+
76
+ ### wallet — Wallet Lifecycle
77
+
78
+ | Command | Description | Key Options |
79
+ | ---------------------- | --------------------------------------- | ------------------------------------------------------------ |
80
+ | `wallet create` | Create new wallet | `--show-mnemonic` to display seed phrase |
81
+ | `wallet restore` | Restore from mnemonic | Inline: `XVERSE_MNEMONIC="..." xverse-wallet wallet restore` |
82
+ | `wallet reset` | Delete all wallet data | `--yes` required to confirm |
83
+ | `wallet export` | Show wallet mnemonic | |
84
+ | `wallet status` | Check if wallet exists + active profile | No authentication needed |
85
+ | `wallet switch <name>` | Switch to a different wallet profile | Creates profile dir if new |
86
+ | `wallet profiles` | List all wallet profiles | Active profile marked with `*` |
87
+
88
+ **Creating a new profile:**
89
+
90
+ ```bash
91
+ wallet switch trading
92
+ XVERSE_MNEMONIC="word1 word2 ..." wallet restore
93
+ wallet switch default # switch back
94
+ ```
95
+
96
+ ### account — Account Management
97
+
98
+ | Command | Description | Key Options |
99
+ | ----------------- | ---------------------------------------- | ----------------------- |
100
+ | `account list` | List all derived accounts with addresses | |
101
+ | `account current` | Show active account addresses | |
102
+ | `account derive` | Derive next account(s) | `--count <n>` (max 100) |
103
+ | `account switch` | Switch active account | `<index>` (positional) |
104
+
105
+ ### bitcoin — Bitcoin L1
106
+
107
+ | Command | Description | Key Options |
108
+ | ----------------- | ----------------------------------------- | -------------------------------------------------------------------------- |
109
+ | `bitcoin fees` | Show recommended fee rates (sat/vB) | |
110
+ | `bitcoin receive` | Show native segwit + taproot addresses | |
111
+ | `bitcoin balance` | Show BTC balance (native, taproot, total) | `--accounts 0-4` |
112
+ | `bitcoin history` | Transaction history | `--offset <n>`, `--limit <n>` |
113
+ | `bitcoin send` | Send BTC | `--to <addr>`, `--amount <btc>` (e.g. 0.001), `--fee-rate <rate>`, `--yes` |
114
+
115
+ Amount is in BTC (e.g. `0.001` = 100,000 sats).
116
+
117
+ **Note:** `bitcoin balance` shows `native` (spendable, used for sends/deposits) and `taproot` (may be locked by ordinals/runes). Only native segwit balance is spendable for BTC sends and Spark deposits.
118
+
119
+ ### runes — Runes
120
+
121
+ | Command | Description | Key Options |
122
+ | --------------- | ------------------------------ | --------------------------------------------------------------------------------- |
123
+ | `runes receive` | Show taproot receive address | |
124
+ | `runes balance` | Show rune balances | `--filter <regex>` |
125
+ | `runes details` | Show rune etching info | `--rune <name or ID>` (required) |
126
+ | `runes send` | Send runes | `--to <addr>`, `--rune <name or ID>`, `--amount <raw-int>`, `--fee-rate`, `--yes` |
127
+ | `runes history` | Transaction history for a rune | `--rune <name or ID>` on current address (required), `--offset`, `--limit` |
128
+
129
+ Rune amount is a raw integer (not decimal). Use `runes details` to check divisibility.
130
+
131
+ ### stacks — Stacks (STX)
132
+
133
+ | Command | Description | Key Options |
134
+ | ---------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
135
+ | `stacks receive` | Show STX address | |
136
+ | `stacks balance` | Show STX + SIP-10 token balances | `--filter <regex>` |
137
+ | `stacks send` | Send STX or SIP-10 token | `--token <name>` (e.g. "STX" or SIP-10 name), `--to <addr>`, `--amount <value>`, `--memo`, `--fee <microSTX>`, `--yes` |
138
+ | `stacks history` | Token transaction history | `--token <symbol>` (required), `--limit <n>` |
139
+
140
+ Amount is in human-readable units (e.g. `1.5` STX).
141
+
142
+ ### starknet — Starknet
143
+
144
+ | Command | Description | Key Options |
145
+ | ------------------ | ------------------------------ | ---------------------------------------------------------------------------------------------------------- |
146
+ | `starknet receive` | Show Starknet address | |
147
+ | `starknet balance` | Show all ERC-20 token balances | `--filter <regex>` |
148
+ | `starknet history` | Token transaction history | `--token <symbol>` (required), `--limit`, `--cursor` |
149
+ | `starknet send` | Send STRK or any ERC-20 | `--to <addr>`, `--amount <value>`, `--token <contract>` (default: STRK), `--fee-token <contract>`, `--yes` |
150
+
151
+ Sponsorship is automatic when available. If unavailable, `--fee-token <contract-address>` is required from a token you have balance
152
+
153
+ #### starknet staking — WBTC Staking
154
+
155
+ | Command | Description | Key Options |
156
+ | ---------------------------------- | ---------------------------------- | ---------------------------------------------------------- |
157
+ | `starknet staking status` | Show staking position | |
158
+ | `starknet staking deposit` | Stake WBTC | `--token wbtc`, `--amount <value>`, `--fee-token`, `--yes` |
159
+ | `starknet staking withdraw-intent` | Start withdrawal (~7 day cooldown) | `--amount <wbtc>`, `--fee-token`, `--yes` |
160
+ | `starknet staking withdraw` | Complete withdrawal after cooldown | `--fee-token`, `--yes` |
161
+ | `starknet staking claim` | Claim STRK rewards | `--fee-token`, `--yes` |
162
+
163
+ ### spark — Spark L2
164
+
165
+ | Command | Description | Key Options |
166
+ | ---------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------- |
167
+ | `spark balance` | Show Spark balance (auto-claims pending) | `--accounts 0-4` |
168
+ | `spark receive` | Show Spark address | |
169
+ | `spark deposit` | Deposit BTC from L1 to Spark | `--amount <btc>`, `--fee-rate`, `--yes`. Without `--amount` shows deposit address + pending. |
170
+ | `spark claim` | Claim deposits with 3+ confirmations | |
171
+ | `spark send` | Send BTC or token on Spark | `--token <name>` (e.g. BTC), `--to <addr>`, `--amount <value>`, `--yes` |
172
+ | `spark withdraw` | Withdraw BTC to L1 | `--amount <btc>`, `--to <addr>` (optional), `--speed slow/medium/fast`, `--yes` |
173
+ | `spark history` | Transaction history | `--token <name>` (required), `--offset`, `--limit` |
174
+
175
+ #### spark lightning — Lightning Network
176
+
177
+ Lightning is powered by Spark L2. **You need BTC on Spark** to pay Lightning invoices or create invoices for receiving.
178
+
179
+ | Command | Description | Key Options |
180
+ | -------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------- |
181
+ | `spark lightning invoice` | Create Lightning invoice (for receiving) | `--amount <sats>` (required), `--memo` |
182
+ | `spark lightning estimate` | Estimate payment fee | `--invoice <bolt11>` (required), `--amount <sats>` (for 0-amount invoices) |
183
+ | `spark lightning pay` | Pay Lightning invoice | `--invoice <bolt11>` (required), `--max-fee <sats>` (default: 5), `--amount <sats>`, `--yes` |
184
+
185
+ Lightning amounts are in sats.
186
+
187
+ **Important Lightning funding notes:**
188
+
189
+ - You need enough Spark BTC for the **payment amount + routing fee**. A 1-sat payment with `--max-fee 10` needs at least 11 sats.
190
+ - `spark balance` auto-claims incoming Spark transfers. Always run it before attempting Lightning payments.
191
+ - To fund Lightning, check ALL accounts for Spark BTC: `for i in 0 1 2; do echo "Account $i:"; xverse-wallet -a $i spark balance --json; done`
192
+ - If needed, transfer between accounts: `xverse-wallet -a 2 spark send --token BTC --to <account-0-spark-addr> --amount 0.0001 --json`
193
+ - `pay request` supports `-a <index>` to pay from a specific account.
194
+
195
+ ### cash — Stablecoin Operations
196
+
197
+ Unified view of stablecoins across all chains: USDC (Starknet), USDB (Spark), USDCx (Stacks).
198
+
199
+ | Command | Description | Key Options |
200
+ | -------------- | ------------------------------------------- | ------------------------- |
201
+ | `cash balance` | Show stablecoin balances across all chains | |
202
+ | `cash receive` | Show receive addresses for each stablecoin | |
203
+ | `cash history` | Stablecoin transaction history (all chains) | `--limit <n>`, `--cursor` |
204
+
205
+ ```bash
206
+ # Check all stablecoin balances at once
207
+ cash balance --json
208
+ # Get addresses to receive stablecoins
209
+ cash receive --json
210
+ # View stablecoin activity
211
+ cash history --json
212
+ ```
213
+
214
+ ### pay — Machine-Payable HTTP Requests (MPP/Lightning)
215
+
216
+ Make HTTP requests to APIs that accept Lightning payments via the Machine Payments Protocol (MPP). Automatically detects 402 Payment Required, pays the Lightning invoice, and retries.
217
+
218
+ | Command | Description | Key Options |
219
+ | ------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------ |
220
+ | `pay request <url>` | HTTP request with auto Lightning payment on 402 | `--method GET\|POST`, `--body <json>`, `--header <key:value>`, `--max-fee <sats>`, `--yes` |
221
+ | `pay api [path]` | Browse MPP-enabled API endpoints | `--search <term>`, `--refresh`, `--json` |
222
+
223
+ Without `--yes`, `pay request` shows a cost preview (sats) without paying.
224
+
225
+ ```bash
226
+ # Preview cost (dry run — no payment)
227
+ pay request https://api.secretkeylabs.io/v1/bitcoin/price --json
228
+ # POST with body (preview)
229
+ pay request https://api.secretkeylabs.io/v1/rpc/bitcoin/tx --method POST --body '{"tx":"0200..."}' --json
230
+ # Discover available endpoints
231
+ pay api --json
232
+ # Search for rune-related endpoints
233
+ pay api --search rune --json
234
+ # Get parameter details for a specific endpoint
235
+ pay api /v1/bitcoin/address/{address}/utxo --json
236
+ ```
237
+
238
+ Requires BTC on Spark for Lightning payments. The command handles the full MPP flow: initial request → 402 challenge → Lightning payment → credential retry → response.
239
+
240
+ #### MPP API Endpoint Catalog (api.secretkeylabs.io)
241
+
242
+ All endpoints below are MPP-enabled (Lightning-paid). Use `pay request` to call them. Use `pay api <path> --json` for full parameter details. Networks: mainnet `api.secretkeylabs.io`, signet `api-signet.secretkeylabs.io`, testnet4 `api-testnet4.secretkeylabs.io`.
243
+
244
+ **Bitcoin:**
245
+
246
+ - `GET /v1/bitcoin/price` — BTC price
247
+ - `GET /v1/bitcoin/mempool/fee-estimates` — Fee rate estimates
248
+ - `GET /v1/bitcoin/mempool/stats` — Mempool projected block stats
249
+ - `GET /v1/bitcoin/tx/{txid}` — Transaction details
250
+ - `GET /v1/bitcoin/tx/{txid}/hex` — Raw transaction hex
251
+ - `GET /v1/bitcoin/address/{address}/balance` — Confirmed + unconfirmed balance
252
+ - `GET /v1/bitcoin/address/{address}/utxo` — Confirmed UTXOs
253
+ - `GET /v1/bitcoin/address/{address}/summary` — Address summary with tx IDs
254
+ - `GET /v1/bitcoin/address/{address}/txs/unconfirmed` — Unconfirmed transactions
255
+ - `GET /v2/bitcoin/address/{address}/utxo` — Mempool-aware UTXOs (v2)
256
+
257
+ **Ordinals & Inscriptions:**
258
+
259
+ - `GET /v1/ordinals/address/{address}/utxo` — Ordinals UTXOs (inscriptions, rare sats, runes)
260
+ - `GET /v1/ordinals/address/{address}/inscriptions` — Confirmed inscriptions
261
+ - `GET /v1/ordinals/address/{address}/collections` — Inscription collections
262
+ - `GET /v1/ordinals/collections` — List all collections
263
+ - `GET /v1/ordinals/collections/{collectionId}` — Collection metadata
264
+ - `GET /v1/inscriptions/{inscriptionId}` — Inscription details
265
+ - `GET /v1/ordinals/tx/{txid}` — Ordinal tx info
266
+
267
+ **Runes:**
268
+
269
+ - `GET /v1/ordinals/address/{address}/runes` — Rune balances for address
270
+ - `GET /v1/runes/{identifier}` — Rune info + pricing
271
+ - `GET /v1/runes` — Search runes by name
272
+ - `GET /v1/runes/{identifier}/holders` — Rune holders
273
+ - `GET /v1/runes/{identifier}/activity` — Rune activity
274
+ - `GET /v1/runes/stats/top-by-volume` — Top runes by volume
275
+ - `GET /v1/runes/address/{address}/utxo` — Rune UTXOs
276
+ - `GET /v2/runes/address/{address}/balance` — Confirmed + unconfirmed rune balance (v2)
277
+
278
+ **BRC-20:**
279
+
280
+ - `GET /v1/ordinals/address/{address}/brc20` — BRC-20 balances
281
+ - `GET /v1/brc20/ticker/{ticker}` — Token info + pricing
282
+ - `GET /v1/brc20/address/{address}/ticker/{ticker}/activity` — Transfer history
283
+
284
+ **Spark:**
285
+
286
+ - `GET /v1/spark/address/{address}` — Address summary
287
+ - `GET /v1/spark/address/{address}/btkn` — Token balances
288
+ - `GET /v1/spark/address/{address}/transactions` — Transaction history
289
+ - `GET /v1/spark/tokens/{identifier}` — Token details
290
+ - `GET /v1/spark/tx/{txid}` — Transaction details
291
+ - `GET /v1/spark/btkn/stats/rankings` — Top BTKN tokens
292
+
293
+ **Blocks & RPC:**
294
+
295
+ - `GET /v1/block/current` — Current block info
296
+ - `GET /v1/block/height/{height}` — Block by height
297
+ - `POST /v1/rpc/bitcoin/tx` — Broadcast transaction
298
+ - `POST /v2/rpc/bitcoin` — JSON-RPC (any method)
299
+
300
+ **Swaps & Portfolio:**
301
+
302
+ - `POST /v1/swaps/get-quotes` — Get swap quotes
303
+ - `POST /v1/swaps/get-destination-tokens` — Available swap destinations
304
+ - `GET /v1/portfolio` — Portfolio addresses
305
+ - `GET /v1/portfolio/history` — Daily balance history
306
+
307
+ Run `pay api --json` for the full list of all ~140 endpoints with descriptions.
308
+
309
+ ### portfolio — Full Portfolio Overview
310
+
311
+ Single command to see ALL balances across every chain, including staking positions and stablecoins.
312
+
313
+ | Command | Description | Key Options |
314
+ | ----------- | ----------------------------------------------------------------- | ---------------------------------------- |
315
+ | `portfolio` | Show all assets across Bitcoin, Stacks, Starknet, Spark + staking | `--accounts 0-4` to scan a range (max 5) |
316
+
317
+ Tags in output: `staked`, `unclaimed rewards`, `withdrawing`, `stable`, `rune`.
318
+
319
+ **Always use `portfolio --accounts 0-4 --json` when searching for funds** — assets may be on a different account than the default. The output includes an `account` field per row when `--accounts` is used. Max 5 accounts per query; only existing accounts are returned.
320
+
321
+ ### earn — Earning Opportunities
322
+
323
+ Guided staking experience: shows WBTC balance, staking position, claimable STRK rewards, and actionable next steps.
324
+
325
+ | Command | Description | Key Options |
326
+ | ------------- | --------------------------------------------------------- | ----------- |
327
+ | `earn status` | Full earning overview with suggested actions | |
328
+ | `earn guide` | Explain how WBTC staking works with step-by-step commands | |
329
+
330
+ `earn status` is the single command to answer "how do I make money?" — it checks WBTC balance, staking position, unclaimed rewards, and pending withdrawals, then prints exactly which commands to run next.
331
+
332
+ ### swap — Cross-Asset Swaps
333
+
334
+ Token format: `protocol:ticker` or `protocol:contract.name` — examples:
335
+
336
+ - `bitcoin:BTC`, `runes:840000:3`, `starknet:WBTC`, `starknet:STRK`
337
+ - `stacks:STX`, `stacks:SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token`, `spark:BTC`
338
+
339
+ | Command | Description | Key Options |
340
+ | -------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
341
+ | `swap quote` | Get swap quotes | `--from <token>`, `--to <token>`, `--amount <value>`, `--provider <code>` |
342
+ | `swap execute` | Execute a swap (auto-selects best quote) | `--from <token>`, `--to <token>`, `--amount <value>`, `--provider`, `--slippage <pct>`, `--fee-rate`, `--yes` |
343
+
344
+ Swap examples:
345
+
346
+ ```bash
347
+ # BTC <-> Runes
348
+ swap quote --from bitcoin:BTC --to runes:840000:3 --amount 0.01
349
+ swap quote --from runes:840000:3 --to bitcoin:BTC --amount 1000
350
+
351
+ # BTC <-> Starknet (cross-chain via Atomiq)
352
+ swap quote --from bitcoin:BTC --to starknet:WBTC --amount 0.005
353
+ swap quote --from starknet:WBTC --to bitcoin:BTC --amount 0.005
354
+ swap quote --from bitcoin:BTC --to starknet:STRK --amount 0.01
355
+
356
+ # BTC <-> Stacks
357
+ swap quote --from bitcoin:BTC --to stacks:STX --amount 0.01
358
+ swap quote --from stacks:STX --to bitcoin:BTC --amount 100
359
+ swap quote --from bitcoin:BTC --to stacks:SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token --amount 0.001
360
+
361
+ # BTC <-> Spark (L1 to L2 and back)
362
+ swap quote --from bitcoin:BTC --to spark:BTC --amount 0.001
363
+ swap quote --from spark:BTC --to bitcoin:BTC --amount 0.001
364
+ ```
365
+
366
+ ### fund — Buy Crypto with Fiat (On-Ramp)
367
+
368
+ Buy crypto using credit card, bank transfer, Apple Pay, etc. via on-ramp providers (MoonPay, Revolut, Banxa, etc.).
369
+ Supported crypto: BTC, STX, WBTC, STRK, USDC. Fiat currency and payment method are auto-detected from geo-location.
370
+
371
+ | Command | Description | Key Options |
372
+ | ----------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------- |
373
+ | `fund currencies` | List supported fiat and crypto currencies | |
374
+ | `fund providers` | List providers with min/max limits for a pair | `--fiat <code>`, `--crypto <symbol>` |
375
+ | `fund quote` | Get buy quotes from providers | `--crypto <symbol>`, `--amount <fiat>`, `--fiat <code>`, `--method <id>` |
376
+ | `fund buy` | Initiate purchase — opens in browser by default | `--crypto <symbol>`, `--amount <fiat>`, `--provider <name>`, `--fiat`, `--method`, `--no-open` |
377
+
378
+ Key behaviors:
379
+
380
+ - `--fiat` and `--method` auto-detect from geo-location if omitted
381
+ - `--provider` auto-selects the best available provider if omitted (fetches quotes, picks first success)
382
+ - If the auto-detected payment method has no results, falls back to `creditcard`
383
+ - `fund buy` opens the checkout URL in the default browser. Use `--no-open` to just print the URL
384
+ - Each provider has minimum/maximum amounts (typically $20–$30k for BTC). Use `fund providers` to check limits
385
+
386
+ Fund examples:
387
+
388
+ ```bash
389
+ # Simplest — auto-detect everything, opens browser
390
+ fund buy --crypto BTC --amount 100
391
+ # Buy STX with USD
392
+ fund buy --crypto STX --amount 50 --fiat usd
393
+ # Buy WBTC on Starknet (auto-falls back to creditcard if needed)
394
+ fund buy --crypto WBTC --amount 100
395
+ # Check which providers support a pair and their limits
396
+ fund providers --fiat usd --crypto BTC
397
+ # Get detailed quotes before buying
398
+ fund quote --crypto BTC --amount 100 --json
399
+ # Pick a specific provider
400
+ fund buy --crypto BTC --amount 100 --provider moonpay
401
+ # Just get the URL without opening browser
402
+ fund buy --crypto BTC --amount 100 --no-open --quiet
403
+ ```
404
+
405
+ ## Token Guide
406
+
407
+ ### BTC-pegged tokens
408
+
409
+ All of these represent Bitcoin on different layers — they are pegged 1:1 to BTC:
410
+
411
+ | Token | Layer | Description | How to get |
412
+ | ----------- | ---------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
413
+ | BTC | Bitcoin L1 | Native Bitcoin | `fund buy --crypto BTC` or receive externally |
414
+ | BTC (Spark) | Spark L2 | BTC on Spark, instant transfers + Lightning | `spark deposit` or `swap execute --from bitcoin:BTC --to spark:BTC` |
415
+ | WBTC | Starknet | Wrapped BTC on Starknet, stakeable for STRK rewards | `swap execute --from bitcoin:BTC --to starknet:WBTC` or `fund buy --crypto WBTC` |
416
+ | sBTC | Stacks | BTC on Stacks | `swap execute --from bitcoin:BTC --to stacks:SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token` |
417
+
418
+ ### Stablecoins (USD-pegged)
419
+
420
+ | Token | Layer | How to get |
421
+ | ----- | -------- | -------------------------------------------------------------------------------- |
422
+ | USDC | Starknet | `fund buy --crypto USDC` or `swap execute --from bitcoin:BTC --to starknet:USDC` |
423
+ | USDC | Stacks | `stacks send` / receive — available as SIP-10 token |
424
+ | USDB | Spark L2 | Available as Spark token — `spark send --token USDB` |
425
+
426
+ ### Native chain tokens
427
+
428
+ | Token | Layer | Description | How to get |
429
+ | ----- | -------- | ------------------------------------------------ | ---------------------------------------------------------------------------- |
430
+ | STX | Stacks | Native Stacks token, used for gas and governance | `fund buy --crypto STX` or `swap execute --from bitcoin:BTC --to stacks:STX` |
431
+ | STRK | Starknet | Native Starknet token, earned via WBTC staking | `fund buy --crypto STRK` or earned via `starknet staking claim` |
432
+
433
+ ## Getting Tokens
434
+
435
+ - **Buy with fiat**: `fund buy --crypto BTC --amount 100` (see fund section above)
436
+ - **Swap between chains**: `swap execute --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --yes` (see swap section)
437
+ - **Receive from others**: use `<chain> receive --json` for any supported chain
438
+
439
+ ## Moving Assets Across Layers
440
+
441
+ **Prefer same-chain swaps when possible** — they settle in seconds. Cross-chain routes involving BTC L1 require block confirmations (~10 min per block) and are slow and expensive.
442
+
443
+ ### Fast (same-chain, seconds)
444
+
445
+ | Route | Method | Speed |
446
+ | ----------------------- | ------------------------------------------------------ | ------- |
447
+ | STRK → WBTC (Starknet) | `swap execute --from starknet:STRK --to starknet:WBTC` | Instant |
448
+ | USDC → WBTC (Starknet) | `swap execute --from starknet:USDC --to starknet:WBTC` | Instant |
449
+ | Any Starknet token swap | `swap execute --from starknet:<X> --to starknet:<Y>` | Instant |
450
+ | Any Spark token swap | `swap execute --from spark:<X> --to spark:<Y>` | Instant |
451
+
452
+ ### Slow (cross-chain, minutes to hours)
453
+
454
+ | Route | Method | Time |
455
+ | ---------------------- | ----------------------------------------------------------- | -------------------- |
456
+ | BTC L1 → Spark L2 | `spark deposit` then `spark claim` | ~3 blocks (~30 min) |
457
+ | Spark L2 → BTC L1 | `spark withdraw` | Depends on `--speed` |
458
+ | BTC L1 → Starknet WBTC | `swap execute --from bitcoin:BTC --to starknet:WBTC` | ~10-30 min |
459
+ | Starknet WBTC → BTC L1 | `swap execute --from starknet:WBTC --to bitcoin:BTC` | ~10-30 min |
460
+ | BTC L1 → Stacks sBTC | `swap execute --from bitcoin:BTC --to stacks:...sbtc-token` | ~10-30 min |
461
+
462
+ ### Funding Spark for Lightning
463
+
464
+ To fund Spark BTC (needed for Lightning payments via `pay request`), follow this priority order:
465
+
466
+ **1. Check all accounts first** — another account may already have Spark BTC:
467
+
468
+ ```bash
469
+ # Scan all accounts at once
470
+ portfolio --accounts 0-4 --json
471
+ # Filter for Spark BTC in the results — look for chain:"Spark", asset:"BTC on Spark"
472
+ # If found on another account, use -a to pay from that account directly:
473
+ xverse-wallet -a 2 pay request https://api.example.com/data --json
474
+ ```
475
+
476
+ **2. Same-chain swap on Spark** (instant, if pairs available):
477
+
478
+ ```bash
479
+ swap quote --from spark:USDB --to spark:BTC --json
480
+ ```
481
+
482
+ **3. L1 deposit** (slow — ~30 min for 3 block confirmations):
483
+
484
+ ```bash
485
+ # Check native segwit balance (not taproot — taproot may be locked by ordinals)
486
+ bitcoin balance --json
487
+ # Deposit to Spark
488
+ spark deposit --amount 0.0001 --yes
489
+ # Wait ~30 min for 3 confirmations, then:
490
+ spark claim
491
+ ```
492
+
493
+ **4. Cross-chain swap then deposit** (slowest):
494
+
495
+ ```bash
496
+ swap execute --from starknet:STRK --to bitcoin:BTC --amount 10 --yes
497
+ # Wait for swap to complete, then deposit to Spark
498
+ spark deposit --amount 0.0001 --yes
499
+ # Wait for confirmations, then claim
500
+ spark claim
501
+ ```
502
+
503
+ ## Earning
504
+
505
+ Use `earn status` to see your position, claimable rewards, and suggested next actions.
506
+ Use `earn guide` for a step-by-step walkthrough of WBTC staking.
507
+
508
+ ## Common Workflows
509
+
510
+ ### Bootstrap: Create a New Wallet
511
+
512
+ ```bash
513
+ export XVERSE_PASSWORD="your-password"
514
+ xverse-wallet wallet create --show-mnemonic --json
515
+ xverse-wallet account list --json
516
+ # Fund the wallet: buy BTC with fiat (auto-selects provider, opens browser)
517
+ xverse-wallet fund buy --crypto BTC --amount 100
518
+ # Or receive BTC from an external wallet
519
+ xverse-wallet bitcoin receive --json
520
+ ```
521
+
522
+ ### Bootstrap: Restore an Existing Wallet
523
+
524
+ ```bash
525
+ export XVERSE_PASSWORD="your-password"
526
+ # Leading space prevents the mnemonic from being saved in shell history
527
+ XVERSE_MNEMONIC="word1 word2 ..." xverse-wallet wallet restore --json
528
+ xverse-wallet account list --json
529
+ # Derive more accounts if needed
530
+ xverse-wallet account derive --count 3 --json
531
+ ```
532
+
533
+ ### Check All Balances
534
+
535
+ ```bash
536
+ # First check how many accounts exist
537
+ xverse-wallet account list --json
538
+ # Then query all of them (adjust range to match account count)
539
+ xverse-wallet portfolio --accounts 0-4 --json
540
+ # Current account only
541
+ xverse-wallet portfolio --json
542
+ ```
543
+
544
+ ### Send BTC (preview then execute)
545
+
546
+ ```bash
547
+ xverse-wallet bitcoin send --to <address> --amount 0.001 --json
548
+ xverse-wallet bitcoin send --to <address> --amount 0.001 --yes --json
549
+ ```
550
+
551
+ ### Cross-Chain Swap
552
+
553
+ ```bash
554
+ xverse-wallet swap quote --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --json
555
+ xverse-wallet swap execute --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --yes --json
556
+ ```
557
+
558
+ ### Lightning Payment
559
+
560
+ ```bash
561
+ xverse-wallet spark lightning estimate --invoice <bolt11> --json
562
+ xverse-wallet spark lightning pay --invoice <bolt11> --yes --json
563
+ ```
564
+
565
+ ### Earning / Staking
566
+
567
+ ```bash
568
+ xverse-wallet earn status --json
569
+ xverse-wallet earn guide
570
+ ```
571
+
572
+ ### Portfolio Overview
573
+
574
+ ```bash
575
+ xverse-wallet portfolio --json
576
+ ```
577
+
578
+ ## Agentic Workflows
579
+
580
+ ### Agentic Lightning Commerce (Bet 1 — 1st Priority)
581
+
582
+ Lightning via Spark is the core payment primitive for machine-to-machine commerce. Sub-cent fees, <500ms settlement.
583
+
584
+ **Merchant flow — accept payments:**
585
+
586
+ ```bash
587
+ # 1. Ensure BTC is on Spark (fund if needed)
588
+ spark balance --json
589
+ # If no Spark BTC, deposit from L1:
590
+ spark deposit --amount 0.01 --yes
591
+ # Wait ~30 min for 3 confirmations, then:
592
+ spark claim
593
+
594
+ # 2. Create invoice for a payment
595
+ spark lightning invoice --amount 50000 --memo "Order #1234" --json
596
+ # Returns: encoded invoice string — give this to the payer
597
+
598
+ # 3. Verify payment received
599
+ spark balance --json
600
+ spark history --token BTC --limit 1 --json
601
+ ```
602
+
603
+ **Payer flow — pay Lightning invoices directly:**
604
+
605
+ ```bash
606
+ # Estimate the fee
607
+ spark lightning estimate --invoice <bolt11> --json
608
+ # Pay
609
+ spark lightning pay --invoice <bolt11> --yes --json
610
+ ```
611
+
612
+ **Payer flow — pay MPP-enabled APIs automatically:**
613
+
614
+ ```bash
615
+ # The `pay request` command handles the full 402 → Lightning → retry flow
616
+ pay request https://api.example.com/v1/data --json
617
+ # Agent just calls the API — payment happens transparently
618
+ ```
619
+
620
+ **Continuous commerce loop:**
621
+ An agent can loop: create invoices → poll `spark history` for new transactions → process orders → periodically sweep profits to cold BTC storage via `spark withdraw`.
622
+
623
+ ### Treasury Management
624
+
625
+ Patterns for managing funds across hot wallets (Spark/Starknet) and cold storage (BTC L1).
626
+
627
+ **Sweep to cold BTC vault:**
628
+
629
+ ```bash
630
+ # Sweep Spark → BTC L1
631
+ spark withdraw --amount <btc> --speed fast --yes
632
+ # Sweep Starknet WBTC → BTC L1
633
+ swap execute --from starknet:WBTC --to bitcoin:BTC --amount <wbtc> --yes
634
+ # Sweep Starknet STRK → BTC L1
635
+ swap execute --from starknet:STRK --to bitcoin:BTC --amount <strk> --yes
636
+ # Sweep Stacks STX → BTC L1
637
+ swap execute --from stacks:STX --to bitcoin:BTC --amount <stx> --yes
638
+ ```
639
+
640
+ **Rebalance between stables and BTC:**
641
+
642
+ ```bash
643
+ # Check current allocation
644
+ portfolio --json
645
+ cash balance --json
646
+ # Convert BTC to stables
647
+ swap execute --from bitcoin:BTC --to starknet:USDC --amount 0.01 --yes
648
+ # Convert stables back to BTC
649
+ swap execute --from starknet:USDC --to bitcoin:BTC --amount 100 --yes
650
+ ```
651
+
652
+ **Periodic reward harvesting:**
653
+
654
+ ```bash
655
+ # Check and claim staking rewards
656
+ earn status --json
657
+ starknet staking claim --yes
658
+ # Optionally convert STRK rewards to BTC
659
+ swap execute --from starknet:STRK --to bitcoin:BTC --amount <strk> --yes
660
+ ```
661
+
662
+ ### Agentic Trading (Bet 2 — 2nd Priority)
663
+
664
+ Use `swap quote` + `swap execute` for spot trading across all integrated DEXes (AVNU on Starknet, Flashnet on Spark, Dotswap/Sats Terminal for Runes).
665
+
666
+ **Quote → Execute pattern:**
667
+
668
+ ```bash
669
+ # Get quotes from all providers
670
+ swap quote --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --json
671
+ # Execute with best provider
672
+ swap execute --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --yes --json
673
+ # Or specify a provider
674
+ swap execute --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --provider <code> --yes --json
675
+ ```
676
+
677
+ **DCA (Dollar-Cost Averaging) pattern:**
678
+ An agent can periodically execute small swaps:
679
+
680
+ ```bash
681
+ # Run periodically (e.g. daily):
682
+ swap execute --from starknet:USDC --to starknet:WBTC --amount 10 --yes --json
683
+ ```
684
+
685
+ **Rebalancing pattern:**
686
+
687
+ ```bash
688
+ # 1. Check portfolio
689
+ portfolio --json
690
+ # 2. If overweight in one asset, swap to target allocation
691
+ swap execute --from starknet:WBTC --to starknet:STRK --amount <excess> --yes
692
+ # 3. Verify new allocation
693
+ portfolio --json
694
+ ```
695
+
696
+ **Cross-chain arbitrage:**
697
+
698
+ ```bash
699
+ # Compare prices across chains
700
+ swap quote --from bitcoin:BTC --to starknet:WBTC --amount 0.01 --json
701
+ swap quote --from bitcoin:BTC --to spark:BTC --amount 0.01 --json
702
+ # Execute on the best rate
703
+ ```
704
+
705
+ ## Guided Funding — `/xverse-agent-wallet guided-funding`
706
+
707
+ Triggered automatically when a **new wallet is created** via `xverse-wallet agent`. The wallet is empty — guide the user through funding it.
708
+
709
+ 1. **Show their wallet identity:**
710
+
711
+ ```bash
712
+ xverse-wallet wallet status --json
713
+ xverse-wallet account current --json
714
+ ```
715
+
716
+ Display the active profile and their addresses so they know where funds will arrive.
717
+
718
+ 2. **Ask how they'd like to fund their wallet.** Present these options:
719
+
720
+ - **Buy with fiat** (easiest): `xverse-wallet fund buy --crypto BTC --amount <amount>` — opens a checkout page in the browser. They can also buy STX, WBTC, STRK, or USDC.
721
+ - **Receive from another wallet**: show their Bitcoin receive address (`xverse-wallet bitcoin receive --json`) and explain they can send BTC from any exchange or wallet to that address.
722
+ - **Skip for now**: they can fund later anytime.
723
+
724
+ 3. **If they choose to buy**, walk them through `fund buy` interactively — ask which crypto and how much, then run the command. Remind them of provider minimums (~$20+).
725
+
726
+ 4. **After funding** (or skipping), briefly mention what they can do next: stake WBTC for rewards, use Spark for instant Lightning payments, swap between chains. Don't overwhelm — just plant the seeds.
727
+
728
+ Keep it conversational. This is their first interaction with the wallet.
729
+
730
+ ## Onboarding Strategy — `/xverse-agent-wallet onboarding-strategy`
731
+
732
+ When the user invokes `/xverse-agent-wallet onboarding-strategy` (or this is triggered automatically after a fresh wallet setup via `xverse-wallet agent`), follow this exact sequence:
733
+
734
+ 1. **Show wallet and account info:**
735
+
736
+ ```bash
737
+ xverse-wallet wallet status --json
738
+ xverse-wallet account current --json
739
+ ```
740
+
741
+ Display the active profile, data path, and current account addresses to the user so they can see their wallet identity.
742
+
743
+ 2. **Scan all accounts for balances:**
744
+
745
+ ```bash
746
+ xverse-wallet portfolio --accounts 0-4 --json
747
+ ```
748
+
749
+ 3. **If the wallet has balances**, summarize what they have across chains and suggest actionable next steps based on their holdings:
750
+
751
+ - BTC on L1 → suggest staking (swap to WBTC, stake for STRK rewards), Spark deposit for Lightning, or holding
752
+ - WBTC on Starknet → suggest staking if not already staked (`earn status --json`)
753
+ - STRK rewards → suggest claiming and compounding or converting to BTC
754
+ - Stablecoins → mention they can swap to BTC or hold
755
+ - Runes/tokens → mention swap options
756
+ - Present 2-3 concrete strategies with the exact commands to execute them
757
+
758
+ 4. **If the wallet has NO balances on any account**, tell the user their wallet is empty and ask if they'd like to fund it. If yes:
759
+ - Suggest `fund buy --crypto BTC --amount <amount>` to buy with fiat (simplest)
760
+ - Show their receive addresses (`bitcoin receive --json`) so they can receive from an external wallet
761
+ - Mention they can also buy STX, WBTC, STRK, or USDC directly via `fund buy`
762
+
763
+ Keep the tone concise and action-oriented. Present strategies as numbered options the user can pick from, not walls of text.
764
+
765
+ ## Tips & Gotchas
766
+
767
+ - **Always check `portfolio --accounts 0-4 --json` first** before suggesting actions — understand what the user has across all chains and all accounts.
768
+ - **BTC native vs taproot**: Only native segwit balance is spendable for sends and Spark deposits. Taproot balance may be locked by ordinals/runes. Check `bitcoin balance --json` to see the split.
769
+ - **Lightning needs payment + fee budget**: A 1-sat invoice with `--max-fee 10` needs 11+ sats on Spark. Always ensure enough headroom.
770
+ - **Check ALL accounts for funds**: Use `portfolio --accounts 0-4 --json` to scan everything. Funds might be on a different account than the default. Use `-a <index>` to operate on a specific account.
771
+ - **Prefer same-chain operations**: Same-chain swaps (Starknet→Starknet, Spark→Spark) settle in seconds. Cross-chain involving BTC L1 takes ~10-30 minutes due to block confirmations.
772
+ - **`spark balance` auto-claims**: Running `spark balance` automatically claims incoming Spark transfers. Run it before operations that need Spark BTC.
773
+ - **Fund buy minimums**: Most on-ramp providers require $20+ minimum. Use `fund providers --fiat usd --crypto BTC` to check limits.
774
+ - **Dry-run by default**: All send/execute/buy commands preview without `--yes`. Always preview first, then confirm with `--yes`.