@rareprotocol/rare-cli 0.2.1 → 0.3.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/README.md CHANGED
@@ -70,9 +70,7 @@ Private keys are masked in the output.
70
70
 
71
71
  All commands accept `--chain` to select a network. Defaults to `sepolia`.
72
72
 
73
- Supported chains: `mainnet`, `sepolia`, `base`, `base-sepolia`
74
-
75
- > **Note:** RARE Protocol deploy and auction commands are currently available on `mainnet` and `sepolia` only.
73
+ Supported chains (including deploy, mint, import, and auction flows): `mainnet`, `sepolia`, `base`, `base-sepolia`
76
74
 
77
75
  ### Deploy an NFT Collection
78
76
 
@@ -193,6 +191,82 @@ rare status --contract 0x...
193
191
  rare status --contract 0x... --token-id 1
194
192
  ```
195
193
 
194
+ ## SDK Client Usage
195
+
196
+ Use the client export when integrating RARE flows directly in your app code.
197
+
198
+ ```bash
199
+ npm install @rareprotocol/rare-cli viem
200
+ ```
201
+
202
+ ### Create a client
203
+
204
+ ```ts
205
+ import { createPublicClient, createWalletClient, http } from 'viem';
206
+ import { privateKeyToAccount } from 'viem/accounts';
207
+ import { sepolia } from 'viem/chains';
208
+ import { createRareClient } from '@rareprotocol/rare-cli/client';
209
+
210
+ const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
211
+ const publicClient = createPublicClient({
212
+ chain: sepolia,
213
+ transport: http(process.env.RPC_URL),
214
+ });
215
+
216
+ const walletClient = createWalletClient({
217
+ account,
218
+ chain: sepolia,
219
+ transport: http(process.env.RPC_URL),
220
+ });
221
+
222
+ const rare = createRareClient({ publicClient, walletClient });
223
+ ```
224
+
225
+ ### Search
226
+
227
+ `search.nfts` auto-applies the client chain unless you pass `chainIds`.
228
+
229
+ ```ts
230
+ const nfts = await rare.search.nfts({ query: 'portrait', take: 10 });
231
+ const collections = await rare.search.collections({ ownerAddresses: [account.address] });
232
+ ```
233
+
234
+ ### Upload media and mint
235
+
236
+ `media.upload` accepts a `Uint8Array` (Node `Buffer` works directly).
237
+
238
+ ```ts
239
+ import { readFile } from 'node:fs/promises';
240
+
241
+ const imageBytes = await readFile('./art.png');
242
+ const image = await rare.media.upload(imageBytes, 'art.png');
243
+
244
+ const tokenUri = await rare.media.pinMetadata({
245
+ name: 'My NFT',
246
+ description: 'Minted with the SDK client',
247
+ image,
248
+ tags: ['art'],
249
+ });
250
+
251
+ const minted = await rare.mint.mintTo({
252
+ contract: '0xYourContractAddress',
253
+ tokenUri,
254
+ to: '0xRecipientAddress',
255
+ });
256
+
257
+ console.log(minted.tokenId);
258
+ ```
259
+
260
+ ### Import an ERC-721 collection
261
+
262
+ `import.erc721` derives `chainId` from the client. If `owner` is omitted, it defaults to the configured account.
263
+
264
+ ```ts
265
+ await rare.import.erc721({
266
+ contract: '0xYourContractAddress',
267
+ });
268
+ ```
269
+
196
270
  ## Configuration
197
271
 
198
272
  Config is stored at `~/.rare/config.json`. Each chain has its own private key and RPC URL.
@@ -203,7 +277,7 @@ rare configure --chain sepolia --private-key 0x... --rpc-url https://...
203
277
 
204
278
  # Configure multiple chains
205
279
  rare configure --chain base --rpc-url https://your-base-rpc.com
206
- rare configure --chain arbitrum --private-key 0x... --rpc-url https://your-arb-rpc.com
280
+ rare configure --chain base-sepolia --private-key 0x... --rpc-url https://your-base-sepolia-rpc.com
207
281
 
208
282
  # Change default network
209
283
  rare configure --default-chain mainnet
@@ -226,6 +300,8 @@ rare configure --show
226
300
  |---|---|---|
227
301
  | Sepolia | `0x3c7526a0975156299ceef369b8ff3c01cc670523` | `0xC8Edc7049b233641ad3723D6C60019D1c8771612` |
228
302
  | Mainnet | `0xAe8E375a268Ed6442bEaC66C6254d6De5AeD4aB1` | `0x6D7c44773C52D396F43c2D511B81aa168E9a7a42` |
303
+ | Base Sepolia | `0x2b181ae0f1aea6fed75591b04991b1a3f9868d51` | `0x1f0c946f0ee87acb268d50ede6c9b4d010af65d2` |
304
+ | Base | `0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd` | `0x51c36ffb05e17ed80ee5c02fa83d7677c5613de2` |
229
305
 
230
306
  ## Underlying Solidity Contracts
231
307