@rareprotocol/rare-cli 0.1.0
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/LICENSE +21 -0
- package/README.md +267 -0
- package/dist/index.js +3583 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SuperRare Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# RARE Protocol CLI
|
|
2
|
+
|
|
3
|
+
Command-line tool for the [RARE Protocol](https://superrare.com) on Ethereum. Deploy NFT contracts, mint tokens, run auctions, and search the network — all from your terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @rareprotocol/rare-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This makes the `rare` command available globally.
|
|
12
|
+
|
|
13
|
+
Verify installation:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
rare --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
All examples below assume you installed the CLI globally and are running `rare` directly.
|
|
22
|
+
|
|
23
|
+
### 1. Configure a wallet
|
|
24
|
+
|
|
25
|
+
Import an existing private key:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
rare configure --chain sepolia --private-key 0xYourPrivateKeyHere
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or generate a new wallet:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
rare wallet generate --save
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If you skip this step, the CLI auto-generates a wallet on first use.
|
|
38
|
+
|
|
39
|
+
Check your address anytime:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
rare wallet address
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Set an RPC endpoint (recommended)
|
|
46
|
+
|
|
47
|
+
Public RPC endpoints are rate-limited and unreliable. Use your own:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
rare configure --chain sepolia --rpc-url https://your-rpc-endpoint.com
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You can set both at once:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
rare configure --chain sepolia --private-key 0x... --rpc-url https://your-rpc-endpoint.com
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. View your config
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
rare configure --show
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Private keys are masked in the output.
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
All commands accept `--chain` to select a network. Defaults to `sepolia`.
|
|
70
|
+
|
|
71
|
+
Supported chains: `mainnet`, `sepolia`, `base`, `base-sepolia`, `arbitrum`, `arbitrum-sepolia`, `optimism`, `optimism-sepolia`, `zora`, `zora-sepolia`
|
|
72
|
+
|
|
73
|
+
> **Note:** RARE Protocol contracts (deploy, auction) are currently deployed on `mainnet` and `sepolia` only. Other chains support wallet, search, and status operations.
|
|
74
|
+
|
|
75
|
+
### Deploy an NFT Collection
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
rare deploy erc721 "My Collection" "MC"
|
|
79
|
+
rare deploy erc721 "My Collection" "MC" --max-tokens 1000
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Import an Existing Collection
|
|
83
|
+
|
|
84
|
+
Import an existing ERC-721 contract into the RARE Protocol registry:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
rare import erc721 --contract 0x...
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
You can also specify a chain explicitly:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
rare import erc721 --contract 0x... --chain sepolia
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Mint an NFT
|
|
97
|
+
|
|
98
|
+
Upload local media to IPFS and mint in one step:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
rare mint \
|
|
102
|
+
--contract 0x... \
|
|
103
|
+
--name "My NFT" \
|
|
104
|
+
--description "A description" \
|
|
105
|
+
--image ./art.png
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or mint with a pre-built metadata URI:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
rare mint --contract 0x... --token-uri ipfs://Qm...
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Additional options:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
rare mint \
|
|
118
|
+
--contract 0x... \
|
|
119
|
+
--name "My NFT" \
|
|
120
|
+
--description "A cool piece" \
|
|
121
|
+
--image ./art.png \
|
|
122
|
+
--video ./animation.mp4 \
|
|
123
|
+
--tag art --tag digital \
|
|
124
|
+
--attribute "Base=Starfish" \
|
|
125
|
+
--to 0x...recipient \
|
|
126
|
+
--royalty-receiver 0x...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Auctions
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Create an auction (auto-approves the NFT transfer)
|
|
133
|
+
rare auction create \
|
|
134
|
+
--contract 0x... \
|
|
135
|
+
--token-id 1 \
|
|
136
|
+
--starting-price 0.1 \
|
|
137
|
+
--duration 86400
|
|
138
|
+
|
|
139
|
+
# Place a bid
|
|
140
|
+
rare auction bid --contract 0x... --token-id 1 --amount 0.5
|
|
141
|
+
|
|
142
|
+
# Settle after the auction ends
|
|
143
|
+
rare auction settle --contract 0x... --token-id 1
|
|
144
|
+
|
|
145
|
+
# Cancel (only if no bids placed)
|
|
146
|
+
rare auction cancel --contract 0x... --token-id 1
|
|
147
|
+
|
|
148
|
+
# Check auction status (read-only)
|
|
149
|
+
rare auction status --contract 0x... --token-id 1
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Search
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Search all NFTs
|
|
156
|
+
rare search tokens --query "portrait"
|
|
157
|
+
|
|
158
|
+
# Search your own NFTs
|
|
159
|
+
rare search tokens --mine
|
|
160
|
+
|
|
161
|
+
# Search NFTs by owner
|
|
162
|
+
rare search tokens --owner 0x...
|
|
163
|
+
|
|
164
|
+
# Find active auctions (defaults to PENDING + RUNNING)
|
|
165
|
+
rare search auctions
|
|
166
|
+
|
|
167
|
+
# Filter by auction state
|
|
168
|
+
rare search auctions --state SETTLED
|
|
169
|
+
|
|
170
|
+
# Search your collections
|
|
171
|
+
rare search collections
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
All search commands support `--take <n>` and `--cursor <n>` for pagination.
|
|
175
|
+
|
|
176
|
+
### List All Collections
|
|
177
|
+
|
|
178
|
+
Fetches every collection you own (auto-paginates):
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
rare list-collections
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Query On-Chain Status
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Contract info
|
|
188
|
+
rare status --contract 0x...
|
|
189
|
+
|
|
190
|
+
# Include token details
|
|
191
|
+
rare status --contract 0x... --token-id 1
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Configuration
|
|
195
|
+
|
|
196
|
+
Config is stored at `~/.rare/config.json`. Each chain has its own private key and RPC URL.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Set private key and RPC for a chain
|
|
200
|
+
rare configure --chain sepolia --private-key 0x... --rpc-url https://...
|
|
201
|
+
|
|
202
|
+
# Configure multiple chains
|
|
203
|
+
rare configure --chain base --rpc-url https://your-base-rpc.com
|
|
204
|
+
rare configure --chain arbitrum --private-key 0x... --rpc-url https://your-arb-rpc.com
|
|
205
|
+
|
|
206
|
+
# Change default network
|
|
207
|
+
rare configure --default-chain mainnet
|
|
208
|
+
|
|
209
|
+
# View current config
|
|
210
|
+
rare configure --show
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Best Practices
|
|
214
|
+
|
|
215
|
+
- **Use sepolia for testing.** Default to sepolia and only switch to mainnet when you're ready.
|
|
216
|
+
- **Set a reliable RPC endpoint.** Public endpoints throttle and drop requests. Services like Alchemy or Infura provide free tiers.
|
|
217
|
+
- **Don't share your private key.** The config file at `~/.rare/config.json` contains your key in plaintext. Keep it secure and never commit it to version control.
|
|
218
|
+
- **Check status before transacting.** Use `rare status` and `rare auction status` to inspect on-chain state before sending transactions.
|
|
219
|
+
- **Back up your wallet.** If you lose your private key, you lose access to your assets. Store a copy somewhere safe.
|
|
220
|
+
|
|
221
|
+
## Contract Addresses
|
|
222
|
+
|
|
223
|
+
| Network | Factory | Auction |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| Sepolia | `0x3c7526a0975156299ceef369b8ff3c01cc670523` | `0xC8Edc7049b233641ad3723D6C60019D1c8771612` |
|
|
226
|
+
| Mainnet | `0xAe8E375a268Ed6442bEaC66C6254d6De5AeD4aB1` | `0x6D7c44773C52D396F43c2D511B81aa168E9a7a42` |
|
|
227
|
+
|
|
228
|
+
## Underlying Solidity Contracts
|
|
229
|
+
|
|
230
|
+
If you want to inspect the on-chain contracts used by this CLI:
|
|
231
|
+
|
|
232
|
+
- Token contract used when minting NFTs: [`SovereignBatchMint.sol`](https://github.com/superrare/core/blob/main/src/v2/token/ERC721/sovereign/SovereignBatchMint.sol)
|
|
233
|
+
- Factory used for collection deployments: [`SovereignBatchMintFactory.sol`](https://github.com/superrare/core/blob/main/src/v2/token/ERC721/sovereign/SovereignBatchMintFactory.sol)
|
|
234
|
+
- Auction/market contract used for auction operations: [`SuperRareBazaar.sol`](https://github.com/superrare/core/blob/main/src/bazaar/SuperRareBazaar.sol)
|
|
235
|
+
|
|
236
|
+
## Development (Optional)
|
|
237
|
+
|
|
238
|
+
Most users should use the globally installed package and run `rare ...` commands directly.
|
|
239
|
+
The steps below are only for contributors working on this repository.
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
git clone https://github.com/superrare/rare-cli.git
|
|
243
|
+
cd rare-cli
|
|
244
|
+
npm install
|
|
245
|
+
npm run build
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
For development with auto-rebuild:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm run dev
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
To test local source changes without publishing a package:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
node dist/index.js --help
|
|
258
|
+
# or
|
|
259
|
+
npm link
|
|
260
|
+
rare --help
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Requires Node.js 22+. Built with [Commander](https://github.com/tj/commander.js) and [Viem](https://viem.sh).
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
[MIT](LICENSE)
|