@netmind/arena-cli 0.28.0 → 0.29.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.
package/dist/index.js CHANGED
@@ -722,6 +722,13 @@ async function syncCompetitions() {
722
722
  ticket_price: normalizeTicketField(c.ticketPrice ?? c.ticket_price),
723
723
  ticket_chain: normalizeTicketField(c.ticketChain ?? c.ticket_chain),
724
724
  prize_pool: c.prizePool ?? c.prize_pool ?? null,
725
+ // Spread, not fixed keys: the server omits these on credits-only
726
+ // competitions, and a cache entry written by an older CLI has neither.
727
+ ...c.crypto_prize_pool == null && c.cryptoPrizePool == null ? {} : {
728
+ crypto_prize_pool: String(c.cryptoPrizePool ?? c.crypto_prize_pool),
729
+ crypto_currency: String(c.cryptoCurrency ?? c.crypto_currency ?? "USDC"),
730
+ ...c.funding_status == null && c.fundingStatus == null ? {} : { funding_status: String(c.fundingStatus ?? c.funding_status) }
731
+ },
725
732
  current_participants: c.currentParticipants ?? c.current_participants ?? c.participant_count ?? 0,
726
733
  max_participants: c.maxParticipants ?? c.max_participants ?? null,
727
734
  start_time: c.startTime || c.start_time || c.starts_at || null,
@@ -939,6 +946,28 @@ function formatCutoff(c) {
939
946
  if (v == null || v === "") return "-";
940
947
  return String(v);
941
948
  }
949
+ function cryptoPrizeOf(c) {
950
+ const amount = c.crypto_prize_pool ?? c.cryptoPrizePool;
951
+ if (amount == null || amount === "") return null;
952
+ if (!(Number(amount) > 0)) return null;
953
+ const currency = c.crypto_currency ?? c.cryptoCurrency;
954
+ const funding = c.funding_status ?? c.fundingStatus;
955
+ return {
956
+ amount: String(amount),
957
+ currency: currency == null || currency === "" ? "USDC" : String(currency),
958
+ funding: funding == null || funding === "" ? null : String(funding)
959
+ };
960
+ }
961
+ function formatPrize(c) {
962
+ const crypto = cryptoPrizeOf(c);
963
+ const credits = c.prize_pool ?? c.prizePool;
964
+ if (crypto) {
965
+ const flagged = crypto.funding && crypto.funding !== "confirmed" ? ` (${crypto.funding})` : "";
966
+ const cryptoPart = `${crypto.amount} ${crypto.currency}${flagged}`;
967
+ return credits != null && credits !== "" && Number(credits) > 0 ? `${cryptoPart} + ${credits} CR` : cryptoPart;
968
+ }
969
+ return String(credits ?? "-");
970
+ }
942
971
  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(
943
972
  "after",
944
973
  `
@@ -991,7 +1020,7 @@ means no cutoff applies to this game type.`
991
1020
  players: `${c.current_participants || c.participant_count || 0}/${c.max_participants || "\u221E"}`,
992
1021
  entry_fee: c.entry_fee ?? 0,
993
1022
  ticket: formatTicket(c),
994
- prize: c.prize_pool ?? "-",
1023
+ prize: formatPrize(c),
995
1024
  cutoff: formatCutoff(c)
996
1025
  })),
997
1026
  ["id", "name", "type", "status", "players", "entry_fee", "ticket", "prize", "cutoff"]
@@ -1031,6 +1060,11 @@ var showCmd = new Command4("show").description("Show competition details").argum
1031
1060
  kv.ticket_chain = c.ticket_chain ?? c.ticketChain ?? "-";
1032
1061
  }
1033
1062
  kv.prize_pool = c.prize_pool;
1063
+ const cryptoPrize = cryptoPrizeOf(c);
1064
+ if (cryptoPrize) {
1065
+ kv.crypto_prize_pool = `${cryptoPrize.amount} ${cryptoPrize.currency}`;
1066
+ if (cryptoPrize.funding) kv.funding_status = cryptoPrize.funding;
1067
+ }
1034
1068
  kv.players = `${c.current_participants || 0}/${c.max_participants || "\u221E"}`;
1035
1069
  kv.starts = c.start_time || c.starts_at;
1036
1070
  kv.ends = c.end_time || c.ends_at;
@@ -5821,7 +5855,8 @@ async function runAptiSubmit(raw) {
5821
5855
  auth: true
5822
5856
  });
5823
5857
  }
5824
- var submitCmd2 = new Command30("submit").description("Submit your answers and get your personality type").argument("<answers>", "One choice per question, in order \u2014 e.g. a,b,c,a,c,...").option("--json", "Output raw JSON").action(async (answers, opts) => {
5858
+ var submitCmd2 = new Command30("submit").description("Submit your answers and get your personality type").argument("<answers>", "One choice per question, in order \u2014 e.g. a,b,c,a,c,...").option("--json", "Output raw JSON").action(async (answers, _opts, command) => {
5859
+ const opts = command.optsWithGlobals();
5825
5860
  try {
5826
5861
  const result = await runAptiSubmit(answers);
5827
5862
  if (opts.json) {