@rareprotocol/rare-cli 0.4.1 → 1.0.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.
package/README.md CHANGED
@@ -4,6 +4,8 @@ Command-line tool for the [RARE Protocol](https://superrare.com) on Ethereum. De
4
4
 
5
5
  ## Install
6
6
 
7
+ Requires Node.js 22+.
8
+
7
9
  ```bash
8
10
  npm install -g @rareprotocol/rare-cli
9
11
  ```
@@ -16,6 +18,9 @@ Verify installation:
16
18
  rare --help
17
19
  ```
18
20
 
21
+ See [CHANGELOG.md](./CHANGELOG.md) for release notes and migration guidance.
22
+ For generated reference maps, see [rare-cli-commands.md](./rare-cli-commands.md) and [rare-cli-sdk-client-functions.md](./rare-cli-sdk-client-functions.md).
23
+
19
24
  ## Getting Started
20
25
 
21
26
  All examples below assume you installed the CLI globally and are running `rare` directly.
@@ -30,6 +35,14 @@ rare configure --chain sepolia --private-key 0xYourPrivateKeyHere
30
35
 
31
36
  > **Security note:** Your private key is stored in plaintext at `~/.rare/config.json`. Keep this file secure and never commit it to version control.
32
37
 
38
+ Or store the private key in 1Password and configure rare with a secret reference:
39
+
40
+ ```bash
41
+ rare configure --chain sepolia --private-key-ref op://Private/rare-sepolia/private-key
42
+ ```
43
+
44
+ The CLI runs `op read` once during configuration to derive and store the public wallet address. Later, it resolves the 1Password secret only when viem signs a message or transaction. The plaintext private key is never written to `~/.rare/config.json`.
45
+
33
46
  Or generate a new wallet:
34
47
 
35
48
  ```bash
@@ -56,6 +69,8 @@ You can set both at once:
56
69
 
57
70
  ```bash
58
71
  rare configure --chain sepolia --private-key 0x... --rpc-url https://your-rpc-endpoint.com
72
+ # or, without storing the key in plaintext:
73
+ rare configure --chain sepolia --private-key-ref op://Private/rare-sepolia/private-key --rpc-url https://your-rpc-endpoint.com
59
74
  ```
60
75
 
61
76
  ### 3. View your config
@@ -64,19 +79,122 @@ rare configure --chain sepolia --private-key 0x... --rpc-url https://your-rpc-en
64
79
  rare configure --show
65
80
  ```
66
81
 
67
- Private keys are masked in the output.
82
+ Private keys are masked in the output. Configured account addresses are shown.
83
+
84
+ ### 4. Configure Uniswap fallback routes (optional)
85
+
86
+ `rare swap buy-token` and `rare swap sell-token` can fall back to the hosted Uniswap API when `--route auto` cannot build a local route, or when you force `--route uniswap`. Those routes require a Uniswap API key in rare's per-chain wallet config:
87
+
88
+ ```bash
89
+ rare configure --chain sepolia --uniswap-api-key your-uniswap-api-key
90
+ ```
91
+
92
+ You can store the API key in 1Password instead:
93
+
94
+ ```bash
95
+ rare configure --chain sepolia --uniswap-api-key-ref op://Private/uniswap/api-key
96
+ ```
97
+
98
+ The CLI verifies the 1Password reference during configuration, then resolves it only if a hosted Uniswap route is actually needed. Normal user workflows do not read Uniswap keys from `.env` files.
68
99
 
69
100
  ## Usage
70
101
 
71
- All commands accept `--chain` to select a network. Defaults to `sepolia`.
102
+ Most chain-aware commands accept `--chain` or `--chain-id` to select a network. Defaults to the configured default chain, or `sepolia` when no default is configured.
103
+
104
+ Supported chains: `mainnet`, `sepolia`, `base`, `base-sepolia`
72
105
 
73
- Supported chains (including deploy, mint, import, and auction flows): `mainnet`, `sepolia`, `base`, `base-sepolia`
106
+ Feature deployment varies by chain. Batch listing, batch offer, batch auction, RareMinter release, Liquid Edition, and swap flows are currently available on `mainnet` and `sepolia`.
74
107
 
75
108
  ### Deploy an NFT Collection
76
109
 
77
110
  ```bash
78
- rare deploy erc721 "My Collection" "MC"
79
- rare deploy erc721 "My Collection" "MC" --max-tokens 1000
111
+ rare collection deploy erc721 "My Collection" "MC"
112
+ rare collection deploy erc721 "My Collection" "MC" --max-tokens 1000
113
+ ```
114
+
115
+ ### Deploy a Lazy ERC-721 Collection
116
+
117
+ For RareMinter release flows, deploy a Lazy ERC-721 collection. Buyers mint sequential token IDs through release sale settings.
118
+
119
+ ```bash
120
+ rare collection deploy lazy-erc721 "My Release" "MR" --max-tokens 1000
121
+ rare collection deploy lazy-erc721 "Guarded Release" "GR" --max-tokens 1000 --contract-type lazy-royalty-guard
122
+ ```
123
+
124
+ ### Deploy a Lazy Batch Mint Collection
125
+
126
+ For lazy minting flows, use the lazy batch mint factory instead. Tokens in a lazy collection aren't pre-minted — they're prepared and claimed/redeemed by buyers later.
127
+
128
+ ```bash
129
+ # Uncapped lazy collection (typical — leaves room for incremental lazy mints)
130
+ rare collection deploy lazy-batch-mint "My Lazy Collection" "MLC"
131
+
132
+ # Capped lazy collection (immutable supply ceiling)
133
+ rare collection deploy lazy-batch-mint "My Lazy Collection" "MLC" --max-tokens 100
134
+ ```
135
+
136
+ **Lazy vs standard batch mint**:
137
+
138
+ - `rare collection deploy erc721` deploys a SovereignBatchMint contract — tokens are minted directly via `rare collection mint` in the same tx as their creation. Use this for traditional editions where the artist mints up front.
139
+ - `rare collection deploy lazy-erc721` deploys a LazySovereignNFT contract — designed for RareMinter direct sale releases where buyers mint sequential token IDs.
140
+ - `rare collection deploy lazy-batch-mint` deploys a LazySovereignBatchMint contract — designed to feed the lazy mint preparation/redemption pipeline. Use this when buyers (not the artist) trigger the on-chain mint at purchase time.
141
+
142
+ The Lazy Sovereign and Lazy Batch Mint factories are currently deployed on **mainnet** and **sepolia** only.
143
+
144
+ Batch mint an owned Sovereign collection by passing the metadata base URI. Token metadata resolves as `baseUri/tokenId.json` on supported contracts.
145
+
146
+ ```bash
147
+ rare collection mint-batch --contract 0x... --base-uri ipfs://... --amount 100
148
+ ```
149
+
150
+ Prepare a Lazy Sovereign collection for collector minting. Pass `--minter` when a separate release or minting contract should be approved to mint from the prepared batch.
151
+
152
+ ```bash
153
+ rare collection prepare-lazy-mint --contract 0x... --base-uri ipfs://... --amount 100
154
+ rare collection prepare-lazy-mint --contract 0x... --base-uri ipfs://... --amount 100 --minter 0x...
155
+ ```
156
+
157
+ Build token-list Merkle artifacts for offline proof checks and for batch offer and batch auction root inputs. CSV files should include contract and token ID columns such as `contract_address,token_id`; JSON files can be an array of `{ "contractAddress": "0x...", "tokenId": "1" }` objects or a generated artifact. Pass `--chain-id` or include a `chain_id` column when the artifact should carry chain context.
158
+
159
+ ```bash
160
+ rare utils tree build --input batch-tokens.csv --chain-id 11155111 --output batch-token-artifact.json
161
+ rare utils tree proof --input batch-token-artifact.json --contract 0x... --token-id 1 --output proof.json
162
+ rare utils tree verify --input batch-token-artifact.json --contract 0x... --token-id 1 --proof proof.json
163
+ ```
164
+
165
+ Batch token artifacts use `type: "rare-batch-token-list"` and include `root`, `count`, optional `chainId`, canonical sorted `tokens`, and per-token `entries` with leaves and proofs. Proof artifacts use `type: "rare-batch-token-proof"` and include `root`, `contractAddress`, `tokenId`, optional `chainId`, `leaf`, `proof`, and `valid`.
166
+
167
+ Inspect creator and royalty data on Sovereign-style collections:
168
+
169
+ ```bash
170
+ rare collection creator --contract 0x... --token-id 1
171
+ rare collection royalty status --contract 0x... --token-id 1
172
+ ```
173
+
174
+ Owner wallets can update royalty receivers on Sovereign and Lazy Sovereign collections:
175
+
176
+ ```bash
177
+ rare collection royalty set-default-receiver --contract 0x... --receiver 0x...
178
+ rare collection royalty set-token-receiver --contract 0x... --token-id 1 --receiver 0x...
179
+ ```
180
+
181
+ The legacy protocol `RoyaltyRegistry` is also available under `collection royalty registry`. By default, the CLI reads the registry address from the configured Rare marketplace contract; pass `--registry 0x...` to target a specific registry.
182
+
183
+ ```bash
184
+ rare collection royalty registry status --contract 0x... --token-id 1
185
+ rare collection royalty registry set-receiver-override --receiver 0x...
186
+ rare collection royalty registry set-contract-receiver --contract 0x... --receiver 0x...
187
+ rare collection royalty registry set-token-receiver --contract 0x... --token-id 1 --receiver 0x...
188
+ rare collection royalty registry set-contract-percentage --contract 0x... --percentage 10
189
+ ```
190
+
191
+ Lazy Sovereign collections support mutable prepared metadata until the owner locks it:
192
+
193
+ ```bash
194
+ rare collection metadata status --contract 0x...
195
+ rare collection metadata update-base-uri --contract 0x... --base-uri ipfs://...
196
+ rare collection metadata update-token-uri --contract 0x... --token-id 1 --token-uri ipfs://.../1.json
197
+ rare collection metadata lock-base-uri --contract 0x...
80
198
  ```
81
199
 
82
200
  ### Import an Existing Collection
@@ -98,7 +216,7 @@ rare import erc721 --contract 0x... --chain sepolia
98
216
  Upload local media to IPFS and mint in one step:
99
217
 
100
218
  ```bash
101
- rare mint \
219
+ rare collection mint \
102
220
  --contract 0x... \
103
221
  --name "My NFT" \
104
222
  --description "A description" \
@@ -108,13 +226,13 @@ rare mint \
108
226
  Or mint with a pre-built metadata URI:
109
227
 
110
228
  ```bash
111
- rare mint --contract 0x... --token-uri ipfs://Qm...
229
+ rare collection mint --contract 0x... --token-uri ipfs://Qm...
112
230
  ```
113
231
 
114
232
  Additional options:
115
233
 
116
234
  ```bash
117
- rare mint \
235
+ rare collection mint \
118
236
  --contract 0x... \
119
237
  --name "My NFT" \
120
238
  --description "A cool piece" \
@@ -126,6 +244,98 @@ rare mint \
126
244
  --royalty-receiver 0x...
127
245
  ```
128
246
 
247
+ ### Direct Sale Releases
248
+
249
+ After creating and preparing a lazy collection, configure its RareMinter direct sale:
250
+
251
+ ```bash
252
+ rare listing release configure \
253
+ --contract 0x... \
254
+ --price 0.1 \
255
+ --max-mints 5
256
+
257
+ # Optional payout splits. If omitted, 100% goes to the configured wallet.
258
+ rare listing release configure \
259
+ --contract 0x... \
260
+ --price 100 \
261
+ --currency rare \
262
+ --start-time 2026-06-01T16:00:00Z \
263
+ --max-mints 5 \
264
+ --split 0x...artist=80 \
265
+ --split 0x...collaborator=20
266
+
267
+ # Check release status (read-only)
268
+ rare listing release status --contract 0x...
269
+
270
+ # Include account-specific mint and transaction usage
271
+ rare listing release status --contract 0x... --account 0x...
272
+
273
+ # Mint from the configured direct sale release
274
+ rare listing release mint \
275
+ --contract 0x... \
276
+ --quantity 1
277
+
278
+ # Mint during an active allowlist window with a proof file
279
+ rare listing release allowlist proof \
280
+ --input ./allowlist-artifact.json \
281
+ --account 0x... \
282
+ --output ./proof.json
283
+
284
+ rare listing release mint \
285
+ --contract 0x... \
286
+ --quantity 2 \
287
+ --proof ./proof.json
288
+ ```
289
+
290
+ Release configuration uses `RareMinter.prepareMintDirectSale`. It does not mint or modify protocol-admin settings.
291
+ `--max-mints 0` disables the per-transaction mint cap. Nonzero values must be between 1 and 100.
292
+ Release minting uses `RareMinter.mintDirectSale`; the contract mints to the connected wallet.
293
+
294
+ #### Release allowlists and limits
295
+
296
+ Allowlists are two-step. First, build a reusable proof artifact from creator-provided wallet input. CSV files can put wallet addresses in the first column or use an `address`/`wallet` header. JSON files can be an array of address strings, an array of objects with `address` or `wallet`, or an object with `wallets`/`addresses`.
297
+
298
+ ```bash
299
+ rare listing release allowlist build \
300
+ --input ./allowlist.csv \
301
+ --output ./allowlist-artifact.json
302
+ ```
303
+
304
+ The artifact contains the locally reproducible Merkle root plus one proof per wallet. In the normal flow, `allowlist set --input` submits the artifact wallet list to the Rare API and configures the API-returned canonical root on-chain with the allowlist end time:
305
+
306
+ ```bash
307
+ rare listing release allowlist set \
308
+ --contract 0x... \
309
+ --input ./allowlist-artifact.json \
310
+ --end-time 2026-06-01T16:00:00Z
311
+
312
+ # Or bypass artifact registration and set a known root directly
313
+ rare listing release allowlist set \
314
+ --contract 0x... \
315
+ --root 0x... \
316
+ --end-time 1767283200
317
+
318
+ # Read a reusable proof for an account
319
+ rare listing release allowlist proof \
320
+ --input ./allowlist-artifact.json \
321
+ --account 0x...
322
+ ```
323
+
324
+ Rare listing release minting checks the configured on-chain root while the allowlist window is active. The proof artifact is the portable file that maps each wallet to the proof needed by a mint client or service. Keep the artifact alongside release operations; the chain stores only the root and end timestamp. Use `--root` only when you already have a root that should be configured directly instead of registering an artifact through the Rare API.
325
+
326
+ Creator-facing RareMinter limits are configured separately and verified after each write:
327
+
328
+ ```bash
329
+ # Per-wallet token count across the release; 0 disables it.
330
+ rare listing release limits set-mint --contract 0x... --limit 2
331
+
332
+ # Per-wallet mint transaction count; 0 disables it.
333
+ rare listing release limits set-tx --contract 0x... --limit 1
334
+
335
+ # Verify release config, allowlist, and limits.
336
+ rare listing release status --contract 0x... --account 0x...
337
+ ```
338
+
129
339
  ### Auctions
130
340
 
131
341
  ```bash
@@ -133,11 +343,22 @@ rare mint \
133
343
  rare auction create \
134
344
  --contract 0x... \
135
345
  --token-id 1 \
136
- --starting-price 0.1 \
137
- --duration 86400
346
+ --price 0.1 \
347
+ --end-time 1778586400
348
+
349
+ # Create a scheduled auction with explicit seller splits
350
+ rare auction create \
351
+ --contract 0x... \
352
+ --token-id 1 \
353
+ --type scheduled \
354
+ --start-time 1778500000 \
355
+ --price 0.1 \
356
+ --end-time 1778586400 \
357
+ --split 0x...artist=70 \
358
+ --split 0x...collaborator=30
138
359
 
139
360
  # Place a bid
140
- rare auction bid --contract 0x... --token-id 1 --amount 0.5
361
+ rare auction bid --contract 0x... --token-id 1 --price 0.5
141
362
 
142
363
  # Settle after the auction ends
143
364
  rare auction settle --contract 0x... --token-id 1
@@ -149,17 +370,23 @@ rare auction cancel --contract 0x... --token-id 1
149
370
  rare auction status --contract 0x... --token-id 1
150
371
  ```
151
372
 
373
+ Reserve auctions start when the first valid bid meets the reserve. Scheduled auctions escrow the token when configured and become bid-ready at `--start-time`; their starting price can be zero. `--split <ADDR=RATIO>` is repeatable for up to 5 recipients, and ratios must sum to exactly 100.
374
+
152
375
  ### Offers
153
376
 
154
377
  ```bash
155
378
  # Create an offer on a token
156
- rare offer create --contract 0x... --token-id 1 --amount 0.5
379
+ rare offer create --contract 0x... --token-id 1 --price 0.5
157
380
 
158
381
  # Create an offer with ERC20 currency
159
- rare offer create --contract 0x... --token-id 1 --amount 100 --currency usdc
382
+ rare offer create --contract 0x... --token-id 1 --price 100 --currency usdc
160
383
 
161
384
  # Accept an offer on a token you own
162
- rare offer accept --contract 0x... --token-id 1 --amount 0.5
385
+ rare offer accept --contract 0x... --token-id 1 --price 0.5
386
+
387
+ # Accept with payout splits (must sum to 100; caller is NOT auto-included)
388
+ rare offer accept --contract 0x... --token-id 1 --price 0.5 \
389
+ --split 0xCollab=30 --split 0xMyWallet=70
163
390
 
164
391
  # Cancel your offer
165
392
  rare offer cancel --contract 0x... --token-id 1
@@ -168,6 +395,12 @@ rare offer cancel --contract 0x... --token-id 1
168
395
  rare offer status --contract 0x... --token-id 1
169
396
  ```
170
397
 
398
+ `--price` on `accept` is a slippage assertion: the on-chain offer must still match the value you pass, otherwise the tx reverts. Re-run `offer status` if you suspect drift.
399
+
400
+ `--split <ADDR=RATIO>` is repeatable for up to 5 recipients. Ratios must sum to exactly 100. If you omit `--split`, the SDK defaults to `[caller, 100]` (100% to your wallet). If you pass any `--split`, you must specify the complete list — the caller is **not** auto-appended.
401
+
402
+ NFT approval (`setApprovalForAll`) is checked by `offer accept`, `auction create`, and `listing create`. If approval is already in place, the command continues without a prompt; if approval is required, pass `--yes` or confirm the interactive `[y/N]` prompt.
403
+
171
404
  ### Listings
172
405
 
173
406
  ```bash
@@ -177,21 +410,125 @@ rare listing create --contract 0x... --token-id 1 --price 1.0
177
410
  # List with ERC20 currency or a targeted buyer
178
411
  rare listing create --contract 0x... --token-id 1 --price 100 --currency rare --target 0x...buyer
179
412
 
413
+ # List with payout splits (must sum to 100; caller is NOT auto-included)
414
+ rare listing create --contract 0x... --token-id 1 --price 1.0 \
415
+ --split 0xCollab=30 --split 0xMyWallet=70
416
+
180
417
  # Buy a listed token
181
- rare listing buy --contract 0x... --token-id 1 --amount 1.0
418
+ rare listing buy --contract 0x... --token-id 1 --price 1.0
182
419
 
183
420
  # Cancel a listing
184
421
  rare listing cancel --contract 0x... --token-id 1
185
422
 
186
- # Check listing status (read-only)
423
+ # Check listing status (read-only) — includes seller, amount, currency, target,
424
+ # split recipients, and whether the connected wallet can buy
187
425
  rare listing status --contract 0x... --token-id 1
188
426
  ```
189
427
 
428
+ `--split <ADDR=RATIO>` is repeatable. Ratios must sum to exactly 100. If you omit `--split`, the SDK defaults to `[caller, 100]` (100% to your wallet). If you pass any `--split`, you must specify the complete list — the caller is **not** auto-appended.
429
+
430
+ ### Batch Listings
431
+
432
+ Batch listings use Merkle artifacts: one root artifact describing the token set and listing config, and one proof artifact per token purchase.
433
+ Root artifacts are produced outside the CLI. Token sets and allowlists must each contain at least two entries because the batch listing contract rejects empty Merkle proofs. If no split is provided, registration defaults to 100% to the connected seller wallet.
434
+
435
+ ```bash
436
+ # Build a proof artifact for one token in the root
437
+ rare utils merkle proof \
438
+ --input ./root.json \
439
+ --contract 0x... \
440
+ --token-id 1 \
441
+ --output ./proof.json
442
+
443
+ # If the root has an allowlist, include the buyer when generating the proof
444
+ rare utils merkle proof \
445
+ --input ./root.json \
446
+ --contract 0x... \
447
+ --token-id 1 \
448
+ --buyer 0x... \
449
+ --output ./proof.json
450
+
451
+ # Register the batch listing from the root artifact
452
+ rare listing batch create --input ./root.json --yes
453
+
454
+ # Buy one token using a proof artifact
455
+ rare listing batch buy \
456
+ --proof ./proof.json \
457
+ --creator 0x...seller \
458
+ --currency usdc \
459
+ --price 25
460
+
461
+ # Inspect the listing config
462
+ rare listing batch status --root ./root.json --creator 0x...seller
463
+
464
+ # Narrow status to a specific token with its proof
465
+ rare listing batch status \
466
+ --root ./root.json \
467
+ --creator 0x...seller \
468
+ --contract 0x... \
469
+ --token-id 1 \
470
+ --proof ./proof.json
471
+
472
+ # Attach an allowlist config to an existing root
473
+ rare listing batch set-allowlist \
474
+ --input ./root.json
475
+
476
+ # Or pass explicit override values
477
+ rare listing batch set-allowlist \
478
+ --root 0x... \
479
+ --allowlist-root 0x... \
480
+ --end-time 1735689600
481
+
482
+ # Cancel the listing root
483
+ rare listing batch cancel --input ./root.json
484
+ ```
485
+
486
+ Named currencies are parsed with chain-aware decimals. Arbitrary ERC20 addresses are supported and their `decimals()` values are resolved from chain RPC when sending buys.
487
+
488
+ ### Batch Offers and Batch Auctions
489
+
490
+ Batch offers and batch auctions use token Merkle roots. You can pass a token-list artifact with `--input` or a known bytes32 root with `--root`.
491
+
492
+ ```bash
493
+ # Create a batch offer over a token set
494
+ rare offer batch create \
495
+ --input batch-token-artifact.json \
496
+ --price 1 \
497
+ --currency eth \
498
+ --end-time 1778586400 \
499
+ --yes
500
+
501
+ # Accept a batch offer for one token
502
+ rare offer batch accept \
503
+ --creator 0x...buyer \
504
+ --contract 0x... \
505
+ --token-id 1 \
506
+ --root 0x... \
507
+ --yes
508
+
509
+ # Create a batch reserve auction over a token set
510
+ rare auction batch create \
511
+ --input batch-token-artifact.json \
512
+ --price 0.1 \
513
+ --end-time 1778586400 \
514
+ --yes
515
+
516
+ # Bid on, inspect, settle, or cancel batch auctions
517
+ rare auction batch bid --creator 0x...seller --contract 0x... --token-id 1 --price 0.2
518
+ rare auction batch status --creator 0x...seller --contract 0x... --token-id 1
519
+ rare auction batch settle --contract 0x... --token-id 1
520
+ rare auction batch cancel --root 0x...
521
+ ```
522
+
523
+ Batch marketplace commands can resolve proofs through the Rare API when enough token, root, and creator context is provided. Pass local proof artifacts when you need a portable offline override.
524
+
190
525
  ### Currencies
191
526
 
192
527
  All marketplace commands (`auction`, `offer`, `listing`) accept `--currency` to specify a payment token. Named currencies (`eth`, `usdc`, `rare`) are resolved per-chain automatically. You can also pass any ERC20 address directly.
193
528
 
194
- ERC20 allowances are auto-approved when needed for bids, offers, and purchases.
529
+ SDK marketplace methods use the same currency contract: pass `eth`, `rare`, `usdc`, or an ERC20 address to `currency`, and use `rare.currency.list()`, `rare.currency.resolve(input)`, or `rare.currency.resolveDecimals(input)` to inspect the chain-aware mapping.
530
+
531
+ ERC20 allowances are auto-approved when needed for bids, offers, listing purchases, and batch-listing purchases.
195
532
 
196
533
  ```bash
197
534
  # List supported currencies and their addresses
@@ -199,38 +536,100 @@ rare currencies
199
536
  rare currencies --chain mainnet
200
537
  ```
201
538
 
539
+ ### Liquid Editions
540
+
541
+ Liquid Edition deployments support generated presets, custom curve files, metadata upload, preview-only output, and explicit transaction confirmation.
542
+
543
+ ```bash
544
+ # Preview a generated curve before deploying
545
+ rare liquid-edition deploy multicurve "My Liquid Edition" "MLE" \
546
+ --curve-preset medium-demand \
547
+ --description "A liquid edition" \
548
+ --image ./art.png \
549
+ --preview
550
+
551
+ # Submit the deployment
552
+ rare liquid-edition deploy multicurve "My Liquid Edition" "MLE" \
553
+ --curve-preset medium-demand \
554
+ --description "A liquid edition" \
555
+ --image ./art.png \
556
+ --initial-rare-liquidity 1000 \
557
+ --yes
558
+
559
+ # Inspect and maintain a Liquid Edition
560
+ rare liquid-edition status --contract 0x...
561
+ rare liquid-edition token-uri --contract 0x...
562
+ rare liquid-edition set-render-contract --contract 0x... --render-contract 0x...
563
+ ```
564
+
565
+ Use `--preview` to stop before deployment. Otherwise, the CLI resolves the curve config and asks for confirmation unless you pass `--yes`; in `--json` or non-interactive mode, pass `--yes` to submit a transaction.
566
+
567
+ ### Swaps
568
+
569
+ Swap commands quote before submitting. Use `--quote-only` to stop after the quote or `--yes` to submit without the interactive confirmation.
570
+
571
+ ```bash
572
+ # Buy an arbitrary token with ETH
573
+ rare swap buy-token --token 0x... --amount-in 0.1 --quote-only
574
+ rare swap buy-token --token 0x... --amount-in 0.1 --slippage-bps 50 --yes
575
+
576
+ # Sell a token for ETH
577
+ rare swap sell-token --token 0x... --amount-in 10 --quote-only
578
+
579
+ # Buy RARE with ETH through the canonical route
580
+ rare swap buy-rare --amount-in 0.1 --quote-only
581
+
582
+ # Execute a prebuilt raw liquid-router swap
583
+ rare swap tokens \
584
+ --token-in 0x... \
585
+ --amount-in 10 \
586
+ --token-out 0x... \
587
+ --min-amount-out 9.5 \
588
+ --commands 0x... \
589
+ --inputs-file ./router-inputs.json \
590
+ --yes
591
+ ```
592
+
593
+ `buy-token` and `sell-token` accept `--route auto`, `--route local`, `--route uniswap`, or `--route raw`. Raw route execution requires `--commands`, `--inputs-file`, and `--min-amount-out`.
594
+
595
+ With `--route auto`, the CLI tries the local liquid-router path first. If no canonical local route is available, it uses the hosted Uniswap API and requires `uniswapApiKey` or `uniswapApiKeyRef` in the selected chain config.
596
+
202
597
  ### Search
203
598
 
204
599
  ```bash
205
600
  # Search all NFTs
206
- rare search tokens --query "portrait"
601
+ rare search nfts --query "portrait"
207
602
 
208
603
  # Search your own NFTs
209
- rare search tokens --mine
604
+ rare search nfts --mine
210
605
 
211
606
  # Search NFTs by owner
212
- rare search tokens --owner 0x...
607
+ rare search nfts --owner 0x...
213
608
 
214
- # Find active auctions (defaults to PENDING + RUNNING)
215
- rare search auctions
609
+ # Find NFTs with running auctions
610
+ rare search nfts --auction-state RUNNING
216
611
 
217
- # Filter by auction state
218
- rare search auctions --state SETTLED
612
+ # Find NFTs with listings or offers
613
+ rare search nfts --has-listing
614
+ rare search nfts --has-offer
219
615
 
220
- # Search your collections
221
- rare search collections
222
- ```
616
+ # Search NFT events by token
617
+ rare search events --chain-id 1 --contract 0x... --token-id 1 --event-type CREATE_NFT
223
618
 
224
- All search commands support `--take <n>` and `--cursor <n>` for pagination.
619
+ # Search collection events by collection ID or by chain + contract
620
+ rare search events --collection-id 1-0x...
621
+ rare search events --chain-id 1 --contract 0x...
225
622
 
226
- ### List All Collections
227
-
228
- Fetches every collection you own (auto-paginates):
623
+ # Search collections
624
+ rare search collections
229
625
 
230
- ```bash
231
- rare list-collections
626
+ # Fetch a specific NFT or user
627
+ rare nft get --contract 0x... --token-id 1
628
+ rare user get 0x...
232
629
  ```
233
630
 
631
+ All search commands support `--per-page <n>` and `--page <n>` for pagination.
632
+
234
633
  ### Query On-Chain Status
235
634
 
236
635
  ```bash
@@ -272,13 +671,32 @@ const walletClient = createWalletClient({
272
671
  const rare = createRareClient({ publicClient, walletClient });
273
672
  ```
274
673
 
674
+ Public package subpaths are intentionally scoped:
675
+
676
+ ```ts
677
+ import { createRareClient } from '@rareprotocol/rare-cli/client';
678
+ import { contractAddresses, supportedChains } from '@rareprotocol/rare-cli/contracts';
679
+ import { buildUtilsTree, getUtilsTreeProof } from '@rareprotocol/rare-cli/utils';
680
+ ```
681
+
682
+ Use `@rareprotocol/rare-cli/client` for app-level SDK workflows, `@rareprotocol/rare-cli/contracts` for lower-level viem contract metadata and ABIs, and `@rareprotocol/rare-cli/utils` for standalone pure artifact/proof helpers.
683
+
275
684
  ### Search
276
685
 
277
- `search.nfts` auto-applies the client chain unless you pass `chainIds`.
686
+ `RareClient` is bound to the chain on its `publicClient`. Client methods use that chain automatically; create a separate client with a different viem chain to query or write another network.
278
687
 
279
688
  ```ts
280
- const nfts = await rare.search.nfts({ query: 'portrait', take: 10 });
281
- const collections = await rare.search.collections({ ownerAddresses: [account.address] });
689
+ const nfts = await rare.search.nfts({ query: 'portrait', perPage: 10 });
690
+ const collections = await rare.search.collections({ ownerAddress: account.address });
691
+ const events = await rare.search.events({
692
+ contract: '0x...',
693
+ tokenId: '1',
694
+ eventType: ['CREATE_NFT', 'SETTLE_AUCTION'],
695
+ });
696
+ const nft = await rare.nft.get({
697
+ contract: '0x...',
698
+ tokenId: '1',
699
+ });
282
700
  ```
283
701
 
284
702
  ### Upload media and mint
@@ -298,7 +716,7 @@ const tokenUri = await rare.media.pinMetadata({
298
716
  tags: ['art'],
299
717
  });
300
718
 
301
- const minted = await rare.mint.mintTo({
719
+ const minted = await rare.collection.mint({
302
720
  contract: '0xYourContractAddress',
303
721
  tokenUri,
304
722
  to: '0xRecipientAddress',
@@ -307,6 +725,135 @@ const minted = await rare.mint.mintTo({
307
725
  console.log(minted.tokenId);
308
726
  ```
309
727
 
728
+ ### Deploy an ERC-721 collection
729
+
730
+ ```ts
731
+ const created = await rare.collection.deploy.erc721({
732
+ name: 'My Collection',
733
+ symbol: 'MC',
734
+ maxTokens: 1000,
735
+ });
736
+
737
+ console.log(created.contract);
738
+ ```
739
+
740
+ ### Deploy a Lazy ERC-721 collection
741
+
742
+ ```ts
743
+ const release = await rare.collection.deploy.lazyErc721({
744
+ name: 'My Release',
745
+ symbol: 'MR',
746
+ maxTokens: 1000,
747
+ contractType: 'lazy',
748
+ });
749
+
750
+ console.log(release.contract);
751
+ console.log(release.nextStep);
752
+ ```
753
+
754
+ ### Deploy a Lazy Batch Mint collection
755
+
756
+ ```ts
757
+ const lazyBatch = await rare.collection.deploy.lazyBatchMint({
758
+ name: 'My Lazy Collection',
759
+ symbol: 'MLC',
760
+ maxTokens: 1000,
761
+ });
762
+
763
+ console.log(lazyBatch.contract);
764
+ ```
765
+
766
+ ### Batch mint a Sovereign collection
767
+
768
+ ```ts
769
+ const batch = await rare.collection.mintBatch({
770
+ contract: '0xYourContractAddress',
771
+ baseUri: 'ipfs://your-metadata-directory',
772
+ amount: 100,
773
+ });
774
+
775
+ console.log(batch.fromTokenId, batch.toTokenId);
776
+ ```
777
+
778
+ ### Prepare a Lazy Sovereign mint
779
+
780
+ ```ts
781
+ const prepared = await rare.collection.prepareLazyMint({
782
+ contract: '0xYourContractAddress',
783
+ baseUri: 'ipfs://your-metadata-directory',
784
+ amount: 100,
785
+ minter: '0xOptionalMinterAddress',
786
+ });
787
+
788
+ console.log(prepared.tokenCount);
789
+ ```
790
+
791
+ ### Build utility token Merkle trees
792
+
793
+ ```ts
794
+ const tree = rare.utils.tree.build({
795
+ content: 'contract_address,token_id,chain_id\n0x1111111111111111111111111111111111111111,1,11155111\n',
796
+ format: 'csv',
797
+ });
798
+
799
+ const tokenProof = rare.utils.tree.proof({
800
+ artifact: tree,
801
+ contractAddress: '0x1111111111111111111111111111111111111111',
802
+ tokenId: 1,
803
+ });
804
+
805
+ const proofValid = rare.utils.tree.verify({
806
+ root: tree.root,
807
+ contractAddress: tokenProof.contractAddress,
808
+ tokenId: tokenProof.tokenId,
809
+ proof: tokenProof.proof,
810
+ });
811
+
812
+ console.log(tree.root, tokenProof.proof, proofValid);
813
+ ```
814
+
815
+ ### Liquid Edition and swap SDK methods
816
+
817
+ ```ts
818
+ const liquidStatus = await rare.liquidEdition.status({
819
+ contract: '0xLiquidEditionContract',
820
+ });
821
+
822
+ const buyQuote = await rare.swap.quoteBuyToken({
823
+ token: '0xTokenAddress',
824
+ amountIn: '0.1',
825
+ route: 'auto',
826
+ });
827
+
828
+ console.log(liquidStatus.currentPrice.rarePerToken, buyQuote.minAmountOut);
829
+ ```
830
+
831
+ ### Inspect and maintain collection owner settings
832
+
833
+ ```ts
834
+ const creator = await rare.collection.getTokenCreator({
835
+ contract: '0xYourContractAddress',
836
+ tokenId: 1,
837
+ });
838
+
839
+ const royalty = await rare.collection.royalty.status({
840
+ contract: '0xYourContractAddress',
841
+ tokenId: 1,
842
+ });
843
+
844
+ await rare.collection.setDefaultRoyaltyReceiver({
845
+ contract: '0xYourContractAddress',
846
+ receiver: '0xNewRoyaltyReceiver',
847
+ });
848
+
849
+ await rare.collection.updateBaseUri({
850
+ contract: '0xLazySovereignContractAddress',
851
+ baseUri: 'ipfs://updated-metadata-directory',
852
+ });
853
+
854
+ console.log(creator.creator, royalty.receiver);
855
+ ```
856
+
310
857
  ### Import an ERC-721 collection
311
858
 
312
859
  `import.erc721` derives `chainId` from the client. If `owner` is omitted, it defaults to the configured account.
@@ -319,12 +866,21 @@ await rare.import.erc721({
319
866
 
320
867
  ## Configuration
321
868
 
322
- Config is stored at `~/.rare/config.json`. Each chain has its own private key and RPC URL.
869
+ Config is stored at `~/.rare/config.json`. Each chain has its own key source, RPC URL, and optional Uniswap API key source. A wallet key source can be a plaintext `privateKey` or a 1Password `privateKeyRef` plus a derived public address. A Uniswap API key source can be a plaintext `uniswapApiKey` or a 1Password `uniswapApiKeyRef`. `rare configure --show` prints the account address for configured key sources and masks plaintext secrets.
323
870
 
324
871
  ```bash
325
872
  # Set private key and RPC for a chain
326
873
  rare configure --chain sepolia --private-key 0x... --rpc-url https://...
327
874
 
875
+ # Set a 1Password-backed private key reference and RPC for a chain
876
+ rare configure --chain sepolia --private-key-ref op://Private/rare-sepolia/private-key --rpc-url https://...
877
+
878
+ # Set a Uniswap API key for hosted swap fallback routes
879
+ rare configure --chain sepolia --uniswap-api-key your-uniswap-api-key
880
+
881
+ # Or keep the Uniswap API key in 1Password
882
+ rare configure --chain sepolia --uniswap-api-key-ref op://Private/uniswap/api-key
883
+
328
884
  # Configure multiple chains
329
885
  rare configure --chain base --rpc-url https://your-base-rpc.com
330
886
  rare configure --chain base-sepolia --private-key 0x... --rpc-url https://your-base-sepolia-rpc.com
@@ -332,26 +888,62 @@ rare configure --chain base-sepolia --private-key 0x... --rpc-url https://your-b
332
888
  # Change default network
333
889
  rare configure --default-chain mainnet
334
890
 
335
- # View current config
891
+ # View current config, including derived account addresses
336
892
  rare configure --show
893
+
894
+ # Delete local config (prompts for confirmation)
895
+ rare configure delete
896
+
897
+ # Delete local config without prompting
898
+ rare configure delete --yes
899
+ ```
900
+
901
+ Merkle root and proof flows use `https://api.superrare.com` by default. Set `RARE_API_BASE_URL` to point the SDK and CLI at another rare-api deployment.
902
+
903
+ ```bash
904
+ RARE_API_BASE_URL=https://rare-api.example.com rare listing batch buy --contract 0x... --token-id 1 --creator 0x... --currency eth --price 1
337
905
  ```
338
906
 
339
907
  ## Best Practices
340
908
 
341
909
  - **Use sepolia for testing.** Default to sepolia and only switch to mainnet when you're ready.
342
910
  - **Set a reliable RPC endpoint.** Public endpoints throttle and drop requests. Services like Alchemy or Infura provide free tiers.
343
- - **Don't share your private key.** Keep `~/.rare/config.json` secure and never commit it to version control.
911
+ - **Prefer 1Password for private keys.** Install the 1Password CLI, run `op signin`, and configure keys with `--private-key-ref` to avoid storing plaintext keys in rare config.
912
+ - **Prefer 1Password for Uniswap API keys.** Configure hosted swap fallback routes with `--uniswap-api-key-ref` when you do not want API keys stored in plaintext config.
913
+ - **Don't share your private key.** If you use `--private-key` or generated saved wallets, keep `~/.rare/config.json` secure and never commit it to version control.
344
914
  - **Check status before transacting.** Use `rare status` and `rare auction status` to inspect on-chain state before sending transactions.
345
915
  - **Back up your wallet.** If you lose your private key, you lose access to your assets. Store a copy somewhere safe.
346
916
 
917
+ ### 1Password Test Setup
918
+
919
+ The default test suite does not require access to a real 1Password vault. To run the optional live 1Password integration, sign in with `op signin` and provide a private-key secret reference:
920
+
921
+ ```bash
922
+ RARE_CLI_TEST_OP_PRIVATE_KEY_REF=op://Private/rare-sepolia/private-key \
923
+ npx vitest run test/integration/one-password.test.ts --config vitest.config.ts
924
+ ```
925
+
347
926
  ## Contract Addresses
348
927
 
349
- | Network | Factory | Auction |
350
- |---|---|---|
351
- | Sepolia | `0x3c7526a0975156299ceef369b8ff3c01cc670523` | `0xC8Edc7049b233641ad3723D6C60019D1c8771612` |
352
- | Mainnet | `0xAe8E375a268Ed6442bEaC66C6254d6De5AeD4aB1` | `0x6D7c44773C52D396F43c2D511B81aa168E9a7a42` |
353
- | Base Sepolia | `0x2b181ae0f1aea6fed75591b04991b1a3f9868d51` | `0x1f0c946f0ee87acb268d50ede6c9b4d010af65d2` |
354
- | Base | `0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd` | `0x51c36ffb05e17ed80ee5c02fa83d7677c5613de2` |
928
+ These are the addresses embedded in the SDK under `@rareprotocol/rare-cli/contracts`.
929
+
930
+ Core collection and marketplace contracts:
931
+
932
+ | Network | Factory | Sovereign Factory | Lazy Sovereign Factory | Lazy Batch Mint Factory | Auction | RareMinter |
933
+ |---|---|---|---|---|---|---|
934
+ | Sepolia | `0x3c7526a0975156299ceef369b8ff3c01cc670523` | `0x46B2850ba7787734F648A6848b5eDE0815C1F8Bf` | `0xc5B8Ad9003673a23d005A6448C74d8955a1a38fA` | `0xE5efBA88D556aDA98124654fE505465b8d494858` | `0xC8Edc7049b233641ad3723D6C60019D1c8771612` | `0xd28Dc0B89104d7BBd902F338a0193fF063617ccE` |
935
+ | Mainnet | `0xAe8E375a268Ed6442bEaC66C6254d6De5AeD4aB1` | `0xe980ec62378529d95ba446433f4deb6324129c59` | `0xba798BD606d86D207ca2751510173532899117a1` | `0x40F9E4b420D5A8fF5aED32B5F72A37013c0739B6` | `0x6D7c44773C52D396F43c2D511B81aa168E9a7a42` | `0x5fa112EFeD8297bec0010b312208d223E0cE891E` |
936
+ | Base Sepolia | `0x2b181ae0f1aea6fed75591b04991b1a3f9868d51` | — | — | — | `0x1f0c946f0ee87acb268d50ede6c9b4d010af65d2` | — |
937
+ | Base | `0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd` | — | — | — | `0x51c36ffb05e17ed80ee5c02fa83d7677c5613de2` | — |
938
+
939
+ Batch, approval, Liquid Edition, and swap infrastructure:
940
+
941
+ | Network | Batch Listing | BatchOfferCreator | BatchAuctionHouse | Marketplace Settings | ERC20 Approval Manager | ERC721 Approval Manager | Liquid Factory | Swap Router | V4 Quoter |
942
+ |---|---|---|---|---|---|---|---|---|---|
943
+ | Sepolia | `0xF2bE72d4343beD375Cb6d0E799a3c003163860e0` | `0x371cca54ef859bb0c7b910581a528ee47773fd56` | `0x293AE7701A7830B1d38A7608EdF86A106d9E2645` | `0x972dEe8fa339ad2D9c6cbDA31b67f98Fac242d13` | `0x4619eB29e84392CE91C27FC936A5c94d1D14b93f` | `0x5fa0a461d3a2Ea3bFDf03e8BD37CAbB4ae84205E` | `0xb1777091C953fa2aC1fD67f2b3e2f61343F5Ce5e` | `0x429c3Ee66E7f6CDA12C5BadE4104aF3277aA2305` | `0x61B3f2011A92d183C7dbaDBdA940a7555Ccf9227` |
944
+ | Mainnet | `0x6a190885A806D39A0A8C348bfA1ac762D72E608d` | `0xe15cf80b25272ade261532efdb7912f9104851d4` | `0x71742c7196f1c334C4c038ce6dcDcEE98097F9Da` | `0x61DBF87164d33FD3695256DC8Ba74D3B1d304170` | `0xa837a7eAff154Ab837617Cf7250648D3Ec0A4436` | `0x4bb0Deea6d1A30C601338aAB776d394C2AE5c0F8` | `0xbb4341CFd588a098e9aCE1D224178836426c4a8E` | `0xEBd58EdA8408d9EA409f2c2bE8898BD9738f3583` | `0x52F0E24D1c21C8A0cB1e5a5dD6198556BD9E1203` |
945
+ | Base Sepolia | — | — | — | — | — | — | — | — | — |
946
+ | Base | — | — | — | — | — | — | — | — | — |
355
947
 
356
948
  ## Underlying Solidity Contracts
357
949
 
@@ -359,6 +951,10 @@ If you want to inspect the on-chain contracts used by this CLI:
359
951
 
360
952
  - Token contract used when minting NFTs: [`SovereignBatchMint.sol`](https://github.com/superrare/core/blob/main/src/v2/token/ERC721/sovereign/SovereignBatchMint.sol)
361
953
  - Factory used for collection deployments: [`SovereignBatchMintFactory.sol`](https://github.com/superrare/core/blob/main/src/v2/token/ERC721/sovereign/SovereignBatchMintFactory.sol)
954
+ - Token contract used for RareMinter releases: [`LazySovereignNFT.sol`](https://github.com/superrare/core/blob/main/src/token/ERC721/sovereign/lazy/LazySovereignNFT.sol)
955
+ - Factory used for Lazy ERC-721 release collection deployments: [`LazySovereignNFTFactory.sol`](https://github.com/superrare/core/blob/main/src/token/ERC721/sovereign/lazy/LazySovereignNFTFactory.sol)
956
+ - Token contract used for lazy batch mint drops: [`LazySovereignBatchMint.sol`](https://github.com/superrare/core/blob/main/src/v2/token/ERC721/sovereign/LazySovereignBatchMint.sol)
957
+ - Factory used for lazy batch mint collection deployments: [`LazySovereignBatchMintFactory.sol`](https://github.com/superrare/core/blob/main/src/v2/token/ERC721/sovereign/LazySovereignBatchMintFactory.sol)
362
958
  - Auction/market contract used for auction operations: [`SuperRareBazaar.sol`](https://github.com/superrare/core/blob/main/src/bazaar/SuperRareBazaar.sol)
363
959
 
364
960
  ## Development (Optional)