@block52/poker-vm-sdk 1.12.0 → 1.14.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 +73 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +185 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +186 -13
- package/dist/index.js.map +1 -1
- package/dist/pokerGameIntegration.d.ts +38 -2
- package/dist/pokerGameIntegration.d.ts.map +1 -1
- package/dist/pokerSolver.d.ts +5 -1
- package/dist/pokerSolver.d.ts.map +1 -1
- package/dist/pokerchain.poker.v1/types/pokerchain/poker/v1/tx.d.ts +7 -0
- package/dist/pokerchain.poker.v1/types/pokerchain/poker/v1/tx.d.ts.map +1 -1
- package/dist/signingClient.d.ts +1 -0
- package/dist/signingClient.d.ts.map +1 -1
- package/dist/types/game.d.ts +6 -0
- package/dist/types/game.d.ts.map +1 -1
- package/dist/utils/lateRegistration.d.ts +17 -0
- package/dist/utils/lateRegistration.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44968,6 +44968,13 @@ interface MsgCreateGame {
|
|
|
44968
44968
|
* (poker-vm#1734, block52/pokerchain#434)
|
|
44969
44969
|
*/
|
|
44970
44970
|
blindStructure: string;
|
|
44971
|
+
/**
|
|
44972
|
+
* Late registration for a scheduled sit-and-go (field 23): after the start,
|
|
44973
|
+
* new players may still join while the blind level (0-based) is below this,
|
|
44974
|
+
* until anyone has finished in the money. Requires start_time. 0 = none: the
|
|
44975
|
+
* field is fixed at the start. (poker-vm#2731)
|
|
44976
|
+
*/
|
|
44977
|
+
lateRegistrationLevels: number;
|
|
44971
44978
|
}
|
|
44972
44979
|
declare const MsgCreateGame: MessageFns<MsgCreateGame>;
|
|
44973
44980
|
/** MsgJoinGame defines the MsgJoinGame message. */
|
|
@@ -45254,6 +45261,7 @@ declare enum PlayerActionType {
|
|
|
45254
45261
|
}
|
|
45255
45262
|
declare enum NonPlayerActionType {
|
|
45256
45263
|
DEAD_SMALL_BLIND = "dead-small-blind",
|
|
45264
|
+
ANTE = "ante",
|
|
45257
45265
|
DEAL = "deal",
|
|
45258
45266
|
FORCE_CLOSE = "force-close",
|
|
45259
45267
|
JOIN = "join",
|
|
@@ -45272,6 +45280,7 @@ declare enum NonPlayerActionType {
|
|
|
45272
45280
|
}
|
|
45273
45281
|
declare const AllPlayerActions: {
|
|
45274
45282
|
DEAD_SMALL_BLIND: NonPlayerActionType.DEAD_SMALL_BLIND;
|
|
45283
|
+
ANTE: NonPlayerActionType.ANTE;
|
|
45275
45284
|
DEAL: NonPlayerActionType.DEAL;
|
|
45276
45285
|
FORCE_CLOSE: NonPlayerActionType.FORCE_CLOSE;
|
|
45277
45286
|
JOIN: NonPlayerActionType.JOIN;
|
|
@@ -45474,6 +45483,8 @@ type GameOptions = {
|
|
|
45474
45483
|
blindLevelDuration?: number;
|
|
45475
45484
|
blindLevel?: number;
|
|
45476
45485
|
scheduledStartTime?: number;
|
|
45486
|
+
lateRegistrationLevels?: number;
|
|
45487
|
+
ante?: string;
|
|
45477
45488
|
sngStartTime?: number;
|
|
45478
45489
|
levelStartTime?: number;
|
|
45479
45490
|
timeBankMs?: number;
|
|
@@ -45511,6 +45522,8 @@ type GameOptionsDTO = {
|
|
|
45511
45522
|
nextSmallBlind?: string;
|
|
45512
45523
|
nextBigBlind?: string;
|
|
45513
45524
|
scheduledStartTime?: number;
|
|
45525
|
+
lateRegistrationLevels?: number;
|
|
45526
|
+
ante?: string;
|
|
45514
45527
|
sngStartTime?: number;
|
|
45515
45528
|
levelStartTime?: number;
|
|
45516
45529
|
timeBankMs?: number;
|
|
@@ -46180,6 +46193,22 @@ declare function resolveBlindPreset(structure: BlindStructureDTO): Exclude<Blind
|
|
|
46180
46193
|
*/
|
|
46181
46194
|
declare function expandBlindLevel(structure: BlindStructureDTO, n: number): BlindLevelDTO;
|
|
46182
46195
|
|
|
46196
|
+
/**
|
|
46197
|
+
* Late registration for a scheduled sit-and-go (poker-vm#2731), read the way
|
|
46198
|
+
* the engine decides it: after the start, a join is accepted while the blind
|
|
46199
|
+
* level at block time is below `gameOptions.lateRegistrationLevels`, until
|
|
46200
|
+
* anyone has finished in the money. The blind clock — and so the window —
|
|
46201
|
+
* runs from the first deal (`sngStartTime`).
|
|
46202
|
+
*/
|
|
46203
|
+
/** When late registration closes (epoch ms): the end of the last open level.
|
|
46204
|
+
* Undefined when the table has no late registration, or has not dealt yet
|
|
46205
|
+
* (the clock has not started, so the window has no end time). */
|
|
46206
|
+
declare function lateRegistrationClosesAt(options: GameOptionsDTO): number | undefined;
|
|
46207
|
+
/** Whether a join after the start would be accepted at nowMs. Before the
|
|
46208
|
+
* first deal the window is open (level 0); it shuts at
|
|
46209
|
+
* lateRegistrationClosesAt, or once any result carries a payout. */
|
|
46210
|
+
declare function isLateRegistrationOpen(options: GameOptionsDTO, results: ResultDTO[], nowMs: number): boolean;
|
|
46211
|
+
|
|
46183
46212
|
/**
|
|
46184
46213
|
* Poker hand types in order of strength (weakest to strongest)
|
|
46185
46214
|
*/
|
|
@@ -46220,7 +46249,11 @@ declare class PokerSolver {
|
|
|
46220
46249
|
/**
|
|
46221
46250
|
* Evaluate a 5-card poker hand
|
|
46222
46251
|
*/
|
|
46223
|
-
|
|
46252
|
+
/**
|
|
46253
|
+
* Evaluate exactly 5 cards (a winner's best hand, WinnerDTO.cards). Use
|
|
46254
|
+
* findBestHand for 7.
|
|
46255
|
+
*/
|
|
46256
|
+
static evaluateHand(cards: Card[]): HandEvaluation;
|
|
46224
46257
|
/**
|
|
46225
46258
|
* Check if cards form a straight (excluding low straight A-2-3-4-5)
|
|
46226
46259
|
*/
|
|
@@ -46490,11 +46523,47 @@ declare class PokerGameIntegration {
|
|
|
46490
46523
|
hand2Evaluation: HandEvaluation;
|
|
46491
46524
|
};
|
|
46492
46525
|
/**
|
|
46493
|
-
*
|
|
46526
|
+
* The winning hand in words, from the winner's best five cards
|
|
46527
|
+
* (WinnerDTO.cards) and the board (communityCards): "Full House, Eights
|
|
46528
|
+
* over Sevens", "Diamond Flush, Six high", "Set of Sevens". The board tells
|
|
46529
|
+
* a set (pocket pair plus one on the board) from trips (one hole card plus a
|
|
46530
|
+
* board pair, or all three on the board), which the five cards alone can't.
|
|
46531
|
+
* @param cards The winner's five card mnemonics ("6D")
|
|
46532
|
+
* @param board The community cards
|
|
46533
|
+
* @returns The hand in words, or "" for an uncontested pot (no cards)
|
|
46534
|
+
*/
|
|
46535
|
+
static describeWinningHand(cards: string[] | undefined, board: string[]): string;
|
|
46536
|
+
/**
|
|
46537
|
+
* Fill in each winner's name and description from its cards and the board.
|
|
46538
|
+
* The engine no longer writes the hand's wording into chain state
|
|
46539
|
+
* (poker-vm#2721), so callers run game state through this as it arrives and
|
|
46540
|
+
* keep reading winner.name / winner.description as before.
|
|
46541
|
+
*
|
|
46542
|
+
* A winner with five cards gets "Full House, Eights over Sevens" in both
|
|
46543
|
+
* fields. A winner without five cards (an uncontested pot, or an older state
|
|
46544
|
+
* that recorded hole cards) is returned unchanged.
|
|
46545
|
+
*
|
|
46546
|
+
* Returns a new state object; the input is not modified.
|
|
46547
|
+
* @param state Any game state with winners and community cards
|
|
46548
|
+
*/
|
|
46549
|
+
static withWinnerDescriptions<T extends {
|
|
46550
|
+
winners: WinnerDTO[];
|
|
46551
|
+
communityCards: string[];
|
|
46552
|
+
}>(state: T): T;
|
|
46553
|
+
/**
|
|
46554
|
+
* The hand description in words: "Full House, Eights over Sevens", "Quad
|
|
46555
|
+
* Fours", "Diamond Flush, Six high", "Ace high". A flush names its suit from
|
|
46556
|
+
* the best hand. The rank and suit words mirror @block52/deck's rankName /
|
|
46557
|
+
* suitName.
|
|
46494
46558
|
* @param evaluation Hand evaluation result
|
|
46495
46559
|
* @returns Human-readable hand description
|
|
46496
46560
|
*/
|
|
46497
46561
|
static formatHandDescription(evaluation: HandEvaluation): string;
|
|
46562
|
+
private static readonly RANK_WORDS;
|
|
46563
|
+
/** A high-ace rank spelled out ("Ace", "Ten"); plural gives "Aces", "Sixes". */
|
|
46564
|
+
private static rankWord;
|
|
46565
|
+
/** The suit word every card of a flush shares ("Diamond"), or "" when the hand is empty or mixed. */
|
|
46566
|
+
private static flushSuitWord;
|
|
46498
46567
|
/**
|
|
46499
46568
|
* Example usage with string cards (for testing/debugging)
|
|
46500
46569
|
* @param playerCardStrings Array of player hands as mnemonic strings
|
|
@@ -46783,6 +46852,7 @@ interface SNGConfig {
|
|
|
46783
46852
|
entryFee?: bigint;
|
|
46784
46853
|
startTime?: number;
|
|
46785
46854
|
blindStructure?: BlindStructureDTO;
|
|
46855
|
+
lateRegistrationLevels?: number;
|
|
46786
46856
|
}
|
|
46787
46857
|
/**
|
|
46788
46858
|
* Signing Cosmos Client that extends the read-only CosmosClient with transaction capabilities
|
|
@@ -47390,5 +47460,5 @@ declare const Client: typeof IgniteClient & Constructor<{
|
|
|
47390
47460
|
}>;
|
|
47391
47461
|
declare const registry: Registry;
|
|
47392
47462
|
|
|
47393
|
-
export { AllPlayerActions, BLIND_PRESETS, BLIND_PRESET_STRUCTURES, BLIND_PROGRESSIONS, BLOCK52_HD_PATH, BettingLimit, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GAME_NAME_MICRO_PER_CHAR, GameFormat, GameStatus, GameVariant, HandType, KEYS, MAX_GAME_NAME_LENGTH, MSG_CREATE_VALIDATOR_TYPE_URL, 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, TxExecutionError, ValidatorBond, WithdrawalRequest, assertCreatableBettingLimit, assertExecuted, buildMsgCreateValidator, computeGameNameFee, createSigningClientFromMnemonic, createWalletFromMnemonic, decToAtomics, expandBlindLevel, formatBlindStructure, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getBettingLimit, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, holeCardsPerPlayer, isCashFormat, isEmptyAddress, isPotLimit, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseBlindStructure, parseGameFormat, parseGameVariant, registry, resolveBlindPreset, toValoperAddress, txFailureHash, txFailurePhase };
|
|
47463
|
+
export { AllPlayerActions, BLIND_PRESETS, BLIND_PRESET_STRUCTURES, BLIND_PROGRESSIONS, BLOCK52_HD_PATH, BettingLimit, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GAME_NAME_MICRO_PER_CHAR, GameFormat, GameStatus, GameVariant, HandType, KEYS, MAX_GAME_NAME_LENGTH, MSG_CREATE_VALIDATOR_TYPE_URL, 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, TxExecutionError, ValidatorBond, WithdrawalRequest, assertCreatableBettingLimit, assertExecuted, buildMsgCreateValidator, computeGameNameFee, createSigningClientFromMnemonic, createWalletFromMnemonic, decToAtomics, expandBlindLevel, formatBlindStructure, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getBettingLimit, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, holeCardsPerPlayer, isCashFormat, isEmptyAddress, isLateRegistrationOpen, isPotLimit, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, lateRegistrationClosesAt, parseBlindStructure, parseGameFormat, parseGameVariant, registry, resolveBlindPreset, toValoperAddress, txFailureHash, txFailurePhase };
|
|
47394
47464
|
export type { AccountDTO, ActionDTO, AnteRuleDTO, BlindLevelDTO, BlindPreset, BlindProgression, BlindStructureDTO, BlindStructurePresetDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, CreateValidatorParams, DoubleBlindStructureDTO, EquityHand, EquityRequest, EquityResponse, EquityResult, ExecutionResult, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, GameStateResponseDTO, HandEvaluation, ISignedResponse, LegalActionDTO, LinearBlindStructureDTO, PayoutPlaceDTO, PercentageBlindStructureDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, SealedAwaiting, SealedDTO, SitInMethod, SitOutMethod, TableBlindStructureDTO, TexasHoldemGameState, TexasHoldemStateDTO, TransactionDTO, TransactionResponse, TxFailurePhase, WalletInfo, WinnerDTO, WithdrawResponseDTO };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAkC/C,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEV,CAAC;AAEH,QAAA,MAAM,QAAQ,UAiCZ,CAAA;AAGF,cAAc,6BAA6B,CAAA;AAG3C,cAAc,cAAc,CAAA;AAG5B,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGpG,cAAc,eAAe,CAAA;AAG7B,cAAc,eAAe,CAAA;AAG7B,cAAc,yBAAyB,CAAA;AAGvC,cAAc,qBAAqB,CAAA;AAGnC,cAAc,sBAAsB,CAAA;AAGpC,cAAc,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAkC/C,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEV,CAAC;AAEH,QAAA,MAAM,QAAQ,UAiCZ,CAAA;AAGF,cAAc,6BAA6B,CAAA;AAG3C,cAAc,cAAc,CAAA;AAG5B,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGpG,cAAc,eAAe,CAAA;AAG7B,cAAc,eAAe,CAAA;AAG7B,cAAc,yBAAyB,CAAA;AAGvC,cAAc,qBAAqB,CAAA;AAGnC,cAAc,sBAAsB,CAAA;AAGpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AAGxC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIpI,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAC9I,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAGvI,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGzF,OAAO,EACL,MAAM,EACN,QAAQ,EACR,kBAAkB,EACnB,CAAA"}
|
package/dist/index.esm.js
CHANGED
|
@@ -2848,6 +2848,7 @@ function createBaseMsgCreateGame() {
|
|
|
2848
2848
|
bettingLimit: "",
|
|
2849
2849
|
startTime: Long.ZERO,
|
|
2850
2850
|
blindStructure: "",
|
|
2851
|
+
lateRegistrationLevels: 0,
|
|
2851
2852
|
};
|
|
2852
2853
|
}
|
|
2853
2854
|
const MsgCreateGame = {
|
|
@@ -2915,6 +2916,9 @@ const MsgCreateGame = {
|
|
|
2915
2916
|
if (message.blindStructure !== "") {
|
|
2916
2917
|
writer.uint32(178).string(message.blindStructure);
|
|
2917
2918
|
}
|
|
2919
|
+
if (message.lateRegistrationLevels !== 0) {
|
|
2920
|
+
writer.uint32(184).uint32(message.lateRegistrationLevels);
|
|
2921
|
+
}
|
|
2918
2922
|
return writer;
|
|
2919
2923
|
},
|
|
2920
2924
|
decode(input, length) {
|
|
@@ -3071,6 +3075,13 @@ const MsgCreateGame = {
|
|
|
3071
3075
|
message.blindStructure = reader.string();
|
|
3072
3076
|
continue;
|
|
3073
3077
|
}
|
|
3078
|
+
case 23: {
|
|
3079
|
+
if (tag !== 184) {
|
|
3080
|
+
break;
|
|
3081
|
+
}
|
|
3082
|
+
message.lateRegistrationLevels = reader.uint32();
|
|
3083
|
+
continue;
|
|
3084
|
+
}
|
|
3074
3085
|
}
|
|
3075
3086
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3076
3087
|
break;
|
|
@@ -3102,6 +3113,7 @@ const MsgCreateGame = {
|
|
|
3102
3113
|
bettingLimit: isSet$2b(object.bettingLimit) ? globalThis.String(object.bettingLimit) : "",
|
|
3103
3114
|
startTime: isSet$2b(object.startTime) ? Long.fromValue(object.startTime) : Long.ZERO,
|
|
3104
3115
|
blindStructure: isSet$2b(object.blindStructure) ? globalThis.String(object.blindStructure) : "",
|
|
3116
|
+
lateRegistrationLevels: isSet$2b(object.lateRegistrationLevels) ? globalThis.Number(object.lateRegistrationLevels) : 0,
|
|
3105
3117
|
};
|
|
3106
3118
|
},
|
|
3107
3119
|
toJSON(message) {
|
|
@@ -3169,6 +3181,9 @@ const MsgCreateGame = {
|
|
|
3169
3181
|
if (message.blindStructure !== "") {
|
|
3170
3182
|
obj.blindStructure = message.blindStructure;
|
|
3171
3183
|
}
|
|
3184
|
+
if (message.lateRegistrationLevels !== 0) {
|
|
3185
|
+
obj.lateRegistrationLevels = Math.round(message.lateRegistrationLevels);
|
|
3186
|
+
}
|
|
3172
3187
|
return obj;
|
|
3173
3188
|
},
|
|
3174
3189
|
create(base) {
|
|
@@ -3218,6 +3233,7 @@ const MsgCreateGame = {
|
|
|
3218
3233
|
? Long.fromValue(object.startTime)
|
|
3219
3234
|
: Long.ZERO;
|
|
3220
3235
|
message.blindStructure = object.blindStructure ?? "";
|
|
3236
|
+
message.lateRegistrationLevels = object.lateRegistrationLevels ?? 0;
|
|
3221
3237
|
message.entryFee = (object.entryFee !== undefined && object.entryFee !== null)
|
|
3222
3238
|
? Long.fromValue(object.entryFee)
|
|
3223
3239
|
: Long.UZERO;
|
|
@@ -56094,6 +56110,11 @@ var PlayerActionType;
|
|
|
56094
56110
|
var NonPlayerActionType;
|
|
56095
56111
|
(function (NonPlayerActionType) {
|
|
56096
56112
|
NonPlayerActionType["DEAD_SMALL_BLIND"] = "dead-small-blind";
|
|
56113
|
+
// Big-blind ante on a tournament-directed table (poker-vm#2613 slice 7):
|
|
56114
|
+
// dead money the big blind posts for the table before the blind itself,
|
|
56115
|
+
// from the tournament clock. Engine-recorded, never submitted; in the pot
|
|
56116
|
+
// but not a bet the others must match.
|
|
56117
|
+
NonPlayerActionType["ANTE"] = "ante";
|
|
56097
56118
|
NonPlayerActionType["DEAL"] = "deal";
|
|
56098
56119
|
NonPlayerActionType["FORCE_CLOSE"] = "force-close";
|
|
56099
56120
|
NonPlayerActionType["JOIN"] = "join";
|
|
@@ -57062,6 +57083,47 @@ function expandBlindLevel(structure, n) {
|
|
|
57062
57083
|
return { level: n, smallBlind: sb.toString(), bigBlind: bb.toString(), ante: ante.toString(), durationMinutes: structure.durationMinutes, isBreak: false };
|
|
57063
57084
|
}
|
|
57064
57085
|
|
|
57086
|
+
/**
|
|
57087
|
+
* Late registration for a scheduled sit-and-go (poker-vm#2731), read the way
|
|
57088
|
+
* the engine decides it: after the start, a join is accepted while the blind
|
|
57089
|
+
* level at block time is below `gameOptions.lateRegistrationLevels`, until
|
|
57090
|
+
* anyone has finished in the money. The blind clock — and so the window —
|
|
57091
|
+
* runs from the first deal (`sngStartTime`).
|
|
57092
|
+
*/
|
|
57093
|
+
/** When late registration closes (epoch ms): the end of the last open level.
|
|
57094
|
+
* Undefined when the table has no late registration, or has not dealt yet
|
|
57095
|
+
* (the clock has not started, so the window has no end time). */
|
|
57096
|
+
function lateRegistrationClosesAt(options) {
|
|
57097
|
+
const levels = options.lateRegistrationLevels;
|
|
57098
|
+
if (!levels || options.scheduledStartTime === undefined || options.sngStartTime === undefined) {
|
|
57099
|
+
return undefined;
|
|
57100
|
+
}
|
|
57101
|
+
let minutes = 0;
|
|
57102
|
+
for (let n = 0; n < levels; n++) {
|
|
57103
|
+
minutes += options.blindStructure ? expandBlindLevel(options.blindStructure, n).durationMinutes : levelMinutes(options);
|
|
57104
|
+
}
|
|
57105
|
+
return options.sngStartTime + minutes * 60000;
|
|
57106
|
+
}
|
|
57107
|
+
/** Whether a join after the start would be accepted at nowMs. Before the
|
|
57108
|
+
* first deal the window is open (level 0); it shuts at
|
|
57109
|
+
* lateRegistrationClosesAt, or once any result carries a payout. */
|
|
57110
|
+
function isLateRegistrationOpen(options, results, nowMs) {
|
|
57111
|
+
if (!options.lateRegistrationLevels || options.scheduledStartTime === undefined) {
|
|
57112
|
+
return false;
|
|
57113
|
+
}
|
|
57114
|
+
if (results.some(r => BigInt(r.payout) > 0n)) {
|
|
57115
|
+
return false;
|
|
57116
|
+
}
|
|
57117
|
+
const closesAt = lateRegistrationClosesAt(options);
|
|
57118
|
+
return closesAt === undefined || nowMs < closesAt;
|
|
57119
|
+
}
|
|
57120
|
+
function levelMinutes(options) {
|
|
57121
|
+
if (!options.blindLevelDuration || options.blindLevelDuration <= 0) {
|
|
57122
|
+
throw new Error(`a sit-and-go needs a positive blindLevelDuration or a blindStructure; got ${options.blindLevelDuration}.`);
|
|
57123
|
+
}
|
|
57124
|
+
return options.blindLevelDuration;
|
|
57125
|
+
}
|
|
57126
|
+
|
|
57065
57127
|
/**
|
|
57066
57128
|
* Poker hand types in order of strength (weakest to strongest)
|
|
57067
57129
|
*/
|
|
@@ -57114,6 +57176,10 @@ class PokerSolver {
|
|
|
57114
57176
|
/**
|
|
57115
57177
|
* Evaluate a 5-card poker hand
|
|
57116
57178
|
*/
|
|
57179
|
+
/**
|
|
57180
|
+
* Evaluate exactly 5 cards (a winner's best hand, WinnerDTO.cards). Use
|
|
57181
|
+
* findBestHand for 7.
|
|
57182
|
+
*/
|
|
57117
57183
|
static evaluateHand(cards) {
|
|
57118
57184
|
if (cards.length !== 5) {
|
|
57119
57185
|
throw new Error("Hand evaluation requires exactly 5 cards");
|
|
@@ -58191,37 +58257,116 @@ class PokerGameIntegration {
|
|
|
58191
58257
|
};
|
|
58192
58258
|
}
|
|
58193
58259
|
/**
|
|
58194
|
-
*
|
|
58260
|
+
* The winning hand in words, from the winner's best five cards
|
|
58261
|
+
* (WinnerDTO.cards) and the board (communityCards): "Full House, Eights
|
|
58262
|
+
* over Sevens", "Diamond Flush, Six high", "Set of Sevens". The board tells
|
|
58263
|
+
* a set (pocket pair plus one on the board) from trips (one hole card plus a
|
|
58264
|
+
* board pair, or all three on the board), which the five cards alone can't.
|
|
58265
|
+
* @param cards The winner's five card mnemonics ("6D")
|
|
58266
|
+
* @param board The community cards
|
|
58267
|
+
* @returns The hand in words, or "" for an uncontested pot (no cards)
|
|
58268
|
+
*/
|
|
58269
|
+
static describeWinningHand(cards, board) {
|
|
58270
|
+
if (!cards || cards.length === 0)
|
|
58271
|
+
return "";
|
|
58272
|
+
if (cards.length !== 5) {
|
|
58273
|
+
throw new Error(`describeWinningHand expects the winning five cards, got ${cards.length}`);
|
|
58274
|
+
}
|
|
58275
|
+
const evaluation = PokerSolver.evaluateHand(cards.map(c => Deck.fromString(c)));
|
|
58276
|
+
if (evaluation.handType === HandType.THREE_OF_A_KIND) {
|
|
58277
|
+
const tripRank = evaluation.rankValues[0];
|
|
58278
|
+
const onBoard = board.map(c => Deck.fromString(c)).filter(c => (c.rank === 1 ? 14 : c.rank) === tripRank).length;
|
|
58279
|
+
if (onBoard === 1)
|
|
58280
|
+
return `Set of ${this.rankWord(tripRank, true)}`;
|
|
58281
|
+
}
|
|
58282
|
+
return this.formatHandDescription(evaluation);
|
|
58283
|
+
}
|
|
58284
|
+
/**
|
|
58285
|
+
* Fill in each winner's name and description from its cards and the board.
|
|
58286
|
+
* The engine no longer writes the hand's wording into chain state
|
|
58287
|
+
* (poker-vm#2721), so callers run game state through this as it arrives and
|
|
58288
|
+
* keep reading winner.name / winner.description as before.
|
|
58289
|
+
*
|
|
58290
|
+
* A winner with five cards gets "Full House, Eights over Sevens" in both
|
|
58291
|
+
* fields. A winner without five cards (an uncontested pot, or an older state
|
|
58292
|
+
* that recorded hole cards) is returned unchanged.
|
|
58293
|
+
*
|
|
58294
|
+
* Returns a new state object; the input is not modified.
|
|
58295
|
+
* @param state Any game state with winners and community cards
|
|
58296
|
+
*/
|
|
58297
|
+
static withWinnerDescriptions(state) {
|
|
58298
|
+
const winners = state.winners.map(winner => {
|
|
58299
|
+
if (!winner.cards || winner.cards.length !== 5)
|
|
58300
|
+
return winner;
|
|
58301
|
+
const description = this.describeWinningHand(winner.cards, state.communityCards);
|
|
58302
|
+
return { ...winner, name: description, description };
|
|
58303
|
+
});
|
|
58304
|
+
return { ...state, winners };
|
|
58305
|
+
}
|
|
58306
|
+
/**
|
|
58307
|
+
* The hand description in words: "Full House, Eights over Sevens", "Quad
|
|
58308
|
+
* Fours", "Diamond Flush, Six high", "Ace high". A flush names its suit from
|
|
58309
|
+
* the best hand. The rank and suit words mirror @block52/deck's rankName /
|
|
58310
|
+
* suitName.
|
|
58195
58311
|
* @param evaluation Hand evaluation result
|
|
58196
58312
|
* @returns Human-readable hand description
|
|
58197
58313
|
*/
|
|
58198
58314
|
static formatHandDescription(evaluation) {
|
|
58199
|
-
const { handType, rankValues, description } = evaluation;
|
|
58315
|
+
const { handType, rankValues, description, bestHand } = evaluation;
|
|
58316
|
+
const suit = this.flushSuitWord(bestHand);
|
|
58317
|
+
const suited = (hand) => (suit ? `${suit} ${hand}` : hand);
|
|
58200
58318
|
switch (handType) {
|
|
58201
58319
|
case HandType.ROYAL_FLUSH:
|
|
58202
|
-
return "Royal Flush";
|
|
58320
|
+
return suit ? `Royal Flush in ${suit}s` : "Royal Flush";
|
|
58203
58321
|
case HandType.STRAIGHT_FLUSH:
|
|
58204
|
-
return
|
|
58322
|
+
return `${suited("Straight Flush")}, ${this.rankWord(rankValues[0])} high`;
|
|
58205
58323
|
case HandType.FOUR_OF_A_KIND:
|
|
58206
|
-
return `
|
|
58324
|
+
return `Quad ${this.rankWord(rankValues[0], true)}`;
|
|
58207
58325
|
case HandType.FULL_HOUSE:
|
|
58208
|
-
return `Full House, ${
|
|
58326
|
+
return `Full House, ${this.rankWord(rankValues[0], true)} over ${this.rankWord(rankValues[1], true)}`;
|
|
58209
58327
|
case HandType.FLUSH:
|
|
58210
|
-
return
|
|
58328
|
+
return `${suited("Flush")}, ${this.rankWord(rankValues[0])} high`;
|
|
58211
58329
|
case HandType.STRAIGHT:
|
|
58212
|
-
return `Straight, ${
|
|
58330
|
+
return `Straight, ${this.rankWord(rankValues[0])} high`;
|
|
58213
58331
|
case HandType.THREE_OF_A_KIND:
|
|
58214
|
-
return `
|
|
58332
|
+
return `Trip ${this.rankWord(rankValues[0], true)}`;
|
|
58215
58333
|
case HandType.TWO_PAIR:
|
|
58216
|
-
return `Two Pair, ${
|
|
58334
|
+
return `Two Pair, ${this.rankWord(rankValues[0], true)} and ${this.rankWord(rankValues[1], true)}`;
|
|
58217
58335
|
case HandType.PAIR:
|
|
58218
|
-
return `Pair of ${
|
|
58336
|
+
return `Pair of ${this.rankWord(rankValues[0], true)}`;
|
|
58219
58337
|
case HandType.HIGH_CARD:
|
|
58220
|
-
return `${
|
|
58338
|
+
return `${this.rankWord(rankValues[0])} high`;
|
|
58221
58339
|
default:
|
|
58222
58340
|
return description;
|
|
58223
58341
|
}
|
|
58224
58342
|
}
|
|
58343
|
+
/** A high-ace rank spelled out ("Ace", "Ten"); plural gives "Aces", "Sixes". */
|
|
58344
|
+
static rankWord(rank, plural = false) {
|
|
58345
|
+
const words = this.RANK_WORDS[rank === 1 ? 14 : rank];
|
|
58346
|
+
if (!words)
|
|
58347
|
+
return plural ? `${PokerSolver.formatRank(rank)}s` : PokerSolver.formatRank(rank);
|
|
58348
|
+
return plural ? words[1] : words[0];
|
|
58349
|
+
}
|
|
58350
|
+
/** The suit word every card of a flush shares ("Diamond"), or "" when the hand is empty or mixed. */
|
|
58351
|
+
static flushSuitWord(cards) {
|
|
58352
|
+
if (!cards || cards.length === 0)
|
|
58353
|
+
return "";
|
|
58354
|
+
const suit = cards[0].suit;
|
|
58355
|
+
if (cards.some(c => c.suit !== suit))
|
|
58356
|
+
return "";
|
|
58357
|
+
switch (suit) {
|
|
58358
|
+
case SUIT.CLUBS:
|
|
58359
|
+
return "Club";
|
|
58360
|
+
case SUIT.DIAMONDS:
|
|
58361
|
+
return "Diamond";
|
|
58362
|
+
case SUIT.HEARTS:
|
|
58363
|
+
return "Heart";
|
|
58364
|
+
case SUIT.SPADES:
|
|
58365
|
+
return "Spade";
|
|
58366
|
+
default:
|
|
58367
|
+
return "";
|
|
58368
|
+
}
|
|
58369
|
+
}
|
|
58225
58370
|
/**
|
|
58226
58371
|
* Example usage with string cards (for testing/debugging)
|
|
58227
58372
|
* @param playerCardStrings Array of player hands as mnemonic strings
|
|
@@ -58242,6 +58387,21 @@ class PokerGameIntegration {
|
|
|
58242
58387
|
return { winners, results };
|
|
58243
58388
|
}
|
|
58244
58389
|
}
|
|
58390
|
+
PokerGameIntegration.RANK_WORDS = {
|
|
58391
|
+
14: ["Ace", "Aces"],
|
|
58392
|
+
13: ["King", "Kings"],
|
|
58393
|
+
12: ["Queen", "Queens"],
|
|
58394
|
+
11: ["Jack", "Jacks"],
|
|
58395
|
+
10: ["Ten", "Tens"],
|
|
58396
|
+
9: ["Nine", "Nines"],
|
|
58397
|
+
8: ["Eight", "Eights"],
|
|
58398
|
+
7: ["Seven", "Sevens"],
|
|
58399
|
+
6: ["Six", "Sixes"],
|
|
58400
|
+
5: ["Five", "Fives"],
|
|
58401
|
+
4: ["Four", "Fours"],
|
|
58402
|
+
3: ["Three", "Threes"],
|
|
58403
|
+
2: ["Two", "Twos"]
|
|
58404
|
+
};
|
|
58245
58405
|
// Example usage:
|
|
58246
58406
|
/*
|
|
58247
58407
|
const example = PokerGameIntegration.exampleShowdown([
|
|
@@ -71516,6 +71676,15 @@ function assertCreatableSngField(minPlayers, maxPlayers, sngConfig, nowSeconds =
|
|
|
71516
71676
|
if (startTime !== undefined && startTime <= nowSeconds) {
|
|
71517
71677
|
throw new Error(`sngConfig.startTime ${startTime} must be in the future (now ${nowSeconds}).`);
|
|
71518
71678
|
}
|
|
71679
|
+
const levels = sngConfig?.lateRegistrationLevels;
|
|
71680
|
+
if (levels !== undefined) {
|
|
71681
|
+
if (!Number.isInteger(levels) || levels <= 0) {
|
|
71682
|
+
throw new Error(`sngConfig.lateRegistrationLevels must be a positive whole number of levels; got ${levels}.`);
|
|
71683
|
+
}
|
|
71684
|
+
if (!startTime) {
|
|
71685
|
+
throw new Error("sngConfig.lateRegistrationLevels needs sngConfig.startTime (late registration is for a scheduled sit-and-go).");
|
|
71686
|
+
}
|
|
71687
|
+
}
|
|
71519
71688
|
}
|
|
71520
71689
|
/**
|
|
71521
71690
|
* Signing Cosmos Client that extends the read-only CosmosClient with transaction capabilities
|
|
@@ -71692,6 +71861,7 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71692
71861
|
// Blind structure (block52/pokerchain#434) as JSON; "" = doubling, and
|
|
71693
71862
|
// an empty proto3 string is not encoded at all.
|
|
71694
71863
|
blindStructure: sngConfig?.blindStructure ? JSON.stringify(sngConfig.blindStructure) : "",
|
|
71864
|
+
lateRegistrationLevels: sngConfig?.lateRegistrationLevels ?? 0,
|
|
71695
71865
|
});
|
|
71696
71866
|
// Create the transaction message
|
|
71697
71867
|
const msg = {
|
|
@@ -71722,7 +71892,8 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71722
71892
|
startingStack: sngConfig.startingStack.toString(),
|
|
71723
71893
|
blindLevelDuration: sngConfig.blindLevelDuration,
|
|
71724
71894
|
entryFee: sngConfig.entryFee?.toString() ?? "0",
|
|
71725
|
-
...(sngConfig.blindStructure && { blindStructure: sngConfig.blindStructure })
|
|
71895
|
+
...(sngConfig.blindStructure && { blindStructure: sngConfig.blindStructure }),
|
|
71896
|
+
...(sngConfig.lateRegistrationLevels && { lateRegistrationLevels: sngConfig.lateRegistrationLevels })
|
|
71726
71897
|
})
|
|
71727
71898
|
});
|
|
71728
71899
|
try {
|
|
@@ -72643,5 +72814,5 @@ const registry = new Registry([
|
|
|
72643
72814
|
...msgTypes,
|
|
72644
72815
|
]);
|
|
72645
72816
|
|
|
72646
|
-
export { AllPlayerActions, BLIND_PRESETS, BLIND_PRESET_STRUCTURES, BLIND_PROGRESSIONS, BLOCK52_HD_PATH, BettingLimit, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GAME_NAME_MICRO_PER_CHAR, GameFormat, GameStatus, GameVariant, HandType, KEYS, MAX_GAME_NAME_LENGTH, MSG_CREATE_VALIDATOR_TYPE_URL, MissingWalletError, NonPlayerActionType, Params$c as 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, TxExecutionError, ValidatorBond, WithdrawalRequest, assertCreatableBettingLimit, assertExecuted, buildMsgCreateValidator, computeGameNameFee, createSigningClientFromMnemonic, createWalletFromMnemonic, decToAtomics, expandBlindLevel, formatBlindStructure, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getBettingLimit, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, holeCardsPerPlayer, isCashFormat, isEmptyAddress, isPotLimit, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseBlindStructure, parseGameFormat, parseGameVariant, registry, resolveBlindPreset, toValoperAddress, txFailureHash, txFailurePhase };
|
|
72817
|
+
export { AllPlayerActions, BLIND_PRESETS, BLIND_PRESET_STRUCTURES, BLIND_PROGRESSIONS, BLOCK52_HD_PATH, BettingLimit, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GAME_NAME_MICRO_PER_CHAR, GameFormat, GameStatus, GameVariant, HandType, KEYS, MAX_GAME_NAME_LENGTH, MSG_CREATE_VALIDATOR_TYPE_URL, MissingWalletError, NonPlayerActionType, Params$c as 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, TxExecutionError, ValidatorBond, WithdrawalRequest, assertCreatableBettingLimit, assertExecuted, buildMsgCreateValidator, computeGameNameFee, createSigningClientFromMnemonic, createWalletFromMnemonic, decToAtomics, expandBlindLevel, formatBlindStructure, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getBettingLimit, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, holeCardsPerPlayer, isCashFormat, isEmptyAddress, isLateRegistrationOpen, isPotLimit, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, lateRegistrationClosesAt, parseBlindStructure, parseGameFormat, parseGameVariant, registry, resolveBlindPreset, toValoperAddress, txFailureHash, txFailurePhase };
|
|
72647
72818
|
//# sourceMappingURL=index.esm.js.map
|