@clawdvault/cli 0.3.3 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +39 -0
  2. package/dist/index.js +77 -13
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -64,6 +64,37 @@ clawdvault trade sell --mint TOKEN_MINT_ADDRESS --amount 1000000
64
64
  clawdvault trade sell --mint TOKEN_MINT_ADDRESS --percent 50
65
65
  ```
66
66
 
67
+ ## USD Price Display
68
+
69
+ As of v0.4.0, the CLI displays USD prices by default for all price and market cap values:
70
+
71
+ ```bash
72
+ # Token list shows USD price and market cap
73
+ clawdvault tokens list
74
+ # Output: SYMBOL | Name | $0.001234 | $50,000 | ...
75
+
76
+ # Token details shows USD with SOL in parentheses
77
+ clawdvault token get <mint>
78
+ # Output: Price: $0.001234 (0.00000678 SOL)
79
+
80
+ # Stats shows USD market cap
81
+ clawdvault token stats <mint>
82
+ # Output: Market Cap: $50,000
83
+
84
+ # Trade history shows USD prices
85
+ clawdvault trade history -m <mint>
86
+ # Output: Shows price_usd for each trade
87
+
88
+ # Candles default to USD
89
+ clawdvault token candles <mint>
90
+ # Output: OHLCV values in USD
91
+
92
+ # Use --currency sol for SOL-denominated candles
93
+ clawdvault token candles <mint> --currency sol
94
+ ```
95
+
96
+ **Breaking Change:** Previous versions displayed SOL values by default. USD is now the default currency for price display.
97
+
67
98
  ## Commands Reference
68
99
 
69
100
  ### `clawdvault tokens`
@@ -112,10 +143,18 @@ clawdvault token stats <mint> [--json]
112
143
  # Get top holders
113
144
  clawdvault token holders <mint> [--json]
114
145
 
146
+ # Get price candles
147
+ clawdvault token candles <mint> [options]
148
+ -i, --interval <interval> Candle interval: 1m, 5m, 15m, 1h, 1d (default: 5m)
149
+ -l, --limit <count> Number of candles (default: 100)
150
+ -c, --currency <currency> Currency: sol or usd (default: usd)
151
+ --json Output as JSON
152
+
115
153
  Examples:
116
154
  clawdvault token get 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
117
155
  clawdvault token create -n "Moon Token" -s "MOON" -i ./moon.png
118
156
  clawdvault token create --name "Test" --symbol "TEST" --initial-buy 0.5
157
+ clawdvault token candles <mint> --interval 15m --currency usd
119
158
  ```
120
159
 
121
160
  ### `clawdvault trade`
package/dist/index.js CHANGED
@@ -163,7 +163,13 @@ function formatTokens(amount) {
163
163
  return amount.toFixed(2);
164
164
  }
