@block52/poker-vm-sdk 1.23.0 → 1.24.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.d.ts CHANGED
@@ -44953,11 +44953,11 @@ interface MsgCreateGame {
44953
44953
  */
44954
44954
  bettingLimit: string;
44955
44955
  /**
44956
- * Scheduled start for a sit-and-go, unix seconds (field 21). With it,
44957
- * min_players may be below max_players: the tournament starts when the table
44958
- * fills or at this time with at least min_players registered, and is
44959
- * cancelled with refunds if fewer have registered 15 minutes after it.
44960
- * 0 = unscheduled: starts only when full. (poker-vm#2680)
44956
+ * Start of a tournament, unix seconds (poker-vm#2680, #2776). Required for a
44957
+ * tournament and refused otherwise. It starts at this time with at least
44958
+ * min_players registered (the engine's START action), never earlier, and is
44959
+ * cancelled with refunds if fewer have registered 15 minutes after it. A
44960
+ * sit-and-go has none: it starts when the table fills.
44961
44961
  */
44962
44962
  startTime: Long;
44963
44963
  /**
@@ -44976,9 +44976,9 @@ interface MsgCreateGame {
44976
44976
  */
44977
44977
  lateRegistrationLevels: number;
44978
44978
  /**
44979
- * Hold a scheduled sit-and-go until start_time even when the table fills
44980
- * first (poker-vm#2760): it starts only at the start time. Requires
44981
- * start_time. false = it starts when the table fills, as before.
44979
+ * Hold a table until start_time even when it fills first (poker-vm#2760). A
44980
+ * tournament always does, whatever this says; only sent by older clients.
44981
+ * Refused on any other format.
44982
44982
  */
44983
44983
  waitForStartTime: boolean;
44984
44984
  }
package/dist/index.esm.js CHANGED
@@ -56168,7 +56168,7 @@ var NonPlayerActionType;
56168
56168
  NonPlayerActionType["TIMEOUT"] = "timeout";
56169
56169
  // Time bank (ui#19/#20): the player to act extends their turn's action-clock
56170
56170
  // deadline by their whole bank, once per decision: gameOptions.timeBankMs
56171
- // the first time, 30s the second, then empty, refilling 5s per orbit up to
56171
+ // the first time, 30s the second, then 5s refilling 5s per orbit up to
56172
56172
  // gameOptions.timeBankCapMs. Records a no-chip turn that does NOT advance the
56173
56173
  // betting order or move the clock anchor; the deadline adds the user's
56174
56174
  // PlayerDTO.timeBankLastGrantMs for the current turn. Rejected off-turn,
@@ -71849,35 +71849,43 @@ function gaslessFee(gasLimit = DEFAULT_GAS_LIMIT) {
71849
71849
  };
71850
71850
  }
71851
71851
  /**
71852
- * Fail fast on a sit-and-go field the chain would refuse (poker-vm#2680):
71853
- * seats 2..9, min <= max, and a flexible field (min < max) needs a scheduled
71854
- * start in the future. Mirrors x/poker/keeper/msg_server_create_game.go.
71852
+ * Fail fast on a sit-and-go or tournament the chain would refuse. Both have seats
71853
+ * 2..9 and min <= max. A sit-and-go starts when the table fills, so its field is
71854
+ * fixed and it has no start time. A tournament needs a start time in the future
71855
+ * (poker-vm#2776). Mirrors x/poker/keeper/msg_server_create_game.go.
71855
71856
  */
