@rareprotocol/rare-cli 0.1.0 → 0.2.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 +5 -3
- package/dist/index.js +57 -65
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ Import an existing private key:
|
|
|
28
28
|
rare configure --chain sepolia --private-key 0xYourPrivateKeyHere
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
> **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
|
+
|
|
31
33
|
Or generate a new wallet:
|
|
32
34
|
|
|
33
35
|
```bash
|
|
@@ -68,9 +70,9 @@ Private keys are masked in the output.
|
|
|
68
70
|
|
|
69
71
|
All commands accept `--chain` to select a network. Defaults to `sepolia`.
|
|
70
72
|
|
|
71
|
-
Supported chains: `mainnet`, `sepolia`, `base`, `base-sepolia
|
|
73
|
+
Supported chains: `mainnet`, `sepolia`, `base`, `base-sepolia`
|
|
72
74
|
|
|
73
|
-
> **Note:** RARE Protocol
|
|
75
|
+
> **Note:** RARE Protocol deploy and auction commands are currently available on `mainnet` and `sepolia` only.
|
|
74
76
|
|
|
75
77
|
### Deploy an NFT Collection
|
|
76
78
|
|
|
@@ -214,7 +216,7 @@ rare configure --show
|
|
|
214
216
|
|
|
215
217
|
- **Use sepolia for testing.** Default to sepolia and only switch to mainnet when you're ready.
|
|
216
218
|
- **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.**
|
|
219
|
+
- **Don't share your private key.** Keep `~/.rare/config.json` secure and never commit it to version control.
|
|
218
220
|
- **Check status before transacting.** Use `rare status` and `rare auction status` to inspect on-chain state before sending transactions.
|
|
219
221
|
- **Back up your wallet.** If you lose your private key, you lose access to your assets. Store a copy somewhere safe.
|
|
220
222
|
|
package/dist/index.js
CHANGED
|
@@ -12,54 +12,30 @@ import path from "path";
|
|
|
12
12
|
import os from "os";
|
|
13
13
|
|
|
14
14
|
// src/contracts/addresses.ts
|
|
15
|
-
import { sepolia, mainnet, base, baseSepolia
|
|
15
|
+
import { sepolia, mainnet, base, baseSepolia } from "viem/chains";
|
|
16
16
|
var supportedChains = [
|
|
17
17
|
"mainnet",
|
|
18
18
|
"sepolia",
|
|
19
19
|
"base",
|
|
20
|
-
"base-sepolia"
|
|
21
|
-
"arbitrum",
|
|
22
|
-
"arbitrum-sepolia",
|
|
23
|
-
"optimism",
|
|
24
|
-
"optimism-sepolia",
|
|
25
|
-
"zora",
|
|
26
|
-
"zora-sepolia"
|
|
20
|
+
"base-sepolia"
|
|
27
21
|
];
|
|
28
22
|
var viemChains = {
|
|
29
23
|
mainnet,
|
|
30
24
|
sepolia,
|
|
31
25
|
base,
|
|
32
|
-
"base-sepolia": baseSepolia
|
|
33
|
-
arbitrum,
|
|
34
|
-
"arbitrum-sepolia": arbitrumSepolia,
|
|
35
|
-
optimism,
|
|
36
|
-
"optimism-sepolia": optimismSepolia,
|
|
37
|
-
zora,
|
|
38
|
-
"zora-sepolia": zoraSepolia
|
|
26
|
+
"base-sepolia": baseSepolia
|
|
39
27
|
};
|
|
40
28
|
var chainIds = {
|
|
41
29
|
mainnet: 1,
|
|
42
30
|
sepolia: 11155111,
|
|
43
31
|
base: 8453,
|
|
44
|
-
"base-sepolia": 84532
|
|
45
|
-
arbitrum: 42161,
|
|
46
|
-
"arbitrum-sepolia": 421614,
|
|
47
|
-
optimism: 10,
|
|
48
|
-
"optimism-sepolia": 11155420,
|
|
49
|
-
zora: 7777777,
|
|
50
|
-
"zora-sepolia": 999999999
|
|
32
|
+
"base-sepolia": 84532
|
|
51
33
|
};
|
|
52
34
|
var defaultRpcUrls = {
|
|
53
35
|
mainnet: "https://eth.llamarpc.com",
|
|
54
36
|
sepolia: "https://rpc.sepolia.org",
|
|
55
37
|
base: "https://mainnet.base.org",
|
|
56
|
-
"base-sepolia": "https://sepolia.base.org"
|
|
57
|
-
arbitrum: "https://arb1.arbitrum.io/rpc",
|
|
58
|
-
"arbitrum-sepolia": "https://sepolia-rollup.arbitrum.io/rpc",
|
|
59
|
-
optimism: "https://mainnet.optimism.io",
|
|
60
|
-
"optimism-sepolia": "https://sepolia.optimism.io",
|
|
61
|
-
zora: "https://rpc.zora.energy",
|
|
62
|
-
"zora-sepolia": "https://sepolia.rpc.zora.energy"
|
|
38
|
+
"base-sepolia": "https://sepolia.base.org"
|
|
63
39
|
};
|
|
64
40
|
var contractAddresses = {
|
|
65
41
|
sepolia: {
|
|
@@ -69,14 +45,22 @@ var contractAddresses = {
|
|
|
69
45
|
mainnet: {
|
|
70
46
|
factory: "0xAe8E375a268Ed6442bEaC66C6254d6De5AeD4aB1",
|
|
71
47
|
auction: "0x6D7c44773C52D396F43c2D511B81aa168E9a7a42"
|
|
48
|
+
},
|
|
49
|
+
base: {
|
|
50
|
+
factory: "0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd",
|
|
51
|
+
auction: "0x51c36ffb05e17ed80ee5c02fa83d7677c5613de2"
|
|
52
|
+
},
|
|
53
|
+
"base-sepolia": {
|
|
54
|
+
factory: "0x2b181ae0f1aea6fed75591b04991b1a3f9868d51",
|
|
55
|
+
auction: "0x1f0c946f0ee87acb268d50ede6c9b4d010af65d2"
|
|
72
56
|
}
|
|
73
57
|
};
|
|
74
58
|
function getContractAddresses(chain) {
|
|
75
59
|
const addresses = contractAddresses[chain];
|
|
76
60
|
if (!addresses) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
throw new Error(
|
|
62
|
+
`RARE Protocol contracts are not deployed on "${chain}". Supported chains: ${Object.keys(contractAddresses).join(", ")}`
|
|
63
|
+
);
|
|
80
64
|
}
|
|
81
65
|
return addresses;
|
|
82
66
|
}
|
|
@@ -119,8 +103,9 @@ function getChainConfig(chain) {
|
|
|
119
103
|
// src/commands/configure.ts
|
|
120
104
|
function configureCommand() {
|
|
121
105
|
const cmd = new Command("configure");
|
|
106
|
+
const supportedChainsText = supportedChains.join(", ");
|
|
122
107
|
cmd.description("Set or view configuration");
|
|
123
|
-
cmd.option("--chain <chain>",
|
|
108
|
+
cmd.option("--chain <chain>", `chain to configure (${supportedChainsText})`).option("--private-key <key>", "private key for the specified chain").option("--rpc-url <url>", "custom RPC URL for the specified chain").option("--default-chain <chain>", "set the default chain").option("--show", "display current configuration").action((opts) => {
|
|
124
109
|
const config = readConfig();
|
|
125
110
|
if (opts.show) {
|
|
126
111
|
const display = {
|
|
@@ -139,8 +124,8 @@ function configureCommand() {
|
|
|
139
124
|
return;
|
|
140
125
|
}
|
|
141
126
|
if (opts.defaultChain) {
|
|
142
|
-
if (opts.defaultChain
|
|
143
|
-
console.error(
|
|
127
|
+
if (!isSupportedChain(opts.defaultChain)) {
|
|
128
|
+
console.error(`Error: --default-chain must be one of: ${supportedChainsText}`);
|
|
144
129
|
process.exit(1);
|
|
145
130
|
}
|
|
146
131
|
config.defaultChain = opts.defaultChain;
|
|
@@ -148,11 +133,11 @@ function configureCommand() {
|
|
|
148
133
|
console.log(`Default chain set to: ${opts.defaultChain}`);
|
|
149
134
|
}
|
|
150
135
|
if (opts.chain) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
console.error('Error: --chain must be "sepolia" or "mainnet"');
|
|
136
|
+
if (!isSupportedChain(opts.chain)) {
|
|
137
|
+
console.error(`Error: --chain must be one of: ${supportedChainsText}`);
|
|
154
138
|
process.exit(1);
|
|
155
139
|
}
|
|
140
|
+
const chain = opts.chain;
|
|
156
141
|
if (!config.chains[chain]) {
|
|
157
142
|
config.chains[chain] = {};
|
|
158
143
|
}
|
|
@@ -402,7 +387,7 @@ var factoryAbi = [
|
|
|
402
387
|
function deployErc721Command() {
|
|
403
388
|
const cmd = new Command2("erc721");
|
|
404
389
|
cmd.description("Deploy a new ERC-721 NFT contract via the RARE factory");
|
|
405
|
-
cmd.argument("<name>", "name of the NFT collection").argument("<symbol>", "symbol of the NFT collection").option("--max-tokens <number>", "maximum number of tokens (optional)").option("--chain <chain>", "chain to use (sepolia
|
|
390
|
+
cmd.argument("<name>", "name of the NFT collection").argument("<symbol>", "symbol of the NFT collection").option("--max-tokens <number>", "maximum number of tokens (optional)").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (name, symbol, opts) => {
|
|
406
391
|
const chain = getActiveChain(opts.chain);
|
|
407
392
|
const { client, account } = getWalletClient(chain);
|
|
408
393
|
const publicClient = getPublicClient(chain);
|
|
@@ -1359,11 +1344,9 @@ async function pinMetadata(opts) {
|
|
|
1359
1344
|
const payload = {
|
|
1360
1345
|
name: opts.name,
|
|
1361
1346
|
description: opts.description,
|
|
1362
|
-
nftMedia
|
|
1347
|
+
nftMedia,
|
|
1348
|
+
tags: opts.tags ?? []
|
|
1363
1349
|
};
|
|
1364
|
-
if (opts.tags && opts.tags.length > 0) {
|
|
1365
|
-
payload.tags = opts.tags;
|
|
1366
|
-
}
|
|
1367
1350
|
if (opts.attributes && opts.attributes.length > 0) {
|
|
1368
1351
|
payload.attributes = opts.attributes;
|
|
1369
1352
|
}
|
|
@@ -1396,7 +1379,7 @@ function parseAttribute(raw) {
|
|
|
1396
1379
|
function mintCommand() {
|
|
1397
1380
|
const cmd = new Command3("mint");
|
|
1398
1381
|
cmd.description("Mint a new NFT on a deployed token contract");
|
|
1399
|
-
cmd.requiredOption("--contract <address>", "token contract address").option("--token-uri <uri>", "token metadata URI (skip upload if provided)").option("--name <name>", "NFT name").option("--description <description>", "NFT description").option("--image <path>", "path to image file").option("--video <path>", "path to video file").option("--tag <tag>", "tag (repeatable)", (val, acc) => [...acc, val], []).option("--attribute <attr>", 'attribute as "trait=value" or JSON (repeatable)', (val, acc) => [...acc, val], []).option("--to <address>", "recipient address (defaults to caller)").option("--royalty-receiver <address>", "royalty receiver address (defaults to caller)").option("--chain <chain>", "chain to use (sepolia
|
|
1382
|
+
cmd.requiredOption("--contract <address>", "token contract address").option("--token-uri <uri>", "token metadata URI (skip upload if provided)").option("--name <name>", "NFT name").option("--description <description>", "NFT description").option("--image <path>", "path to image file").option("--video <path>", "path to video file").option("--tag <tag>", "tag (repeatable)", (val, acc) => [...acc, val], []).option("--attribute <attr>", 'attribute as "trait=value" or JSON (repeatable)', (val, acc) => [...acc, val], []).option("--to <address>", "recipient address (defaults to caller)").option("--royalty-receiver <address>", "royalty receiver address (defaults to caller)").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
1400
1383
|
let tokenUri;
|
|
1401
1384
|
if (opts.tokenUri) {
|
|
1402
1385
|
tokenUri = opts.tokenUri;
|
|
@@ -3102,7 +3085,7 @@ var approvalAbi = [
|
|
|
3102
3085
|
function auctionCommand() {
|
|
3103
3086
|
const cmd = new Command4("auction");
|
|
3104
3087
|
cmd.description("Auction subcommands (create, bid, settle, cancel, status)");
|
|
3105
|
-
cmd.command("create").description("Configure and start an auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID to auction").requiredOption("--starting-price <amount>", "starting price in ETH (or token units)").requiredOption("--duration <seconds>", "auction duration in seconds").option("--currency <address>", "ERC20 currency address (defaults to ETH)").option("--chain <chain>", "chain to use (sepolia
|
|
3088
|
+
cmd.command("create").description("Configure and start an auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID to auction").requiredOption("--starting-price <amount>", "starting price in ETH (or token units)").requiredOption("--duration <seconds>", "auction duration in seconds").option("--currency <address>", "ERC20 currency address (defaults to ETH)").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
3106
3089
|
const chain = getActiveChain(opts.chain);
|
|
3107
3090
|
const { client, account } = getWalletClient(chain);
|
|
3108
3091
|
const publicClient = getPublicClient(chain);
|
|
@@ -3181,7 +3164,7 @@ Transaction sent: ${txHash}`);
|
|
|
3181
3164
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
3182
3165
|
console.log(`Auction created! Block: ${receipt.blockNumber}`);
|
|
3183
3166
|
});
|
|
3184
|
-
cmd.command("bid").description("Place a bid on an auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").requiredOption("--amount <amount>", "bid amount in ETH (or token units)").option("--currency <address>", "ERC20 currency address (defaults to ETH)").option("--chain <chain>", "chain to use (sepolia
|
|
3167
|
+
cmd.command("bid").description("Place a bid on an auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").requiredOption("--amount <amount>", "bid amount in ETH (or token units)").option("--currency <address>", "ERC20 currency address (defaults to ETH)").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
3185
3168
|
const chain = getActiveChain(opts.chain);
|
|
3186
3169
|
const { client, account } = getWalletClient(chain);
|
|
3187
3170
|
const publicClient = getPublicClient(chain);
|
|
@@ -3213,7 +3196,7 @@ Transaction sent: ${txHash}`);
|
|
|
3213
3196
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
3214
3197
|
console.log(`Bid placed! Block: ${receipt.blockNumber}`);
|
|
3215
3198
|
});
|
|
3216
|
-
cmd.command("settle").description("Settle a completed auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").option("--chain <chain>", "chain to use (sepolia
|
|
3199
|
+
cmd.command("settle").description("Settle a completed auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
3217
3200
|
const chain = getActiveChain(opts.chain);
|
|
3218
3201
|
const { client, account } = getWalletClient(chain);
|
|
3219
3202
|
const publicClient = getPublicClient(chain);
|
|
@@ -3231,7 +3214,7 @@ Transaction sent: ${txHash}`);
|
|
|
3231
3214
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
3232
3215
|
console.log(`Auction settled! Block: ${receipt.blockNumber}`);
|
|
3233
3216
|
});
|
|
3234
|
-
cmd.command("cancel").description("Cancel an auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").option("--chain <chain>", "chain to use (sepolia
|
|
3217
|
+
cmd.command("cancel").description("Cancel an auction").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
3235
3218
|
const chain = getActiveChain(opts.chain);
|
|
3236
3219
|
const { client, account } = getWalletClient(chain);
|
|
3237
3220
|
const publicClient = getPublicClient(chain);
|
|
@@ -3249,7 +3232,7 @@ Transaction sent: ${txHash}`);
|
|
|
3249
3232
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
3250
3233
|
console.log(`Auction cancelled! Block: ${receipt.blockNumber}`);
|
|
3251
3234
|
});
|
|
3252
|
-
cmd.command("status").description("Get auction details (read-only)").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").option("--chain <chain>", "chain to use (sepolia
|
|
3235
|
+
cmd.command("status").description("Get auction details (read-only)").requiredOption("--contract <address>", "NFT contract address").requiredOption("--token-id <id>", "token ID").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
3253
3236
|
const chain = getActiveChain(opts.chain);
|
|
3254
3237
|
const publicClient = getPublicClient(chain);
|
|
3255
3238
|
const auctionAddress = getContractAddresses(chain).auction;
|
|
@@ -3259,15 +3242,22 @@ Transaction sent: ${txHash}`);
|
|
|
3259
3242
|
functionName: "getAuctionDetails",
|
|
3260
3243
|
args: [opts.contract, BigInt(opts.tokenId)]
|
|
3261
3244
|
});
|
|
3262
|
-
const [seller,
|
|
3245
|
+
const [seller, creationBlock, startingTime, lengthOfAuction, currency, minimumBid, auctionType] = result;
|
|
3263
3246
|
const isEth = currency === ETH_ADDRESS;
|
|
3264
|
-
const
|
|
3247
|
+
const started = Number(startingTime) > 0;
|
|
3248
|
+
const endTime = started ? Number(startingTime) + Number(lengthOfAuction) : null;
|
|
3249
|
+
const endDate = endTime ? new Date(endTime * 1e3) : null;
|
|
3265
3250
|
console.log("\nAuction Details:");
|
|
3266
3251
|
console.log(` Seller: ${seller}`);
|
|
3267
|
-
console.log(`
|
|
3268
|
-
console.log(` Current bid: ${formatEther(currentBid)} ${isEth ? "ETH" : currency}`);
|
|
3269
|
-
console.log(` End time: ${endDate.toISOString()} (${endTime})`);
|
|
3252
|
+
console.log(` Minimum bid: ${formatEther(minimumBid)} ${isEth ? "ETH" : currency}`);
|
|
3270
3253
|
console.log(` Currency: ${isEth ? "ETH" : currency}`);
|
|
3254
|
+
console.log(` Duration: ${lengthOfAuction}s`);
|
|
3255
|
+
console.log(` Status: ${started ? "RUNNING" : "PENDING"}`);
|
|
3256
|
+
if (started) {
|
|
3257
|
+
console.log(` Started at: ${new Date(Number(startingTime) * 1e3).toISOString()}`);
|
|
3258
|
+
console.log(` Ends at: ${endDate.toISOString()}`);
|
|
3259
|
+
}
|
|
3260
|
+
console.log(` Creation block: ${creationBlock}`);
|
|
3271
3261
|
console.log(` Auction type: ${auctionType}`);
|
|
3272
3262
|
});
|
|
3273
3263
|
return cmd;
|
|
@@ -3278,7 +3268,7 @@ import { Command as Command5 } from "commander";
|
|
|
3278
3268
|
function statusCommand() {
|
|
3279
3269
|
const cmd = new Command5("status");
|
|
3280
3270
|
cmd.description("Query token contract information (read-only)");
|
|
3281
|
-
cmd.requiredOption("--contract <address>", "token contract address").option("--token-id <id>", "token ID to query (optional)").option("--chain <chain>", "chain to use (sepolia
|
|
3271
|
+
cmd.requiredOption("--contract <address>", "token contract address").option("--token-id <id>", "token ID to query (optional)").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").action(async (opts) => {
|
|
3282
3272
|
const chain = getActiveChain(opts.chain);
|
|
3283
3273
|
const publicClient = getPublicClient(chain);
|
|
3284
3274
|
const contractAddress = opts.contract;
|
|
@@ -3340,8 +3330,9 @@ import { Command as Command6 } from "commander";
|
|
|
3340
3330
|
import { generatePrivateKey as generatePrivateKey2, privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
3341
3331
|
function walletCommand() {
|
|
3342
3332
|
const cmd = new Command6("wallet");
|
|
3333
|
+
const supportedChainsText = supportedChains.join(", ");
|
|
3343
3334
|
cmd.description("Wallet management");
|
|
3344
|
-
cmd.command("generate").description("Generate a new Ethereum wallet and optionally save it to config").option("--chain <chain>",
|
|
3335
|
+
cmd.command("generate").description("Generate a new Ethereum wallet and optionally save it to config").option("--chain <chain>", `chain to save the key to (${supportedChainsText})`).option("--save", "save the generated key to config for the specified chain").action((opts) => {
|
|
3345
3336
|
const privateKey = generatePrivateKey2();
|
|
3346
3337
|
const account = privateKeyToAccount2(privateKey);
|
|
3347
3338
|
console.log("Generated new wallet:");
|
|
@@ -3350,11 +3341,12 @@ function walletCommand() {
|
|
|
3350
3341
|
console.log("");
|
|
3351
3342
|
console.log("\u26A0 Store your private key securely. It will not be shown again.");
|
|
3352
3343
|
if (opts.save) {
|
|
3353
|
-
const
|
|
3354
|
-
if (
|
|
3355
|
-
console.error(
|
|
3344
|
+
const selectedChain = opts.chain ?? "sepolia";
|
|
3345
|
+
if (!isSupportedChain(selectedChain)) {
|
|
3346
|
+
console.error(`Error: --chain must be one of: ${supportedChainsText}`);
|
|
3356
3347
|
process.exit(1);
|
|
3357
3348
|
}
|
|
3349
|
+
const chain = selectedChain;
|
|
3358
3350
|
const config = readConfig();
|
|
3359
3351
|
if (!config.chains[chain]) {
|
|
3360
3352
|
config.chains[chain] = {};
|
|
@@ -3365,7 +3357,7 @@ function walletCommand() {
|
|
|
3365
3357
|
Private key saved to config for chain: ${chain}`);
|
|
3366
3358
|
}
|
|
3367
3359
|
});
|
|
3368
|
-
cmd.command("address").description("Show the Ethereum address of the configured wallet").option("--chain <chain>",
|
|
3360
|
+
cmd.command("address").description("Show the Ethereum address of the configured wallet").option("--chain <chain>", `chain to use (${supportedChainsText})`).action((opts) => {
|
|
3369
3361
|
const chain = getActiveChain(opts.chain);
|
|
3370
3362
|
const { account } = getWalletClient(chain);
|
|
3371
3363
|
console.log(account.address);
|
|
@@ -3452,7 +3444,7 @@ function getWalletAddress(chain) {
|
|
|
3452
3444
|
function searchCommand() {
|
|
3453
3445
|
const cmd = new Command7("search");
|
|
3454
3446
|
cmd.description("Search NFTs and collections via the RARE Protocol API");
|
|
3455
|
-
cmd.command("tokens").description("Search NFTs").option("--chain <chain>", "chain to use (sepolia
|
|
3447
|
+
cmd.command("tokens").description("Search NFTs").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").option("--query <text>", "text search query", "").option("--owner <address>", "filter by owner address").option("--mine", "filter by your configured wallet address").option("--take <n>", "number of results per page", "24").option("--cursor <n>", "pagination cursor", "0").action(async (opts) => {
|
|
3456
3448
|
const chain = getActiveChain(opts.chain);
|
|
3457
3449
|
const ownerAddresses = opts.mine ? [getWalletAddress(chain)] : opts.owner ? [opts.owner] : [];
|
|
3458
3450
|
const label = opts.mine ? `NFTs owned by ${ownerAddresses[0]}` : opts.owner ? `NFTs owned by ${opts.owner}` : "NFTs";
|
|
@@ -3466,7 +3458,7 @@ function searchCommand() {
|
|
|
3466
3458
|
});
|
|
3467
3459
|
printPage(label, page.items, page.total, page.hasNextPage, formatNftRow);
|
|
3468
3460
|
});
|
|
3469
|
-
cmd.command("auctions").description("List NFTs with active or configured auctions").option("--chain <chain>", "chain to use (sepolia
|
|
3461
|
+
cmd.command("auctions").description("List NFTs with active or configured auctions").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").option("--state <states...>", "auction states to filter (PENDING, RUNNING, SETTLED, UNSETTLED)", ["PENDING", "RUNNING"]).option("--owner <address>", "filter by owner address (optional)").option("--query <text>", "text search query", "").option("--take <n>", "number of results per page", "24").option("--cursor <n>", "pagination cursor", "0").action(async (opts) => {
|
|
3470
3462
|
const chain = getActiveChain(opts.chain);
|
|
3471
3463
|
console.log(`Searching auctions (${opts.state.join(", ")}) on ${chain}...`);
|
|
3472
3464
|
const page = await searchNfts({
|
|
@@ -3479,7 +3471,7 @@ function searchCommand() {
|
|
|
3479
3471
|
});
|
|
3480
3472
|
printPage(`Auctions (${opts.state.join(", ")})`, page.items, page.total, page.hasNextPage, formatNftRow);
|
|
3481
3473
|
});
|
|
3482
|
-
cmd.command("collections").description("List collections owned by your wallet").option("--chain <chain>", "chain to use (sepolia
|
|
3474
|
+
cmd.command("collections").description("List collections owned by your wallet").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").option("--query <text>", "text search query", "").option("--take <n>", "number of results per page", "24").option("--cursor <n>", "pagination cursor", "0").action(async (opts) => {
|
|
3483
3475
|
const chain = getActiveChain(opts.chain);
|
|
3484
3476
|
const address = getWalletAddress(chain);
|
|
3485
3477
|
console.log(`Searching collections owned by ${address}...`);
|
|
@@ -3502,7 +3494,7 @@ function getWalletAddress2(chain) {
|
|
|
3502
3494
|
}
|
|
3503
3495
|
function listCollectionsCommand() {
|
|
3504
3496
|
const cmd = new Command8("list-collections");
|
|
3505
|
-
cmd.description("List all collections owned by your wallet").option("--chain <chain>", "chain to use (sepolia
|
|
3497
|
+
cmd.description("List all collections owned by your wallet").option("--chain <chain>", "chain to use (mainnet, sepolia, base, base-sepolia)").option("--query <text>", "text search filter", "").action(async (opts) => {
|
|
3506
3498
|
const chain = getActiveChain(opts.chain);
|
|
3507
3499
|
const address = getWalletAddress2(chain);
|
|
3508
3500
|
console.log(`Fetching collections for ${address} on ${chain}...
|
|
@@ -3567,7 +3559,7 @@ Contract imported successfully.`);
|
|
|
3567
3559
|
|
|
3568
3560
|
// src/index.ts
|
|
3569
3561
|
var program = new Command10();
|
|
3570
|
-
program.name("rare").description("CLI tool for interacting with the RARE protocol smart contracts").version("0.1
|
|
3562
|
+
program.name("rare").description("CLI tool for interacting with the RARE protocol smart contracts").version("0.2.1");
|
|
3571
3563
|
program.addCommand(configureCommand());
|
|
3572
3564
|
program.addCommand(deployCommand());
|
|
3573
3565
|
program.addCommand(mintCommand());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rareprotocol/rare-cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "CLI tool for interacting with the RARE protocol smart contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=22"
|
|
23
23
|
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
24
27
|
"files": [
|
|
25
28
|
"dist",
|
|
26
29
|
"LICENSE"
|