@block52/poker-vm-sdk 1.7.0 → 1.10.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
@@ -2848,6 +2848,7 @@ function createBaseMsgCreateGame() {
2848
2848
  entryFee: Long.UZERO,
2849
2849
  name: "",
2850
2850
  bettingLimit: "",
2851
+ startTime: Long.ZERO,
2851
2852
  };
2852
2853
  }
2853
2854
  const MsgCreateGame = {
@@ -2909,6 +2910,9 @@ const MsgCreateGame = {
2909
2910
  if (message.bettingLimit !== "") {
2910
2911
  writer.uint32(162).string(message.bettingLimit);
2911
2912
  }
2913
+ if (!message.startTime.equals(Long.ZERO)) {
2914
+ writer.uint32(168).int64(message.startTime.toString());
2915
+ }
2912
2916
  return writer;
2913
2917
  },
2914
2918
  decode(input, length) {
@@ -3051,6 +3055,13 @@ const MsgCreateGame = {
3051
3055
  message.bettingLimit = reader.string();
3052
3056
  continue;
3053
3057
  }
3058
+ case 21: {
3059
+ if (tag !== 168) {
3060
+ break;
3061
+ }
3062
+ message.startTime = Long.fromString(reader.int64().toString());
3063
+ continue;
3064
+ }
3054
3065
  }
3055
3066
  if ((tag & 7) === 4 || tag === 0) {
3056
3067
  break;
@@ -3080,6 +3091,7 @@ const MsgCreateGame = {
3080
3091
  entryFee: isSet$2b(object.entryFee) ? Long.fromValue(object.entryFee) : Long.UZERO,
3081
3092
  name: isSet$2b(object.name) ? globalThis.String(object.name) : "",
3082
3093
  bettingLimit: isSet$2b(object.bettingLimit) ? globalThis.String(object.bettingLimit) : "",
3094
+ startTime: isSet$2b(object.startTime) ? Long.fromValue(object.startTime) : Long.ZERO,
3083
3095
  };
3084
3096
  },
3085
3097
  toJSON(message) {
@@ -3141,6 +3153,9 @@ const MsgCreateGame = {
3141
3153
  if (message.bettingLimit !== "") {
3142
3154
  obj.bettingLimit = message.bettingLimit;
3143
3155
  }
3156
+ if (!message.startTime.equals(Long.ZERO)) {
3157
+ obj.startTime = (message.startTime || Long.ZERO).toString();
3158
+ }
3144
3159
  return obj;
3145
3160
  },
3146
3161
  create(base) {
@@ -3186,6 +3201,9 @@ const MsgCreateGame = {
3186
3201
  message.gameVariant = object.gameVariant ?? "";
3187
3202
  message.name = object.name ?? "";
3188
3203
  message.bettingLimit = object.bettingLimit ?? "";
3204
+ message.startTime = (object.startTime !== undefined && object.startTime !== null)
3205
+ ? Long.fromValue(object.startTime)
3206
+ : Long.ZERO;
3189
3207
  message.entryFee = (object.entryFee !== undefined && object.entryFee !== null)
3190
3208
  ? Long.fromValue(object.entryFee)
3191
3209
  : Long.UZERO;
@@ -56093,6 +56111,18 @@ exports.NonPlayerActionType = void 0;
56093
56111
  // current turn. Rejected off-turn, past the deadline, or with no bank left.
56094
56112
  NonPlayerActionType["TIME_BANK"] = "time-bank";
56095
56113
  NonPlayerActionType["TOP_UP"] = "top-up";
56114
+ // Scheduled single-table tournament (poker-vm#2680): any registered player
56115
+ // starts the sit-and-go once gameOptions.scheduledStartTime has passed and
56116
+ // at least minPlayers are seated. Offered in legalActions when it is due.
56117
+ NonPlayerActionType["START"] = "start";
56118
+ // Sealed hands (poker-vm#2695, commit-reveal phase 1). Submitted by the
56119
+ // dealer, never by a player. REVEAL_BOARD supplies the next street's cards
56120
+ // (`cards=Xx-Yy-Zz`: 3 for the flop, 1 for the turn, 1 for the river) while
56121
+ // `sealed.awaiting === "board"`. REVEAL_DEAL supplies the full deck
56122
+ // (`deck=<52 cards>`) at showdown while `sealed.awaiting === "deal"`; the
56123
+ // engine replays the deal in `sealed.dealtSeats` order and settles.
56124
+ NonPlayerActionType["REVEAL_BOARD"] = "reveal-board";
56125
+ NonPlayerActionType["REVEAL_DEAL"] = "reveal-deal";
56096
56126
  })(exports.NonPlayerActionType || (exports.NonPlayerActionType = {}));
56097
56127
  const AllPlayerActions = { ...exports.PlayerActionType, ...exports.NonPlayerActionType };
56098
56128
  /**
@@ -56165,6 +56195,8 @@ exports.TexasHoldemRound = void 0;
56165
56195
  TexasHoldemRound["SHOWDOWN"] = "showdown";
56166
56196
  TexasHoldemRound["END"] = "end";
56167
56197
  })(exports.TexasHoldemRound || (exports.TexasHoldemRound = {}));
56198
+ const BLIND_PRESETS = ["turbo", "standard", "deep_stack", "hyper_turbo"];
56199
+ const BLIND_PROGRESSIONS = ["double", "linear", "percentage", "table"];
56168
56200
  const SIT_OUT_METHOD_NEXT_HAND = "next-hand";
56169
56201
  const SIT_OUT_METHOD_NEXT_BB = "next-bb";
56170
56202
  exports.SUIT = void 0;
@@ -71006,6 +71038,26 @@ function gaslessFee(gasLimit = DEFAULT_GAS_LIMIT) {
71006
71038
  gas: gasLimit.toString()
71007
71039
  };
71008
71040
  }
71041
+ /**
71042
+ * Fail fast on a sit-and-go field the chain would refuse (poker-vm#2680):
71043
+ * seats 2..9, min <= max, and a flexible field (min < max) needs a scheduled
71044
+ * start in the future. Mirrors x/poker/keeper/msg_server_create_game.go.
71045
+ */
71046
+ function assertCreatableSngField(minPlayers, maxPlayers, sngConfig, nowSeconds = Math.floor(Date.now() / 1000)) {
71047
+ if (maxPlayers < 2 || maxPlayers > 9) {
71048
+ throw new Error(`sit-and-go maxPlayers must be 2..9; got ${maxPlayers}.`);
71049
+ }
71050
+ if (minPlayers < 2 || minPlayers > maxPlayers) {
71051
+ throw new Error(`sit-and-go minPlayers must be 2..maxPlayers (${maxPlayers}); got ${minPlayers}.`);
71052
+ }
71053
+ const startTime = sngConfig?.startTime;
71054
+ if (minPlayers !== maxPlayers && !startTime) {
71055
+ throw new Error("sit-and-go with minPlayers < maxPlayers needs sngConfig.startTime (a scheduled start).");
71056
+ }
71057
+ if (startTime !== undefined && startTime <= nowSeconds) {
71058
+ throw new Error(`sngConfig.startTime ${startTime} must be in the future (now ${nowSeconds}).`);
71059
+ }
71060
+ }
71009
71061
  /**
71010
71062
  * Signing Cosmos Client that extends the read-only CosmosClient with transaction capabilities
71011
71063
  */
@@ -71137,6 +71189,7 @@ class SigningCosmosClient extends CosmosClient {
71137
71189
  if (!sngConfig.blindLevelDuration || sngConfig.blindLevelDuration <= 0) {
71138
71190
  throw new Error(`${gameFormat} games require a positive blindLevelDuration; got ${sngConfig.blindLevelDuration}.`);
71139
71191
  }
71192
+ assertCreatableSngField(minPlayers, maxPlayers, sngConfig);
71140
71193
  }
71141
71194
  assertCreatableBettingLimit(bettingLimit);
71142
71195
  await this.initializeSigningClient();
@@ -71174,6 +71227,9 @@ class SigningCosmosClient extends CosmosClient {
71174
71227
  // Betting structure (block52/pokerchain#407). "" = the variant's default
71175
71228
  // on chain, and an empty proto3 string is not encoded at all.
71176
71229
  bettingLimit: bettingLimit ?? "",
71230
+ // Scheduled start (poker-vm#2680), unix seconds. 0 = unscheduled, and
71231
+ // a zero proto3 int64 is not encoded at all.
71232
+ startTime: sngConfig?.startTime ? Long.fromNumber(sngConfig.startTime) : Long.ZERO,
71177
71233
  });
71178
71234
  // Create the transaction message
71179
71235
  const msg = {
@@ -72125,6 +72181,8 @@ const registry = new protoSigning.Registry([
72125
72181
  ]);
72126
72182
 
72127
72183
  exports.AllPlayerActions = AllPlayerActions;
72184
+ exports.BLIND_PRESETS = BLIND_PRESETS;
72185
+ exports.BLIND_PROGRESSIONS = BLIND_PROGRESSIONS;
72128
72186
  exports.BLOCK52_HD_PATH = BLOCK52_HD_PATH;
72129
72187
  exports.Board = Board;
72130
72188
  exports.COSMOS_CONSTANTS = COSMOS_CONSTANTS;