@block52/poker-vm-sdk 1.2.10 → 1.2.13

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
@@ -45213,12 +45213,26 @@ declare enum PlayerActionType {
45213
45213
  BET = "bet",
45214
45214
  CALL = "call",
45215
45215
  RAISE = "raise",
45216
+ /**
45217
+ * @deprecated Not a dispatchable action. "All-in" is a UX label — going
45218
+ * all-in is a BET/CALL/RAISE whose amount equals the player's whole stack
45219
+ * (a short shove is an all-in-only RAISE, poker-vm#2353). The engine neither
45220
+ * advertises ALL_IN in getLegalActions nor accepts it via performAction (the
45221
+ * handler was removed, poker-vm#2353) — dispatching it throws.
45222
+ *
45223
+ * This member survives ONLY as the internal *recorded* action type:
45224
+ * baseAction.execute rewrites a full-stack commit to ALL_IN, and round-end
45225
+ * reopening + aggression detection (#2134) read it. Do not dispatch it and do
45226
+ * not add new consumers.
45227
+ *
45228
+ * NOTE: distinct from the still-required `PlayerStatus.ALL_IN` (a player's
45229
+ * state once their chips reach 0), which is NOT deprecated.
45230
+ */
45216
45231
  ALL_IN = "all-in",
45217
45232
  MUCK = "muck",
45218
45233
  SHOW = "show"
45219
45234
  }
