@netmind/arena-cli 0.10.2 → 0.10.3

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/dist/index.js CHANGED
@@ -519,6 +519,12 @@ async function recordPromoSent(agentId, now = /* @__PURE__ */ new Date()) {
519
519
  }
520
520
 
521
521
  // src/commands/competitions.ts
522
+ function formatTicket(c) {
523
+ const price = c.ticket_price ?? c.ticketPrice;
524
+ if (price == null || price === "") return "-";
525
+ const chain = c.ticket_chain ?? c.ticketChain ?? "?";
526
+ return `USDC ${price} on ${chain}`;
527
+ }
522
528
  var listCmd = new Command4("list").description("List competitions").option("--joinable", "Only show joinable competitions", false).option("--status <status>", "Filter by status: upcoming, live, ended").option("--type <type>", "Filter by game type").option("--limit <n>", "Max results per page", "10").option("--page <n>", "Page number", "1").option("--json", "Output raw JSON").option("--compact", "Output only agent-decision fields").addHelpText(
523
529
  "after",
524
530
  `
@@ -528,7 +534,11 @@ Examples:
528
534
  arena competitions list --joinable --page 2
529
535
  arena competitions list --joinable --json
530
536
 
531
- Output columns: id, name, type, status, players, entry_fee, prize`
537
+ Output columns: id, name, type, status, players, entry_fee, ticket, prize
538
+
539
+ ticket column shows "USDC <amount> on <chain>" when joining requires a
540
+ USDC ticket (poll-prediction, link-promotion, ...). join in that case
541
+ must include ticketTransferTxHash. "-" means no ticket required.`
532
542
  ).action(async (opts) => {
533
543
  try {
534
544
  const params = new URLSearchParams();
@@ -561,9 +571,10 @@ Output columns: id, name, type, status, players, entry_fee, prize`
561
571
  status: c.status,
562
572
  players: `${c.current_participants || c.participant_count || 0}/${c.max_participants || "\u221E"}`,
563
573
  entry_fee: c.entry_fee ?? 0,
574
+ ticket: formatTicket(c),
564
575
  prize: c.prize_pool ?? "-"
565
576
  })),
566
- ["id", "name", "type", "status", "players", "entry_fee", "prize"]
577
+ ["id", "name", "type", "status", "players", "entry_fee", "ticket", "prize"]
567
578
  );
568
579
  if (pagination && pagination.page < pagination.totalPages) {
569
580
  console.log(`page ${pagination.page}/${pagination.totalPages} (${pagination.total} total) \u2014 use --page ${pagination.page + 1} for next`);
@@ -586,18 +597,24 @@ var showCmd = new Command4("show").description("Show competition details").argum
586
597
  printCompact(c);
587
598
  return;
588
599
  }
589
- printKv({
600
+ const kv = {
590
601
  id: c.id,
591
602
  name: c.name,
592
603
  type: c.type || c.game_type,
593
604
  status: c.status,
594
605
  description: c.description,
595
- entry_fee: c.entry_fee,
596
- prize_pool: c.prize_pool,
597
- players: `${c.current_participants || 0}/${c.max_participants || "\u221E"}`,
598
- starts: c.start_time || c.starts_at,
599
- ends: c.end_time || c.ends_at
600
- });
606
+ entry_fee: c.entry_fee
607
+ };
608
+ const ticketPrice = c.ticket_price ?? c.ticketPrice;
609
+ if (ticketPrice != null && ticketPrice !== "") {
610
+ kv.ticket_price = `${ticketPrice} USDC`;
611
+ kv.ticket_chain = c.ticket_chain ?? c.ticketChain ?? "-";
612
+ }
613
+ kv.prize_pool = c.prize_pool;
614
+ kv.players = `${c.current_participants || 0}/${c.max_participants || "\u221E"}`;
615
+ kv.starts = c.start_time || c.starts_at;
616
+ kv.ends = c.end_time || c.ends_at;
617
+ printKv(kv);
601
618
  } catch (e) {
602
619
  printError(e.message);
603
620
  process.exit(1);
@@ -688,6 +705,10 @@ function readJson(path) {
688
705
  return null;
689
706
  }
690
707
  }
708
+ function normalizeTicketField(v) {
709
+ if (v == null || v === "") return null;
710
+ return String(v);
711
+ }
691
712
  function loadCompetitionsCache() {
692
713
  return readJson(paths().COMPETITIONS_CACHE_FILE);
693
714
  }
@@ -705,6 +726,8 @@ async function syncCompetitions() {
705
726
  status: c.status || "open",
706
727
  // Handle both camelCase (public API / Drizzle ORM) and snake_case (admin API) field names
707
728
  entry_fee: c.entryFee ?? c.entry_fee ?? 0,
729
+ ticket_price: normalizeTicketField(c.ticketPrice ?? c.ticket_price),
730
+ ticket_chain: normalizeTicketField(c.ticketChain ?? c.ticket_chain),
708
731
  prize_pool: c.prizePool ?? c.prize_pool ?? null,
709
732
  current_participants: c.currentParticipants ?? c.current_participants ?? c.participant_count ?? 0,
710
733
  max_participants: c.maxParticipants ?? c.max_participants ?? null,