@t2000/cli 0.22.5 → 0.22.6

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
@@ -308,7 +308,7 @@ t2000 mcp uninstall
308
308
  t2000 mcp
309
309
  ```
310
310
 
311
- 33 tools, 20 prompts, safeguard enforced. See [MCP setup guide](../../docs/mcp-setup.md) for details.
311
+ 35 tools, 20 prompts, safeguard enforced. See [MCP setup guide](../../docs/mcp-setup.md) for details.
312
312
 
313
313
  ### HTTP API Server
314
314
 
package/dist/index.js CHANGED
@@ -504,7 +504,6 @@ var ACTION_LABELS = {
504
504
  lending: "\u{1F3E6} lend",
505
505
  swap: "\u{1F504} swap",
506
506
  "mpp payment": "\u{1F4B3} mpp",
507
- split: "\u2702 split",
508
507
  transaction: "\u{1F4E6} tx"
509
508
  };
510
509
  function relativeTime(ts) {
@@ -518,11 +517,53 @@ function relativeTime(ts) {
518
517
  if (days < 7) return `${days}d ago`;
519
518
  return new Date(ts).toLocaleDateString();
520
519
  }
520
+ function formatAmount(tx) {
521
+ if (!tx.amount) return "";
522
+ return pc4.bold(`${tx.amount.toFixed(tx.amount < 0.01 ? 4 : 2)} ${tx.asset ?? ""}`);
523
+ }
524
+ function printTxSummary(tx) {
525
+ const label = ACTION_LABELS[tx.action] ?? `\u{1F4E6} ${tx.action}`;
526
+ const time = tx.timestamp ? relativeTime(tx.timestamp) : "";
527
+ const amount = formatAmount(tx);
528
+ const recipient = tx.recipient ? pc4.dim(`\u2192 ${truncateAddress2(tx.recipient)}`) : "";
529
+ const link = pc4.dim(explorerUrl(tx.digest));
530
+ printLine(`${label} ${amount} ${recipient}`);
531
+ printLine(` ${pc4.dim(truncateAddress2(tx.digest))} ${pc4.dim(time)}`);
532
+ printLine(` ${link}`);
533
+ }
534
+ function printTxDetail(tx) {
535
+ printHeader("Transaction Detail");
536
+ const label = ACTION_LABELS[tx.action] ?? `\u{1F4E6} ${tx.action}`;
537
+ printKeyValue("Type", label);
538
+ printKeyValue("Digest", tx.digest);
539
+ if (tx.amount) printKeyValue("Amount", `${tx.amount.toFixed(tx.amount < 0.01 ? 6 : 4)} ${tx.asset ?? ""}`);
540
+ if (tx.recipient) printKeyValue("Recipient", tx.recipient);
541
+ if (tx.timestamp) {
542
+ printKeyValue("Time", `${new Date(tx.timestamp).toLocaleString()} (${relativeTime(tx.timestamp)})`);
543
+ }
544
+ if (tx.gasCost !== void 0) printKeyValue("Gas", `${tx.gasCost.toFixed(6)} SUI`);
545
+ printBlank();
546
+ printKeyValue("Explorer", explorerUrl(tx.digest));
547
+ printBlank();
548
+ }
521
549
  function registerHistory(program2) {
522
- program2.command("history").description("Show transaction history").option("--limit <n>", "Number of transactions", "20").option("--key <path>", "Key file path").action(async (opts) => {
550
+ program2.command("history").description("Show transaction history, or detail for a specific digest").argument("[digest]", "Transaction digest to view details").option("--limit <n>", "Number of transactions", "20").option("--key <path>", "Key file path").action(async (digest, opts) => {
523
551
  try {
524
552
  const pin = await resolvePin();
525
553
  const agent = await T20006.create({ pin, keyPath: opts.key });
554
+ if (digest) {
555
+ const tx = await agent.transactionDetail(digest);
556
+ if (!tx) {
557
+ handleError(new Error(`Transaction not found: ${digest}`));
558
+ return;
559
+ }
560
+ if (isJsonMode()) {
561
+ printJson(tx);
562
+ return;
563
+ }
564
+ printTxDetail(tx);
565
+ return;
566
+ }
526
567
  const txns = await agent.history({ limit: parseInt(opts.limit, 10) });
527
568
  if (isJsonMode()) {
528
569
  printJson(txns);
@@ -533,14 +574,7 @@ function registerHistory(program2) {
533
574
  printInfo("No transactions yet.");
534
575
  } else {
535
576
  for (const tx of txns) {
536
- const label = ACTION_LABELS[tx.action] ?? `\u{1F4E6} ${tx.action}`;
537
- const time = tx.timestamp ? relativeTime(tx.timestamp) : "";
538
- const amount = tx.amount ? pc4.bold(`${tx.amount.toFixed(tx.amount < 0.01 ? 4 : 2)} ${tx.asset ?? ""}`) : "";
539
- const recipient = tx.recipient ? pc4.dim(`\u2192 ${truncateAddress2(tx.recipient)}`) : "";
540
- const link = pc4.dim(explorerUrl(tx.digest));
541
- printLine(`${label} ${amount} ${recipient}`);
542
- printLine(` ${pc4.dim(truncateAddress2(tx.digest))} ${pc4.dim(time)}`);
543
- printLine(` ${link}`);
577
+ printTxSummary(tx);
544
578
  printBlank();
545
579
  }
546
580
  }