@netmind/arena-cli 0.10.2 → 0.10.4

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,17 @@ 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
+ }
528
+ function formatCutoff(c) {
529
+ const v = c.prediction_cutoff_time ?? c.predictionCutoffTime;
530
+ if (v == null || v === "") return "-";
531
+ return String(v);
532
+ }
522
533
  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
534
  "after",
524
535
  `
@@ -528,7 +539,16 @@ Examples:
528
539
  arena competitions list --joinable --page 2
529
540
  arena competitions list --joinable --json
530
541
 
531
- Output columns: id, name, type, status, players, entry_fee, prize`
542
+ Output columns: id, name, type, status, players, entry_fee, ticket, prize, cutoff
543
+
544
+ ticket column shows "USDC <amount> on <chain>" when joining requires a
545
+ USDC ticket (poll-prediction, link-promotion, ...). join in that case
546
+ must include ticketTransferTxHash. "-" means no ticket required.
547
+
548
+ cutoff column shows the ISO timestamp after which participation locks
549
+ (stock-prediction, poll-prediction). Submissions after this moment are
550
+ rejected even though the competition may still appear in listings. "-"
551
+ means no cutoff applies to this game type.`
532
552
  ).action(async (opts) => {
533
553
  try {
534
554
  const params = new URLSearchParams();
@@ -561,9 +581,11 @@ Output columns: id, name, type, status, players, entry_fee, prize`
561
581
  status: c.status,
562
582
  players: `${c.current_participants || c.participant_count || 0}/${c.max_participants || "\u221E"}`,
563
583
  entry_fee: c.entry_fee ?? 0,
564
- prize: c.prize_pool ?? "-"
584
+ ticket: formatTicket(c),
585
+ prize: c.prize_pool ?? "-",
586
+ cutoff: formatCutoff(c)
565
587
  })),
566
- ["id", "name", "type", "status", "players", "entry_fee", "prize"]
588
+ ["id", "name", "type", "status", "players", "entry_fee", "ticket", "prize", "cutoff"]
567
589
  );
568
590
  if (pagination && pagination.page < pagination.totalPages) {
569
591
  console.log(`page ${pagination.page}/${pagination.totalPages} (${pagination.total} total) \u2014 use --page ${pagination.page + 1} for next`);
@@ -586,18 +608,28 @@ var showCmd = new Command4("show").description("Show competition details").argum
586
608
  printCompact(c);
587
609
  return;
588
610
  }
589
- printKv({
611
+ const kv = {
590
612
  id: c.id,
591
613
  name: c.name,
592
614
  type: c.type || c.game_type,
593
615
  status: c.status,
594
616
  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
- });
617
+ entry_fee: c.entry_fee
618
+ };
619
+ const ticketPrice = c.ticket_price ?? c.ticketPrice;
620
+ if (ticketPrice != null && ticketPrice !== "") {
621
+ kv.ticket_price = `${ticketPrice} USDC`;
622
+ kv.ticket_chain = c.ticket_chain ?? c.ticketChain ?? "-";
623
+ }
624
+ kv.prize_pool = c.prize_pool;
625
+ kv.players = `${c.current_participants || 0}/${c.max_participants || "\u221E"}`;
626
+ kv.starts = c.start_time || c.starts_at;
627
+ kv.ends = c.end_time || c.ends_at;
628
+ const cutoff = c.prediction_cutoff_time ?? c.predictionCutoffTime;
629
+ if (cutoff != null && cutoff !== "") {
630
+ kv.prediction_cutoff_time = cutoff;
631
+ }
632
+ printKv(kv);
601
633
  } catch (e) {
602
634
  printError(e.message);
603
635
  process.exit(1);
@@ -688,6 +720,10 @@ function readJson(path) {
688
720
  return null;
689
721
  }
690
722
  }
723
+ function normalizeTicketField(v) {
724
+ if (v == null || v === "") return null;
725
+ return String(v);
726
+ }
691
727
  function loadCompetitionsCache() {
692
728
  return readJson(paths().COMPETITIONS_CACHE_FILE);
693
729
  }
@@ -705,11 +741,14 @@ async function syncCompetitions() {
705
741
  status: c.status || "open",
706
742
  // Handle both camelCase (public API / Drizzle ORM) and snake_case (admin API) field names
707
743
  entry_fee: c.entryFee ?? c.entry_fee ?? 0,
744
+ ticket_price: normalizeTicketField(c.ticketPrice ?? c.ticket_price),
745
+ ticket_chain: normalizeTicketField(c.ticketChain ?? c.ticket_chain),
708
746
  prize_pool: c.prizePool ?? c.prize_pool ?? null,
709
747
  current_participants: c.currentParticipants ?? c.current_participants ?? c.participant_count ?? 0,
710
748
  max_participants: c.maxParticipants ?? c.max_participants ?? null,
711
749
  start_time: c.startTime || c.start_time || c.starts_at || null,
712
- end_time: c.endTime || c.end_time || c.ends_at || null
750
+ end_time: c.endTime || c.end_time || c.ends_at || null,
751
+ prediction_cutoff_time: c.prediction_cutoff_time ?? c.predictionCutoffTime ?? null
713
752
  }));
714
753
  const cache = {
715
754
  synced_at: (/* @__PURE__ */ new Date()).toISOString(),