71856
- function assertCreatableSngField(minPlayers, maxPlayers, sngConfig, nowSeconds = Math.floor(Date.now() / 1000)) {
71857
+ function assertCreatableSngField(gameFormat, minPlayers, maxPlayers, sngConfig, nowSeconds = Math.floor(Date.now() / 1000)) {
71857
71858
  if (maxPlayers < 2 || maxPlayers > 9) {
71858
- throw new Error(`sit-and-go maxPlayers must be 2..9; got ${maxPlayers}.`);
71859
+ throw new Error(`${gameFormat} maxPlayers must be 2..9; got ${maxPlayers}.`);
71859
71860
  }
71860
71861
  if (minPlayers < 2 || minPlayers > maxPlayers) {
71861
- throw new Error(`sit-and-go minPlayers must be 2..maxPlayers (${maxPlayers}); got ${minPlayers}.`);
71862
+ throw new Error(`${gameFormat} minPlayers must be 2..maxPlayers (${maxPlayers}); got ${minPlayers}.`);
71862
71863
  }
71863
71864
  const startTime = sngConfig?.startTime;
71864
- if (minPlayers !== maxPlayers && !startTime) {
71865
- throw new Error("sit-and-go with minPlayers < maxPlayers needs sngConfig.startTime (a scheduled start).");
71866
- }
71867
- if (startTime !== undefined && startTime <= nowSeconds) {
71868
- throw new Error(`sngConfig.startTime ${startTime} must be in the future (now ${nowSeconds}).`);
71869
- }
71870
71865
  const levels = sngConfig?.lateRegistrationLevels;
71871
- if (levels !== undefined) {
71872
- if (!Number.isInteger(levels) || levels <= 0) {
71873
- throw new Error(`sngConfig.lateRegistrationLevels must be a positive whole number of levels; got ${levels}.`);
71874
- }
71866
+ if (levels !== undefined && (!Number.isInteger(levels) || levels <= 0)) {
71867
+ throw new Error(`sngConfig.lateRegistrationLevels must be a positive whole number of levels; got ${levels}.`);
71868
+ }
71869
+ if (gameFormat === GameFormat.TOURNAMENT) {
71875
71870
  if (!startTime) {
71876
- throw new Error("sngConfig.lateRegistrationLevels needs sngConfig.startTime (late registration is for a scheduled sit-and-go).");
71871
+ throw new Error("tournament needs sngConfig.startTime.");
71872
+ }
71873
+ if (startTime <= nowSeconds) {
71874
+ throw new Error(`sngConfig.startTime ${startTime} must be in the future (now ${nowSeconds}).`);
71877
71875
  }
71876
+ return;
71877
+ }
71878
+ if (minPlayers !== maxPlayers) {
71879
+ throw new Error("sit-and-go needs minPlayers == maxPlayers (it starts when the table fills); a flexible field is a tournament.");
71880
+ }
71881
+ if (startTime) {
71882
+ throw new Error("sngConfig.startTime is only valid for a tournament.");
71883
+ }
71884
+ if (levels !== undefined) {
71885
+ throw new Error("sngConfig.lateRegistrationLevels is only valid for a tournament.");
71878
71886
  }
71879
- if (sngConfig?.waitForStartTime && !startTime) {
71880
- throw new Error("sngConfig.waitForStartTime needs sngConfig.startTime (it holds a scheduled sit-and-go until its start time).");
71887
+ if (sngConfig?.waitForStartTime) {
71888
+ throw new Error("sngConfig.waitForStartTime is only valid for a tournament.");
71881
71889
  }
71882
71890
  }
71883
71891
  /**
@@ -72012,7 +72020,7 @@ class SigningCosmosClient extends CosmosClient {
72012
72020
  if (!sngConfig.blindStructure && (!sngConfig.blindLevelDuration || sngConfig.blindLevelDuration <= 0)) {
72013
72021
  throw new Error(`${gameFormat} games require a positive blindLevelDuration (or a blindStructure); got ${sngConfig.blindLevelDuration}.`);
72014
72022
  }
72015
- assertCreatableSngField(minPlayers, maxPlayers, sngConfig);
72023
+ assertCreatableSngField(gameFormat, minPlayers, maxPlayers, sngConfig);
72016
72024
  }
72017
72025
  assertCreatableBettingLimit(bettingLimit, gameVariant);
72018
72026
  await this.initializeSigningClient();