165
165
  function formatUsd(amount) {
166
- return `$${amount.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
166
+ const absAmount = Math.abs(amount);
167
+ let maximumFractionDigits = 2;
168
+ if (absAmount < 1e-6) maximumFractionDigits = 10;
169
+ else if (absAmount < 1e-4) maximumFractionDigits = 8;
170
+ else if (absAmount < 0.01) maximumFractionDigits = 6;
171
+ else if (absAmount < 1) maximumFractionDigits = 4;
172
+ return `$${amount.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits })}`;
167
173
  }
168
174
  function formatPercent(value) {
169
175
  const formatted = (value * 100).toFixed(2);
@@ -249,8 +255,8 @@ tokensCommand.command("list").description("List all tokens").option("-s, --sort
249
255
  table.push([
250
256
  import_chalk2.default.bold(token.symbol ?? "???"),
251
257
  token.name ?? "Unknown",
252
- formatSol(token.price_sol ?? 0),
253
- formatSol(token.market_cap_sol ?? 0),
258
+ formatUsd(token.price_usd ?? 0),
259
+ formatUsd(token.market_cap_usd ?? 0),
254
260
  token.volume_24h ? formatSol(token.volume_24h) : "-",
255
261
  status,
256
262
  shortenAddress(token.mint ?? "")
@@ -301,8 +307,8 @@ tokenCommand.command("get <mint>").description("Get token details").option("--js
301
307
  table.push(
302
308
  { [import_chalk3.default.cyan("Mint")]: token.mint ?? "" },
303
309
  { [import_chalk3.default.cyan("Creator")]: shortenAddress(token.creator ?? "") },
304
- { [import_chalk3.default.cyan("Price")]: formatSol(token.price_sol ?? 0) },
305
- { [import_chalk3.default.cyan("Market Cap")]: formatSol(token.market_cap_sol ?? 0) },
310
+ { [import_chalk3.default.cyan("Price")]: `${formatUsd(token.price_usd ?? 0)} (${formatSol(token.price_sol ?? 0)})` },
311
+ { [import_chalk3.default.cyan("Market Cap")]: formatUsd(token.market_cap_usd ?? 0) },
306
312
  { [import_chalk3.default.cyan("Status")]: token.graduated ? "\u{1F393} Graduated" : "\u{1F4C8} Bonding Curve" }
307
313
  );
308
314
  if (token.description) {
@@ -327,6 +333,7 @@ tokenCommand.command("get <mint>").description("Get token details").option("--js
327
333
  import_chalk3.default.cyan("Type"),
328
334
  import_chalk3.default.cyan("SOL"),
329
335
  import_chalk3.default.cyan("Tokens"),
336
+ import_chalk3.default.cyan("Price USD"),
330
337
  import_chalk3.default.cyan("Trader"),
331
338
  import_chalk3.default.cyan("Time")
332
339
  ],
@@ -338,6 +345,7 @@ tokenCommand.command("get <mint>").description("Get token details").option("--js
338
345
  typeStr,
339
346
  formatSol(trade.sol_amount ?? 0),
340
347
  formatTokens(trade.token_amount ?? 0),
348
+ formatUsd(trade.price_usd ?? 0),
341
349
  shortenAddress(trade.trader ?? ""),
342
350
  new Date(trade.created_at ?? Date.now()).toLocaleString()
343
351
  ]);
@@ -418,12 +426,13 @@ tokenCommand.command("stats <mint>").description("Get on-chain stats").option("-
418
426
  style: { head: [], border: [] }
419
427
  });
420
428
  table.push(
421
- { [import_chalk3.default.cyan("Price")]: formatSol(onChain.price ?? 0) },
422
- { [import_chalk3.default.cyan("Market Cap")]: formatSol(onChain.marketCap ?? 0) },
429
+ { [import_chalk3.default.cyan("Price")]: `${formatUsd(onChain.priceUsd ?? 0)} (${formatSol(onChain.price ?? 0)})` },
430
+ { [import_chalk3.default.cyan("Market Cap")]: formatUsd(onChain.marketCapUsd ?? 0) },
423
431
  { [import_chalk3.default.cyan("Total Supply")]: formatTokens(onChain.totalSupply ?? 0) },
424
432
  { [import_chalk3.default.cyan("Circulating")]: formatTokens(onChain.circulatingSupply ?? 0) },
425
433
  { [import_chalk3.default.cyan("Curve Balance")]: formatTokens(onChain.bondingCurveBalance ?? 0) },
426
434
  { [import_chalk3.default.cyan("Curve SOL")]: formatSol(onChain.bondingCurveSol ?? 0) },
435
+ { [import_chalk3.default.cyan("SOL Price")]: formatUsd(onChain.solPriceUsd ?? 0) },
427
436
  { [import_chalk3.default.cyan("Status")]: onChain.graduated ? "\u{1F393} Graduated" : "\u{1F4C8} Bonding" }
428
437
  );
429
438
  console.log(table.toString());
@@ -472,6 +481,61 @@ tokenCommand.command("holders <mint>").description("Get top token holders").opti
472
481
  handleError(err);
473
482
  }
474
483
  });
484
+ tokenCommand.command("candles <mint>").description("Get price candles").option("-i, --interval <interval>", "Candle interval (1m, 5m, 15m, 1h, 1d)", "5m").option("-l, --limit <count>", "Number of candles to fetch", "100").option("-c, --currency <currency>", "Currency for prices (sol or usd)", "usd").option("--json", "Output as JSON").action(async (mint, options) => {
485
+ const spin = spinner("Fetching candles...").start();
486
+ try {
487
+ const client = createReadOnlyClient();
488
+ const result = await client.getCandles({
489
+ mint,
490
+ interval: options.interval,
491
+ limit: parseInt(options.limit),
492
+ currency: options.currency
493
+ });
494
+ spin.stop();
495
+ if (options.json) {
496
+ console.log(JSON.stringify(result, null, 2));
497
+ return;
498
+ }
499
+ console.log(import_chalk3.default.bold(`
500
+ \u{1F4CA} Price Candles (${options.currency.toUpperCase()})
501
+ `));
502
+ const candles = result.candles ?? [];
503
+ if (candles.length === 0) {
504
+ console.log(import_chalk3.default.yellow("No candles available"));
505
+ return;
506
+ }
507
+ const table = new import_cli_table32.default({
508
+ head: [
509
+ import_chalk3.default.cyan("Time"),
510
+ import_chalk3.default.cyan("Open"),
511
+ import_chalk3.default.cyan("High"),
512
+ import_chalk3.default.cyan("Low"),
513
+ import_chalk3.default.cyan("Close"),
514
+ import_chalk3.default.cyan("Volume")
515
+ ],
516
+ style: { head: [], border: [] }
517
+ });
518
+ const isUsd = options.currency === "usd";
519
+ const formatPrice = isUsd ? formatUsd : formatSol;
520
+ candles.slice(-20).forEach((c) => {
521
+ table.push([
522
+ new Date(c.time * 1e3).toLocaleString(),
523
+ formatPrice(c.open),
524
+ formatPrice(c.high),
525
+ formatPrice(c.low),
526
+ formatPrice(c.close),
527
+ formatTokens(c.volume)
528
+ ]);
529
+ });
530
+ console.log(table.toString());
531
+ console.log();
532
+ console.log(import_chalk3.default.gray(`Showing last ${Math.min(20, candles.length)} of ${candles.length} candles`));
533
+ console.log();
534
+ } catch (err) {
535
+ spin.stop();
536
+ handleError(err);
537
+ }
538
+ });
475
539
 
476
540
  // src/commands/trade.ts
477
541
  var import_commander3 = require("commander");
@@ -499,7 +563,7 @@ tradeCommand.command("buy").description("Buy tokens").requiredOption("-m, --mint
499
563
  table.push(
500
564
  { [import_chalk4.default.cyan("Input")]: `${solAmount} SOL` },
501
565
  { [import_chalk4.default.cyan("Output")]: `~${formatTokens(quote.output ?? 0)} tokens` },
502
- { [import_chalk4.default.cyan("Price")]: formatSol(quote.current_price ?? 0) },
566
+ { [import_chalk4.default.cyan("Price per Token")]: formatSol(quote.current_price ?? 0) },
503
567
  { [import_chalk4.default.cyan("Fee")]: formatSol(quote.fee ?? 0) },
504
568
  { [import_chalk4.default.cyan("Price Impact")]: formatPercent(priceImpact) },
505
569
  { [import_chalk4.default.cyan("Slippage")]: `${(slippage * 100).toFixed(1)}%` }
@@ -577,7 +641,7 @@ tradeCommand.command("sell").description("Sell tokens").requiredOption("-m, --mi
577
641
  table.push(
578
642
  { [import_chalk4.default.cyan("Input")]: `${formatTokens(tokenAmount)} tokens` },
579
643
  { [import_chalk4.default.cyan("Output")]: `~${formatSol(quote.output ?? 0)}` },
580
- { [import_chalk4.default.cyan("Price")]: formatSol(quote.current_price ?? 0) },
644
+ { [import_chalk4.default.cyan("Price per Token")]: formatSol(quote.current_price ?? 0) },
581
645
  { [import_chalk4.default.cyan("Fee")]: formatSol(quote.fee ?? 0) },
582
646
  { [import_chalk4.default.cyan("Price Impact")]: formatPercent(-sellPriceImpact) },
583
647
  { [import_chalk4.default.cyan("Slippage")]: `${(slippage * 100).toFixed(1)}%` }
@@ -639,7 +703,7 @@ tradeCommand.command("quote").description("Get a price quote without executing")
639
703
  table.push(
640
704
  { [import_chalk4.default.cyan("Input")]: isBuy ? `${options.amount} SOL` : `${formatTokens(parseFloat(options.amount))} tokens` },
641
705
  { [import_chalk4.default.cyan("Output")]: isBuy ? `~${formatTokens(quote.output ?? 0)} tokens` : `~${formatSol(quote.output ?? 0)}` },
642
- { [import_chalk4.default.cyan("Price")]: formatSol(quote.current_price ?? 0) },
706
+ { [import_chalk4.default.cyan("Price per Token")]: formatSol(quote.current_price ?? 0) },
643
707
  { [import_chalk4.default.cyan("Fee")]: formatSol(quote.fee ?? 0) },
644
708
  { [import_chalk4.default.cyan("Price Impact")]: formatPercent(isBuy ? quotePriceImpact : -quotePriceImpact) }
645
709
  );
@@ -671,7 +735,7 @@ tradeCommand.command("history").description("Get trade history for a token").req
671
735
  import_chalk4.default.cyan("Type"),
672
736
  import_chalk4.default.cyan("SOL"),
673
737
  import_chalk4.default.cyan("Tokens"),
674
- import_chalk4.default.cyan("Price"),
738
+ import_chalk4.default.cyan("Price USD"),
675
739
  import_chalk4.default.cyan("Trader"),
676
740
  import_chalk4.default.cyan("Time")
677
741
  ],
@@ -683,7 +747,7 @@ tradeCommand.command("history").description("Get trade history for a token").req
683
747
  typeStr,
684
748
  formatSol(trade.sol_amount ?? 0),
685
749
  formatTokens(trade.token_amount ?? 0),
686
- formatSol(trade.price ?? 0),
750
+ formatUsd(trade.price_usd ?? 0),
687
751
  shortenAddress(trade.trader ?? ""),
688
752
  new Date(trade.created_at ?? Date.now()).toLocaleString()
689
753
  ]);
@@ -1295,7 +1359,7 @@ chatCommand.command("unreact").description("Remove reaction from a message").req
1295
1359
 
1296
1360
  // src/index.ts
1297
1361
  var program = new import_commander6.Command();
1298
- program.name("clawdvault").description("CLI for ClawdVault - Solana token launchpad").version("0.1.0");
1362
+ program.name("clawdvault").description("CLI for ClawdVault - Solana token launchpad").version("0.4.0");
1299
1363
  program.addCommand(tokensCommand);
1300
1364
  program.addCommand(tokenCommand);
1301
1365
  program.addCommand(tradeCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawdvault/cli",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "CLI for ClawdVault - Solana token launchpad",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -15,7 +15,7 @@
15
15
  "clean": "rm -rf dist"
16
16
  },
17
17
  "dependencies": {
18
- "@clawdvault/sdk": "^0.3.2",
18
+ "@clawdvault/sdk": "^0.4.0",
19
19
  "@solana/spl-token": "^0.4.0",
20
20
  "@solana/web3.js": "^1.91.0",
21
21
  "bip39": "^3.1.0",