45220
45235
  declare enum NonPlayerActionType {
45221
- CLAIM = "claim",
45222
45236
  DEAD_SMALL_BLIND = "dead-small-blind",
45223
45237
  DEAL = "deal",
45224
45238
  FORCE_CLOSE = "force-close",
@@ -45231,7 +45245,6 @@ declare enum NonPlayerActionType {
45231
45245
  TOP_UP = "top-up"
45232
45246
  }
45233
45247
  declare const AllPlayerActions: {
45234
- CLAIM: NonPlayerActionType.CLAIM;
45235
45248
  DEAD_SMALL_BLIND: NonPlayerActionType.DEAD_SMALL_BLIND;
45236
45249
  DEAL: NonPlayerActionType.DEAL;
45237
45250
  FORCE_CLOSE: NonPlayerActionType.FORCE_CLOSE;
@@ -45414,6 +45427,15 @@ type ResultDTO = {
45414
45427
  playerId: string;
45415
45428
  payout: string;
45416
45429
  };
45430
+ /**
45431
+ * A single place in a tournament (SNG/MTT) prize structure.
45432
+ * This is the PROSPECTIVE payout by finishing place — distinct from ResultDTO,
45433
+ * which records the SETTLED payout for an actual player once they finish.
45434
+ */
45435
+ type PayoutPlaceDTO = {
45436
+ place: number;
45437
+ amount: string;
45438
+ };
45417
45439
  type TexasHoldemGameState = {
45418
45440
  type: string;
45419
45441
  address: string;
@@ -45457,6 +45479,7 @@ type TexasHoldemStateDTO = {
45457
45479
  legalActions: LegalActionDTO[];
45458
45480
  availableSeats: number[];
45459
45481
  rakeCollected?: string;
45482
+ payouts?: PayoutPlaceDTO[];
45460
45483
  signature: string;
45461
45484
  };
45462
45485
  /**
@@ -46422,6 +46445,16 @@ declare class SigningCosmosClient extends CosmosClient {
46422
46445
  * Leave a poker game
46423
46446
  */
46424
46447
  leaveGame(gameId: string): Promise<string>;
46448
+ /**
46449
+ * Record a hand-end game-state snapshot on the chain (pokerchain#239).
46450
+ *
46451
+ * Signed and broadcast directly by the player who finished the position
46452
+ * being recorded (e.g. the 4th-place finisher pushes the state that records
46453
+ * 4th place), so a finished SNG's results reach the chain and the prize pool
46454
+ * becomes claimable. `gameState` is the hand-end TexasHoldemStateDTO,
46455
+ * JSON-encoded (the canonical shape the chain stores in GameStates).
46456
+ */
46457
+ recordHandEnd(gameId: string, gameState: string): Promise<string>;
46425
46458
  /**
46426
46459
  * Delete a poker game
46427
46460
  * Only the game creator can delete a game, and the game must have no active players
@@ -46868,4 +46901,4 @@ declare const Client: typeof IgniteClient & Constructor<{
46868
46901
  declare const registry: Registry;
46869
46902
 
46870
46903
  export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SIT_IN_METHOD_NEXT_BB, SIT_IN_METHOD_POST_NOW, SIT_OUT_METHOD_NEXT_BB, SIT_OUT_METHOD_NEXT_HAND, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
46871
- export type { AccountDTO, ActionDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, EquityHand, EquityRequest, EquityResponse, EquityResult, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, GameStateResponseDTO, HandEvaluation, ISignedResponse, LegalActionDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, SitInMethod, SitOutMethod, TexasHoldemGameState, TexasHoldemStateDTO, TransactionDTO, TransactionResponse, WalletInfo, WinnerDTO, WithdrawResponseDTO };
46904
+ export type { AccountDTO, ActionDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, EquityHand, EquityRequest, EquityResponse, EquityResult, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, GameStateResponseDTO, HandEvaluation, ISignedResponse, LegalActionDTO, PayoutPlaceDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, SitInMethod, SitOutMethod, TexasHoldemGameState, TexasHoldemStateDTO, TransactionDTO, TransactionResponse, WalletInfo, WinnerDTO, WithdrawResponseDTO };
package/dist/index.esm.js CHANGED
@@ -3324,6 +3324,89 @@ const MsgLeaveGame = {
3324
3324
  return message;
3325
3325
  },
3326
3326
  };
3327
+ function createBaseMsgRecordHandEnd() {
3328
+ return { creator: "", gameId: "", gameState: "" };
3329
+ }
3330
+ const MsgRecordHandEnd = {
3331
+ encode(message, writer = new BinaryWriter()) {
3332
+ if (message.creator !== "") {
3333
+ writer.uint32(10).string(message.creator);
3334
+ }
3335
+ if (message.gameId !== "") {
3336
+ writer.uint32(18).string(message.gameId);
3337
+ }
3338
+ if (message.gameState !== "") {
3339
+ writer.uint32(26).string(message.gameState);
3340
+ }
3341
+ return writer;
3342
+ },
3343
+ decode(input, length) {
3344
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3345
+ const end = length === undefined ? reader.len : reader.pos + length;
3346
+ const message = createBaseMsgRecordHandEnd();
3347
+ while (reader.pos < end) {
3348
+ const tag = reader.uint32();
3349
+ switch (tag >>> 3) {
3350
+ case 1: {
3351
+ if (tag !== 10) {
3352
+ break;
3353
+ }
3354
+ message.creator = reader.string();
3355
+ continue;
3356
+ }
3357
+ case 2: {
3358
+ if (tag !== 18) {
3359
+ break;
3360
+ }
3361
+ message.gameId = reader.string();
3362
+ continue;
3363
+ }
3364
+ case 3: {
3365
+ if (tag !== 26) {
3366
+ break;
3367
+ }
3368
+ message.gameState = reader.string();
3369
+ continue;
3370
+ }
3371
+ }
3372
+ if ((tag & 7) === 4 || tag === 0) {
3373
+ break;
3374
+ }
3375
+ reader.skip(tag & 7);
3376
+ }
3377
+ return message;
3378
+ },
3379
+ fromJSON(object) {
3380
+ return {
3381
+ creator: isSet$2b(object.creator) ? globalThis.String(object.creator) : "",
3382
+ gameId: isSet$2b(object.gameId) ? globalThis.String(object.gameId) : "",
3383
+ gameState: isSet$2b(object.gameState) ? globalThis.String(object.gameState) : "",
3384
+ };
3385
+ },
3386
+ toJSON(message) {
3387
+ const obj = {};
3388
+ if (message.creator !== "") {
3389
+ obj.creator = message.creator;
3390
+ }
3391
+ if (message.gameId !== "") {
3392
+ obj.gameId = message.gameId;
3393
+ }
3394
+ if (message.gameState !== "") {
3395
+ obj.gameState = message.gameState;
3396
+ }
3397
+ return obj;
3398
+ },
3399
+ create(base) {
3400
+ return MsgRecordHandEnd.fromPartial(base ?? {});
3401
+ },
3402
+ fromPartial(object) {
3403
+ const message = createBaseMsgRecordHandEnd();
3404
+ message.creator = object.creator ?? "";
3405
+ message.gameId = object.gameId ?? "";
3406
+ message.gameState = object.gameState ?? "";
3407
+ return message;
3408
+ },
3409
+ };
3327
3410
  function createBaseMsgDealCards() {
3328
3411
  return { creator: "", gameId: "" };
3329
3412
  }
@@ -4376,6 +4459,7 @@ const msgTypes$u = [
4376
4459
  ["/pokerchain.poker.v1.MsgCreateGame", MsgCreateGame],
4377
4460
  ["/pokerchain.poker.v1.MsgJoinGame", MsgJoinGame],
4378
4461
  ["/pokerchain.poker.v1.MsgLeaveGame", MsgLeaveGame],
4462
+ ["/pokerchain.poker.v1.MsgRecordHandEnd", MsgRecordHandEnd],
4379
4463
  ["/pokerchain.poker.v1.MsgDealCards", MsgDealCards],
4380
4464
  ["/pokerchain.poker.v1.MsgPerformAction", MsgPerformAction],
4381
4465
  ["/pokerchain.poker.v1.MsgMint", MsgMint],
@@ -55939,17 +56023,27 @@ var PlayerActionType;
55939
56023
  PlayerActionType["BET"] = "bet";
55940
56024
  PlayerActionType["CALL"] = "call";
55941
56025
  PlayerActionType["RAISE"] = "raise";
56026
+ /**
56027
+ * @deprecated Not a dispatchable action. "All-in" is a UX label — going
56028
+ * all-in is a BET/CALL/RAISE whose amount equals the player's whole stack
56029
+ * (a short shove is an all-in-only RAISE, poker-vm#2353). The engine neither
56030
+ * advertises ALL_IN in getLegalActions nor accepts it via performAction (the
56031
+ * handler was removed, poker-vm#2353) — dispatching it throws.
56032
+ *
56033
+ * This member survives ONLY as the internal *recorded* action type:
56034
+ * baseAction.execute rewrites a full-stack commit to ALL_IN, and round-end
56035
+ * reopening + aggression detection (#2134) read it. Do not dispatch it and do
56036
+ * not add new consumers.
56037
+ *
56038
+ * NOTE: distinct from the still-required `PlayerStatus.ALL_IN` (a player's
56039
+ * state once their chips reach 0), which is NOT deprecated.
56040
+ */
55942
56041
  PlayerActionType["ALL_IN"] = "all-in";
55943
56042
  PlayerActionType["MUCK"] = "muck";
55944
56043
  PlayerActionType["SHOW"] = "show";
55945
56044
  })(PlayerActionType || (PlayerActionType = {}));
55946
56045
  var NonPlayerActionType;
55947
56046
  (function (NonPlayerActionType) {
55948
- // Terminal SNG/Tournament settlement: a decided-tournament finisher claims
55949
- // their prize-pool payout without leaving the (frozen) roster. Replaces the
55950
- // post-start LEAVE that used to remove the seat and destabilise the terminal
55951
- // state (#2318/#2184 root cause). (#2343)
55952
- NonPlayerActionType["CLAIM"] = "claim";
55953
56047
  NonPlayerActionType["DEAD_SMALL_BLIND"] = "dead-small-blind";
55954
56048
  NonPlayerActionType["DEAL"] = "deal";
55955
56049
  NonPlayerActionType["FORCE_CLOSE"] = "force-close";
@@ -60839,7 +60933,7 @@ class SigningCosmosClient extends CosmosClient {
60839
60933
  // SNG/Tournament games are DEFINED by startingStack + blindLevelDuration.
60840
60934
  // Refuse to create one with missing/zero values rather than silently
60841
60935
  // defaulting (Long.UZERO / 0) — a zero startingStack makes the prize pool
60842
- // zero (PayoutManager.totalPrizePool = startingStack * runners) and pays
60936
+ // zero (SngPayoutManager.totalPrizePool = startingStack * runners) and pays
60843
60937
  // the winner $0; a zero blindLevelDuration breaks blind escalation.
60844
60938
  // No defaults — fail loud at creation (Commandment #7). (#2282)
60845
60939
  const isSng = gameFormat === GameFormat.SIT_AND_GO || gameFormat === GameFormat.TOURNAMENT;
@@ -60991,6 +61085,37 @@ class SigningCosmosClient extends CosmosClient {
60991
61085
  throw error;
60992
61086
  }
60993
61087
  }
61088
+ /**
61089
+ * Record a hand-end game-state snapshot on the chain (pokerchain#239).
61090
+ *
61091
+ * Signed and broadcast directly by the player who finished the position
61092
+ * being recorded (e.g. the 4th-place finisher pushes the state that records
61093
+ * 4th place), so a finished SNG's results reach the chain and the prize pool
61094
+ * becomes claimable. `gameState` is the hand-end TexasHoldemStateDTO,
61095
+ * JSON-encoded (the canonical shape the chain stores in GameStates).
61096
+ */
61097
+ async recordHandEnd(gameId, gameState) {
61098
+ await this.initializeSigningClient();
61099
+ if (!this.signingClient || !this.wallet) {
61100
+ throw new Error("Signing client not initialized");
61101
+ }
61102
+ const [account] = await this.wallet.getAccounts();
61103
+ const creator = account.address;
61104
+ const msg = {
61105
+ typeUrl: "/pokerchain.poker.v1.MsgRecordHandEnd",
61106
+ value: { creator, gameId, gameState }
61107
+ };
61108
+ const fee = gaslessFee();
61109
+ const memo = "Record hand end via SDK";
61110
+ try {
61111
+ const result = await this.signingClient.signAndBroadcast(creator, [msg], fee, memo);
61112
+ return result.transactionHash;
61113
+ }
61114
+ catch (error) {
61115
+ console.error("❌ Record hand end failed:", error);
61116
+ throw error;
61117
+ }
61118
+ }
60994
61119
  /**
60995
61120
  * Delete a poker game
60996
61121
  * Only the game creator can delete a game, and the game must have no active players