@block52/poker-vm-sdk 1.2.15 → 1.2.17
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/board.d.ts +65 -0
- package/dist/board.d.ts.map +1 -0
- package/dist/index.d.ts +73 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +122 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +122 -4
- package/dist/index.js.map +1 -1
- package/dist/signingClient.d.ts +9 -2
- package/dist/signingClient.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/board.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IJSONModel } from "./deck";
|
|
2
|
+
import { Card, TexasHoldemRound } from "./types/game";
|
|
3
|
+
/**
|
|
4
|
+
* The community board for a Texas Hold'em hand.
|
|
5
|
+
*
|
|
6
|
+
* Encapsulates the two community-card arrays the engine currently keeps — the
|
|
7
|
+
* cards dealt street-by-street (`street`, persisted to the DTO) and the five
|
|
8
|
+
* pre-dealt up front at `deal()` (`preDealt`) — behind one type. This is a pure
|
|
9
|
+
* refactor: every accessor returns exactly what the inline engine logic did, so
|
|
10
|
+
* behaviour is unchanged. Collapsing the two arrays into a single canonical
|
|
11
|
+
* board is a separate, consensus-affecting change (issue #2299).
|
|
12
|
+
*/
|
|
13
|
+
export declare class Board implements IJSONModel {
|
|
14
|
+
static readonly MAX_COMMUNITY_CARDS = 5;
|
|
15
|
+
private readonly street;
|
|
16
|
+
private readonly preDealt;
|
|
17
|
+
/**
|
|
18
|
+
* Append cards dealt for the current street (was `_communityCards.push`).
|
|
19
|
+
*/
|
|
20
|
+
addStreet(cards: Card[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Record the five cards pre-dealt at deal() (was `_communityCards2.push`).
|
|
23
|
+
*/
|
|
24
|
+
setPreDealt(cards: Card[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Number of street-dealt cards (was `_communityCards.length`).
|
|
27
|
+
*/
|
|
28
|
+
get streetLength(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Number of pre-dealt cards (was `_communityCards2.length`).
|
|
31
|
+
*/
|
|
32
|
+
get preDealtLength(): number;
|
|
33
|
+
/**
|
|
34
|
+
* The street-dealt community cards (was `[...this._communityCards]`).
|
|
35
|
+
*/
|
|
36
|
+
get cards(): Card[];
|
|
37
|
+
/**
|
|
38
|
+
* The community cards visible at a given round, taken from the pre-dealt
|
|
39
|
+
* board — matching the previous `getCommunityCards()` exactly:
|
|
40
|
+
* FLOP -> preDealt[0..3], TURN -> preDealt[0..4], RIVER -> preDealt[0..5].
|
|
41
|
+
*/
|
|
42
|
+
forRound(round: TexasHoldemRound): Card[];
|
|
43
|
+
/**
|
|
44
|
+
* The board `findWinners` falls back to when `forRound` is short: the
|
|
45
|
+
* pre-dealt board for live games, else the street board rehydrated from JSON.
|
|
46
|
+
* Preserves the previous inline selection verbatim.
|
|
47
|
+
*/
|
|
48
|
+
forEvaluation(count: number): Card[];
|
|
49
|
+
/**
|
|
50
|
+
* The board `calculateWinner` falls back to at an early showdown: the fully
|
|
51
|
+
* dealt street board if available, else the pre-dealt board. Preserves the
|
|
52
|
+
* previous inline selection verbatim.
|
|
53
|
+
*/
|
|
54
|
+
forShowdown(): Card[];
|
|
55
|
+
/**
|
|
56
|
+
* Clear both boards for a new hand (was two `.length = 0` assignments).
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Serialize the street board to mnemonics, matching
|
|
61
|
+
* `TexasHoldemStateDTO.communityCards` (was `_communityCards.map(...)`).
|
|
62
|
+
*/
|
|
63
|
+
toJson(): string[];
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;GASG;AACH,qBAAa,KAAM,YAAW,UAAU;IACpC,gBAAuB,mBAAmB,KAAK;IAI/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IAEvC;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAIrC;;OAEG;IACI,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAIvC;;OAEG;IACH,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,MAAM,CAElC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,IAAI,EAAE,CAEzB;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAAE;IAchD;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE;IAM3C;;;;OAIG;IACI,WAAW,IAAI,IAAI,EAAE;IAM5B;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB;;;OAGG;IACI,MAAM,IAAI,MAAM,EAAE;CAG5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -46125,6 +46125,69 @@ declare class Deck implements IDeck, IJSONModel {
|
|
|
46125
46125
|
private initStandard52;
|
|
46126
46126
|
}
|
|
46127
46127
|
|
|
46128
|
+
/**
|
|
46129
|
+
* The community board for a Texas Hold'em hand.
|
|
46130
|
+
*
|
|
46131
|
+
* Encapsulates the two community-card arrays the engine currently keeps — the
|
|
46132
|
+
* cards dealt street-by-street (`street`, persisted to the DTO) and the five
|
|
46133
|
+
* pre-dealt up front at `deal()` (`preDealt`) — behind one type. This is a pure
|
|
46134
|
+
* refactor: every accessor returns exactly what the inline engine logic did, so
|
|
46135
|
+
* behaviour is unchanged. Collapsing the two arrays into a single canonical
|
|
46136
|
+
* board is a separate, consensus-affecting change (issue #2299).
|
|
46137
|
+
*/
|
|
46138
|
+
declare class Board implements IJSONModel {
|
|
46139
|
+
static readonly MAX_COMMUNITY_CARDS = 5;
|
|
46140
|
+
private readonly street;
|
|
46141
|
+
private readonly preDealt;
|
|
46142
|
+
/**
|
|
46143
|
+
* Append cards dealt for the current street (was `_communityCards.push`).
|
|
46144
|
+
*/
|
|
46145
|
+
addStreet(cards: Card[]): void;
|
|
46146
|
+
/**
|
|
46147
|
+
* Record the five cards pre-dealt at deal() (was `_communityCards2.push`).
|
|
46148
|
+
*/
|
|
46149
|
+
setPreDealt(cards: Card[]): void;
|
|
46150
|
+
/**
|
|
46151
|
+
* Number of street-dealt cards (was `_communityCards.length`).
|
|
46152
|
+
*/
|
|
46153
|
+
get streetLength(): number;
|
|
46154
|
+
/**
|
|
46155
|
+
* Number of pre-dealt cards (was `_communityCards2.length`).
|
|
46156
|
+
*/
|
|
46157
|
+
get preDealtLength(): number;
|
|
46158
|
+
/**
|
|
46159
|
+
* The street-dealt community cards (was `[...this._communityCards]`).
|
|
46160
|
+
*/
|
|
46161
|
+
get cards(): Card[];
|
|
46162
|
+
/**
|
|
46163
|
+
* The community cards visible at a given round, taken from the pre-dealt
|
|
46164
|
+
* board — matching the previous `getCommunityCards()` exactly:
|
|
46165
|
+
* FLOP -> preDealt[0..3], TURN -> preDealt[0..4], RIVER -> preDealt[0..5].
|
|
46166
|
+
*/
|
|
46167
|
+
forRound(round: TexasHoldemRound): Card[];
|
|
46168
|
+
/**
|
|
46169
|
+
* The board `findWinners` falls back to when `forRound` is short: the
|
|
46170
|
+
* pre-dealt board for live games, else the street board rehydrated from JSON.
|
|
46171
|
+
* Preserves the previous inline selection verbatim.
|
|
46172
|
+
*/
|
|
46173
|
+
forEvaluation(count: number): Card[];
|
|
46174
|
+
/**
|
|
46175
|
+
* The board `calculateWinner` falls back to at an early showdown: the fully
|
|
46176
|
+
* dealt street board if available, else the pre-dealt board. Preserves the
|
|
46177
|
+
* previous inline selection verbatim.
|
|
46178
|
+
*/
|
|
46179
|
+
forShowdown(): Card[];
|
|
46180
|
+
/**
|
|
46181
|
+
* Clear both boards for a new hand (was two `.length = 0` assignments).
|
|
46182
|
+
*/
|
|
46183
|
+
clear(): void;
|
|
46184
|
+
/**
|
|
46185
|
+
* Serialize the street board to mnemonics, matching
|
|
46186
|
+
* `TexasHoldemStateDTO.communityCards` (was `_communityCards.map(...)`).
|
|
46187
|
+
*/
|
|
46188
|
+
toJson(): string[];
|
|
46189
|
+
}
|
|
46190
|
+
|
|
46128
46191
|
/**
|
|
46129
46192
|
* Example integration of custom poker solver with game engine
|
|
46130
46193
|
* Demonstrates how to replace pokersolver with our custom implementation
|
|
@@ -46446,9 +46509,16 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
46446
46509
|
*/
|
|
46447
46510
|
joinGame(gameId: string, seat: number, buyInAmount: bigint): Promise<string>;
|
|
46448
46511
|
/**
|
|
46449
|
-
* Leave a poker game
|
|
46512
|
+
* Leave a poker game (signs AND broadcasts MsgLeaveGame directly).
|
|
46513
|
+
*
|
|
46514
|
+
* @param gameId the game to leave / claim from.
|
|
46515
|
+
* @param finishingOrder place-1-first player addresses for an SNG that
|
|
46516
|
+
* finalized off-chain (WS-first) — lets the chain recompute payouts when
|
|
46517
|
+
* its Results are empty. Defaults to `[]` (cash games / already-finalized
|
|
46518
|
+
* SNGs, where the chain settles from its own state). Broadcast counterpart
|
|
46519
|
+
* of {@link signLeaveGame}.
|
|
46450
46520
|
*/
|
|
46451
|
-
leaveGame(gameId: string): Promise<string>;
|
|
46521
|
+
leaveGame(gameId: string, finishingOrder?: string[]): Promise<string>;
|
|
46452
46522
|
/**
|
|
46453
46523
|
* Record a hand-end game-state snapshot on the chain (pokerchain#239).
|
|
46454
46524
|
*
|
|
@@ -46904,5 +46974,5 @@ declare const Client: typeof IgniteClient & Constructor<{
|
|
|
46904
46974
|
}>;
|
|
46905
46975
|
declare const registry: Registry;
|
|
46906
46976
|
|
|
46907
|
-
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 };
|
|
46977
|
+
export { AllPlayerActions, BLOCK52_HD_PATH, Board, 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 };
|
|
46908
46978
|
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.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,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,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,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGvG,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGzF,OAAO,EACL,MAAM,EACN,QAAQ,EACR,kBAAkB,EACnB,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,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,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGvG,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
|
@@ -57317,6 +57317,109 @@ Deck.SUIT_MAP = {
|
|
|
57317
57317
|
[SUIT.SPADES]: "S"
|
|
57318
57318
|
};
|
|
57319
57319
|
|
|
57320
|
+
/**
|
|
57321
|
+
* The community board for a Texas Hold'em hand.
|
|
57322
|
+
*
|
|
57323
|
+
* Encapsulates the two community-card arrays the engine currently keeps — the
|
|
57324
|
+
* cards dealt street-by-street (`street`, persisted to the DTO) and the five
|
|
57325
|
+
* pre-dealt up front at `deal()` (`preDealt`) — behind one type. This is a pure
|
|
57326
|
+
* refactor: every accessor returns exactly what the inline engine logic did, so
|
|
57327
|
+
* behaviour is unchanged. Collapsing the two arrays into a single canonical
|
|
57328
|
+
* board is a separate, consensus-affecting change (issue #2299).
|
|
57329
|
+
*/
|
|
57330
|
+
class Board {
|
|
57331
|
+
constructor() {
|
|
57332
|
+
// Dealt one street at a time via dealCommunityCards() (was `_communityCards`).
|
|
57333
|
+
// This is the board persisted to the game DTO and rehydrated from JSON.
|
|
57334
|
+
this.street = [];
|
|
57335
|
+
// All five dealt up front at deal() (was `_communityCards2`).
|
|
57336
|
+
this.preDealt = [];
|
|
57337
|
+
}
|
|
57338
|
+
/**
|
|
57339
|
+
* Append cards dealt for the current street (was `_communityCards.push`).
|
|
57340
|
+
*/
|
|
57341
|
+
addStreet(cards) {
|
|
57342
|
+
this.street.push(...cards);
|
|
57343
|
+
}
|
|
57344
|
+
/**
|
|
57345
|
+
* Record the five cards pre-dealt at deal() (was `_communityCards2.push`).
|
|
57346
|
+
*/
|
|
57347
|
+
setPreDealt(cards) {
|
|
57348
|
+
this.preDealt.push(...cards);
|
|
57349
|
+
}
|
|
57350
|
+
/**
|
|
57351
|
+
* Number of street-dealt cards (was `_communityCards.length`).
|
|
57352
|
+
*/
|
|
57353
|
+
get streetLength() {
|
|
57354
|
+
return this.street.length;
|
|
57355
|
+
}
|
|
57356
|
+
/**
|
|
57357
|
+
* Number of pre-dealt cards (was `_communityCards2.length`).
|
|
57358
|
+
*/
|
|
57359
|
+
get preDealtLength() {
|
|
57360
|
+
return this.preDealt.length;
|
|
57361
|
+
}
|
|
57362
|
+
/**
|
|
57363
|
+
* The street-dealt community cards (was `[...this._communityCards]`).
|
|
57364
|
+
*/
|
|
57365
|
+
get cards() {
|
|
57366
|
+
return [...this.street];
|
|
57367
|
+
}
|
|
57368
|
+
/**
|
|
57369
|
+
* The community cards visible at a given round, taken from the pre-dealt
|
|
57370
|
+
* board — matching the previous `getCommunityCards()` exactly:
|
|
57371
|
+
* FLOP -> preDealt[0..3], TURN -> preDealt[0..4], RIVER -> preDealt[0..5].
|
|
57372
|
+
*/
|
|
57373
|
+
forRound(round) {
|
|
57374
|
+
const cards = [];
|
|
57375
|
+
if (round === TexasHoldemRound.FLOP) {
|
|
57376
|
+
cards.push(...this.preDealt.slice(0, 3));
|
|
57377
|
+
}
|
|
57378
|
+
if (round === TexasHoldemRound.TURN) {
|
|
57379
|
+
cards.push(...this.preDealt.slice(0, 4));
|
|
57380
|
+
}
|
|
57381
|
+
if (round === TexasHoldemRound.RIVER) {
|
|
57382
|
+
cards.push(...this.preDealt.slice(0, 5));
|
|
57383
|
+
}
|
|
57384
|
+
return cards;
|
|
57385
|
+
}
|
|
57386
|
+
/**
|
|
57387
|
+
* The board `findWinners` falls back to when `forRound` is short: the
|
|
57388
|
+
* pre-dealt board for live games, else the street board rehydrated from JSON.
|
|
57389
|
+
* Preserves the previous inline selection verbatim.
|
|
57390
|
+
*/
|
|
57391
|
+
forEvaluation(count) {
|
|
57392
|
+
return this.preDealt.length >= count
|
|
57393
|
+
? this.preDealt.slice(0, count)
|
|
57394
|
+
: this.street.slice(0, count);
|
|
57395
|
+
}
|
|
57396
|
+
/**
|
|
57397
|
+
* The board `calculateWinner` falls back to at an early showdown: the fully
|
|
57398
|
+
* dealt street board if available, else the pre-dealt board. Preserves the
|
|
57399
|
+
* previous inline selection verbatim.
|
|
57400
|
+
*/
|
|
57401
|
+
forShowdown() {
|
|
57402
|
+
return this.street.length >= Board.MAX_COMMUNITY_CARDS
|
|
57403
|
+
? this.street.slice(0, Board.MAX_COMMUNITY_CARDS)
|
|
57404
|
+
: this.preDealt.slice(0, Board.MAX_COMMUNITY_CARDS);
|
|
57405
|
+
}
|
|
57406
|
+
/**
|
|
57407
|
+
* Clear both boards for a new hand (was two `.length = 0` assignments).
|
|
57408
|
+
*/
|
|
57409
|
+
clear() {
|
|
57410
|
+
this.street.length = 0;
|
|
57411
|
+
this.preDealt.length = 0;
|
|
57412
|
+
}
|
|
57413
|
+
/**
|
|
57414
|
+
* Serialize the street board to mnemonics, matching
|
|
57415
|
+
* `TexasHoldemStateDTO.communityCards` (was `_communityCards.map(...)`).
|
|
57416
|
+
*/
|
|
57417
|
+
toJson() {
|
|
57418
|
+
return this.street.map(card => card.mnemonic);
|
|
57419
|
+
}
|
|
57420
|
+
}
|
|
57421
|
+
Board.MAX_COMMUNITY_CARDS = 5;
|
|
57422
|
+
|
|
57320
57423
|
/**
|
|
57321
57424
|
* Example integration of custom poker solver with game engine
|
|
57322
57425
|
* Demonstrates how to replace pokersolver with our custom implementation
|
|
@@ -61053,19 +61156,33 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
61053
61156
|
}
|
|
61054
61157
|
}
|
|
61055
61158
|
/**
|
|
61056
|
-
* Leave a poker game
|
|
61159
|
+
* Leave a poker game (signs AND broadcasts MsgLeaveGame directly).
|
|
61160
|
+
*
|
|
61161
|
+
* @param gameId the game to leave / claim from.
|
|
61162
|
+
* @param finishingOrder place-1-first player addresses for an SNG that
|
|
61163
|
+
* finalized off-chain (WS-first) — lets the chain recompute payouts when
|
|
61164
|
+
* its Results are empty. Defaults to `[]` (cash games / already-finalized
|
|
61165
|
+
* SNGs, where the chain settles from its own state). Broadcast counterpart
|
|
61166
|
+
* of {@link signLeaveGame}.
|
|
61057
61167
|
*/
|
|
61058
|
-
async leaveGame(gameId) {
|
|
61168
|
+
async leaveGame(gameId, finishingOrder = []) {
|
|
61059
61169
|
await this.initializeSigningClient();
|
|
61060
61170
|
if (!this.signingClient || !this.wallet) {
|
|
61061
61171
|
throw new Error("Signing client not initialized");
|
|
61062
61172
|
}
|
|
61063
61173
|
const [account] = await this.wallet.getAccounts();
|
|
61064
61174
|
const creator = account.address;
|
|
61065
|
-
// Create the message object
|
|
61175
|
+
// Create the message object.
|
|
61176
|
+
//
|
|
61177
|
+
// finishingOrder (place-1-first player addresses) is for an SNG that
|
|
61178
|
+
// finalized off-chain (WS-first): the chain's Results may be empty, so
|
|
61179
|
+
// the message supplies the ORDER and the chain recomputes payouts from
|
|
61180
|
+
// its own prize-pool math — never an amount. Empty for cash games and
|
|
61181
|
+
// for SNGs the chain already finalized. Mirrors signLeaveGame. (pokerchain#229)
|
|
61066
61182
|
const msgLeaveGame = {
|
|
61067
61183
|
creator,
|
|
61068
|
-
gameId
|
|
61184
|
+
gameId,
|
|
61185
|
+
finishingOrder
|
|
61069
61186
|
};
|
|
61070
61187
|
// Create the transaction message
|
|
61071
61188
|
const msg = {
|
|
@@ -61847,5 +61964,5 @@ const registry = new Registry([
|
|
|
61847
61964
|
...msgTypes,
|
|
61848
61965
|
]);
|
|
61849
61966
|
|
|
61850
|
-
export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, 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, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
|
|
61967
|
+
export { AllPlayerActions, BLOCK52_HD_PATH, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, 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, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
|
|
61851
61968
|
//# sourceMappingURL=index.esm.js.map
|