@block52/poker-vm-sdk 1.5.1 → 1.7.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 +66 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +122 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +125 -10
- package/dist/index.js.map +1 -1
- package/dist/pokerSolver.d.ts +15 -3
- package/dist/pokerSolver.d.ts.map +1 -1
- package/dist/pokerchain.poker.v1/types/pokerchain/poker/v1/tx.d.ts +6 -0
- package/dist/pokerchain.poker.v1/types/pokerchain/poker/v1/tx.d.ts.map +1 -1
- package/dist/signingClient.d.ts +13 -2
- package/dist/signingClient.d.ts.map +1 -1
- package/dist/types/game.d.ts +11 -0
- package/dist/types/game.d.ts.map +1 -1
- package/dist/utils/gameFormatUtils.d.ts +23 -1
- package/dist/utils/gameFormatUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44946,6 +44946,12 @@ interface MsgCreateGame {
|
|
|
44946
44946
|
* globally unique, $0.10/char to validators. Empty = unnamed. (block52/pokerchain#337)
|
|
44947
44947
|
*/
|
|
44948
44948
|
name: string;
|
|
44949
|
+
/**
|
|
44950
|
+
* Betting structure (field 20): "no-limit" | "pot-limit". Empty = the
|
|
44951
|
+
* variant's default, pot-limit for omaha, no-limit for texas-holdem.
|
|
44952
|
+
* (block52/pokerchain#407)
|
|
44953
|
+
*/
|
|
44954
|
+
bettingLimit: string;
|
|
44949
44955
|
}
|
|
44950
44956
|
declare const MsgCreateGame: MessageFns<MsgCreateGame>;
|
|
44951
44957
|
/** MsgJoinGame defines the MsgJoinGame message. */
|
|
@@ -45286,6 +45292,16 @@ declare enum GameVariant {
|
|
|
45286
45292
|
TEXAS_HOLDEM = "texas-holdem",
|
|
45287
45293
|
OMAHA = "omaha"
|
|
45288
45294
|
}
|
|
45295
|
+
/**
|
|
45296
|
+
* BettingLimit — the table's betting structure. Orthogonal to GameVariant: any
|
|
45297
|
+
* variant can be played at any limit (pot-limit Omaha, pot-limit Hold'em,
|
|
45298
|
+
* fixed-limit Hold'em, …). Absent on GameOptions ⇒ no-limit (current behavior).
|
|
45299
|
+
*/
|
|
45300
|
+
declare enum BettingLimit {
|
|
45301
|
+
NO_LIMIT = "no-limit",
|
|
45302
|
+
POT_LIMIT = "pot-limit",
|
|
45303
|
+
FIXED_LIMIT = "fixed-limit"
|
|
45304
|
+
}
|
|
45289
45305
|
declare enum GameStatus {
|
|
45290
45306
|
WAITING_FOR_PLAYERS = "waiting-for-players",
|
|
45291
45307
|
REGISTRATION = "registration",
|
|
@@ -45387,6 +45403,7 @@ type GameOptionsDTO = {
|
|
|
45387
45403
|
levelStartTime?: number;
|
|
45388
45404
|
timeBankMs?: number;
|
|
45389
45405
|
timeBankCapMs?: number;
|
|
45406
|
+
bettingLimit?: BettingLimit;
|
|
45390
45407
|
otherOptions?: Record<string, any>;
|
|
45391
45408
|
};
|
|
45392
45409
|
type ActionDTO = {
|
|
@@ -45941,6 +45958,28 @@ declare const getGameVariant: (variant: GameVariant | string | undefined) => Gam
|
|
|
45941
45958
|
* @returns GameVariant enum value, or "unknown" if invalid
|
|
45942
45959
|
*/
|
|
45943
45960
|
declare const parseGameVariant: (value: string | undefined) => GameVariant | "unknown";
|
|
45961
|
+
/**
|
|
45962
|
+
* The betting structure a table plays. The engine treats an absent
|
|
45963
|
+
* `gameOptions.bettingLimit` as no-limit (poker-vm#2652), so this mirrors that
|
|
45964
|
+
* rule rather than inventing a default (block52/pokerchain#407).
|
|
45965
|
+
*
|
|
45966
|
+
* @param options - the table's gameOptions (or anything carrying bettingLimit)
|
|
45967
|
+
* @returns the table's BettingLimit
|
|
45968
|
+
*/
|
|
45969
|
+
declare const getBettingLimit: (options: {
|
|
45970
|
+
bettingLimit?: BettingLimit;
|
|
45971
|
+
} | undefined) => BettingLimit;
|
|
45972
|
+
/**
|
|
45973
|
+
* Check whether a table is pot-limit (its max bet or raise is the pot cap).
|
|
45974
|
+
*/
|
|
45975
|
+
declare const isPotLimit: (options: {
|
|
45976
|
+
bettingLimit?: BettingLimit;
|
|
45977
|
+
} | undefined) => boolean;
|
|
45978
|
+
/**
|
|
45979
|
+
* How many hole cards a variant deals each player: 4 for Omaha, 2 for Texas
|
|
45980
|
+
* Hold'em. Mirrors the engine's HoleCardsPerPlayer (poker-vm#2650).
|
|
45981
|
+
*/
|
|
45982
|
+
declare const holeCardsPerPlayer: (variant: GameVariant | string | undefined) => number;
|
|
45944
45983
|
|
|
45945
45984
|
/**
|
|
45946
45985
|
* Check if a specific action is available in the legal actions list.
|
|
@@ -46034,6 +46073,16 @@ declare class PokerSolver {
|
|
|
46034
46073
|
* Find the best 5-card hand from 7 cards
|
|
46035
46074
|
*/
|
|
46036
46075
|
static findBestHand(cards: Card[]): HandEvaluation;
|
|
46076
|
+
/**
|
|
46077
|
+
* Find the best Omaha hand: EXACTLY 2 of the 4 hole cards and EXACTLY 3 of
|
|
46078
|
+
* the 5 board cards — C(4,2) x C(5,3) = 60 candidates, ranked like Hold'em.
|
|
46079
|
+
* Mirrors the engine's FindBestOmahaHand (poker-vm#2650).
|
|
46080
|
+
*/
|
|
46081
|
+
static findBestOmahaHand(holeCards: Card[], communityCards: Card[]): HandEvaluation;
|
|
46082
|
+
/**
|
|
46083
|
+
* Best hand for a variant from hole cards and a full 5-card board.
|
|
46084
|
+
*/
|
|
46085
|
+
private static bestHandForVariant;
|
|
46037
46086
|
/**
|
|
46038
46087
|
* Evaluate a hand with any number of cards (2-7)
|
|
46039
46088
|
* This is useful for showing hand strength during all betting rounds
|
|
@@ -46115,12 +46164,14 @@ declare class PokerSolver {
|
|
|
46115
46164
|
static calculateWinPercentages(handA: Card[], handB: Card[], communityCards?: Card[], simulations?: number): [number, number, number];
|
|
46116
46165
|
/**
|
|
46117
46166
|
* Calculate win percentages for multiple players (2+) using Monte Carlo simulation
|
|
46118
|
-
* @param hands Array of hole cards for each player (each
|
|
46167
|
+
* @param hands Array of hole cards for each player (2 each for Hold'em, 4 for Omaha)
|
|
46119
46168
|
* @param communityCards Current community cards (0-5 cards)
|
|
46120
46169
|
* @param simulations Number of simulations to run (default: 10000)
|
|
46170
|
+
* @param variant The table's variant; omitted = Texas Hold'em. Omaha hands are
|
|
46171
|
+
* scored with the two-plus-three rule (ui#769).
|
|
46121
46172
|
* @returns Object containing win percentages for each player and overall tie percentage
|
|
46122
46173
|
*/
|
|
46123
|
-
static calculateMultiPlayerEquity(hands: Card[][], communityCards?: Card[], simulations?: number): {
|
|
46174
|
+
static calculateMultiPlayerEquity(hands: Card[][], communityCards?: Card[], simulations?: number, variant?: GameVariant): {
|
|
46124
46175
|
winPercentages: number[];
|
|
46125
46176
|
tiePercentage: number;
|
|
46126
46177
|
};
|
|
@@ -46607,9 +46658,14 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
46607
46658
|
*/
|
|
46608
46659
|
sendB52USDC(fromAddress: string, toAddress: string, amount: bigint, memo?: string): Promise<string>;
|
|
46609
46660
|
/**
|
|
46610
|
-
* Create a new poker game
|
|
46661
|
+
* Create a new poker game.
|
|
46662
|
+
*
|
|
46663
|
+
* `bettingLimit` is the table's betting structure (block52/pokerchain#407).
|
|
46664
|
+
* Omit it for the variant's default: pot-limit for omaha (PLO), no-limit for
|
|
46665
|
+
* texas-holdem. Omitted, the field is not encoded at all, so a chain without
|
|
46666
|
+
* it accepts the tx unchanged. Fixed-limit is not playable yet (poker-vm#2654).
|
|
46611
46667
|
*/
|
|
46612
|
-
createGame(gameFormat: string, gameVariant: string, minPlayers: number, maxPlayers: number, minBuyInB52USDC: bigint, maxBuyInB52USDC: bigint, smallBlindB52USDC: bigint, bigBlindB52USDC: bigint, timeout: number, rakeConfig?: RakeConfig, sngConfig?: SNGConfig, name?: string): Promise<string>;
|
|
46668
|
+
createGame(gameFormat: string, gameVariant: string, minPlayers: number, maxPlayers: number, minBuyInB52USDC: bigint, maxBuyInB52USDC: bigint, smallBlindB52USDC: bigint, bigBlindB52USDC: bigint, timeout: number, rakeConfig?: RakeConfig, sngConfig?: SNGConfig, name?: string, bettingLimit?: BettingLimit): Promise<string>;
|
|
46613
46669
|
/**
|
|
46614
46670
|
* Join a poker game
|
|
46615
46671
|
*/
|
|
@@ -46852,6 +46908,11 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
46852
46908
|
* Create a signing client from a mnemonic
|
|
46853
46909
|
*/
|
|
46854
46910
|
declare function createSigningClientFromMnemonic(config: CosmosConfig, mnemonic: string): Promise<SigningCosmosClient>;
|
|
46911
|
+
/**
|
|
46912
|
+
* Throws for a betting limit a table cannot be created with (block52/pokerchain#407).
|
|
46913
|
+
* Undefined is allowed: the chain applies the variant's default.
|
|
46914
|
+
*/
|
|
46915
|
+
declare function assertCreatableBettingLimit(bettingLimit?: BettingLimit): void;
|
|
46855
46916
|
|
|
46856
46917
|
/**
|
|
46857
46918
|
* The part of a broadcast result this module reads. Structurally a subset of
|
|
@@ -47167,5 +47228,5 @@ declare const Client: typeof IgniteClient & Constructor<{
|
|
|
47167
47228
|
}>;
|
|
47168
47229
|
declare const registry: Registry;
|
|
47169
47230
|
|
|
47170
|
-
export { AllPlayerActions, BLOCK52_HD_PATH, 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, assertExecuted, buildMsgCreateValidator, computeGameNameFee, createSigningClientFromMnemonic, createWalletFromMnemonic, decToAtomics, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry, toValoperAddress, txFailureHash, txFailurePhase };
|
|
47231
|
+
export { AllPlayerActions, 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, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getBettingLimit, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, holeCardsPerPlayer, isCashFormat, isEmptyAddress, isPotLimit, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry, toValoperAddress, txFailureHash, txFailurePhase };
|
|
47171
47232
|
export type { AccountDTO, ActionDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, CreateValidatorParams, EquityHand, EquityRequest, EquityResponse, EquityResult, ExecutionResult, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, GameStateResponseDTO, HandEvaluation, ISignedResponse, LegalActionDTO, PayoutPlaceDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, SitInMethod, SitOutMethod, 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,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;
|
|
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,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
|
@@ -2845,6 +2845,7 @@ function createBaseMsgCreateGame() {
|
|
|
2845
2845
|
gameVariant: "",
|
|
2846
2846
|
entryFee: Long.UZERO,
|
|
2847
2847
|
name: "",
|
|
2848
|
+
bettingLimit: "",
|
|
2848
2849
|
};
|
|
2849
2850
|
}
|
|
2850
2851
|
const MsgCreateGame = {
|
|
@@ -2903,6 +2904,9 @@ const MsgCreateGame = {
|
|
|
2903
2904
|
if (message.name !== "") {
|
|
2904
2905
|
writer.uint32(154).string(message.name);
|
|
2905
2906
|
}
|
|
2907
|
+
if (message.bettingLimit !== "") {
|
|
2908
|
+
writer.uint32(162).string(message.bettingLimit);
|
|
2909
|
+
}
|
|
2906
2910
|
return writer;
|
|
2907
2911
|
},
|
|
2908
2912
|
decode(input, length) {
|
|
@@ -3038,6 +3042,13 @@ const MsgCreateGame = {
|
|
|
3038
3042
|
message.name = reader.string();
|
|
3039
3043
|
continue;
|
|
3040
3044
|
}
|
|
3045
|
+
case 20: {
|
|
3046
|
+
if (tag !== 162) {
|
|
3047
|
+
break;
|
|
3048
|
+
}
|
|
3049
|
+
message.bettingLimit = reader.string();
|
|
3050
|
+
continue;
|
|
3051
|
+
}
|
|
3041
3052
|
}
|
|
3042
3053
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3043
3054
|
break;
|
|
@@ -3066,6 +3077,7 @@ const MsgCreateGame = {
|
|
|
3066
3077
|
gameVariant: isSet$2b(object.gameVariant) ? globalThis.String(object.gameVariant) : "",
|
|
3067
3078
|
entryFee: isSet$2b(object.entryFee) ? Long.fromValue(object.entryFee) : Long.UZERO,
|
|
3068
3079
|
name: isSet$2b(object.name) ? globalThis.String(object.name) : "",
|
|
3080
|
+
bettingLimit: isSet$2b(object.bettingLimit) ? globalThis.String(object.bettingLimit) : "",
|
|
3069
3081
|
};
|
|
3070
3082
|
},
|
|
3071
3083
|
toJSON(message) {
|
|
@@ -3124,6 +3136,9 @@ const MsgCreateGame = {
|
|
|
3124
3136
|
if (message.name !== "") {
|
|
3125
3137
|
obj.name = message.name;
|
|
3126
3138
|
}
|
|
3139
|
+
if (message.bettingLimit !== "") {
|
|
3140
|
+
obj.bettingLimit = message.bettingLimit;
|
|
3141
|
+
}
|
|
3127
3142
|
return obj;
|
|
3128
3143
|
},
|
|
3129
3144
|
create(base) {
|
|
@@ -3168,6 +3183,7 @@ const MsgCreateGame = {
|
|
|
3168
3183
|
message.blindLevelDuration = object.blindLevelDuration ?? 0;
|
|
3169
3184
|
message.gameVariant = object.gameVariant ?? "";
|
|
3170
3185
|
message.name = object.name ?? "";
|
|
3186
|
+
message.bettingLimit = object.bettingLimit ?? "";
|
|
3171
3187
|
message.entryFee = (object.entryFee !== undefined && object.entryFee !== null)
|
|
3172
3188
|
? Long.fromValue(object.entryFee)
|
|
3173
3189
|
: Long.UZERO;
|
|
@@ -56095,6 +56111,17 @@ var GameVariant;
|
|
|
56095
56111
|
GameVariant["TEXAS_HOLDEM"] = "texas-holdem";
|
|
56096
56112
|
GameVariant["OMAHA"] = "omaha";
|
|
56097
56113
|
})(GameVariant || (GameVariant = {}));
|
|
56114
|
+
/**
|
|
56115
|
+
* BettingLimit — the table's betting structure. Orthogonal to GameVariant: any
|
|
56116
|
+
* variant can be played at any limit (pot-limit Omaha, pot-limit Hold'em,
|
|
56117
|
+
* fixed-limit Hold'em, …). Absent on GameOptions ⇒ no-limit (current behavior).
|
|
56118
|
+
*/
|
|
56119
|
+
var BettingLimit;
|
|
56120
|
+
(function (BettingLimit) {
|
|
56121
|
+
BettingLimit["NO_LIMIT"] = "no-limit";
|
|
56122
|
+
BettingLimit["POT_LIMIT"] = "pot-limit";
|
|
56123
|
+
BettingLimit["FIXED_LIMIT"] = "fixed-limit";
|
|
56124
|
+
})(BettingLimit || (BettingLimit = {}));
|
|
56098
56125
|
var GameStatus;
|
|
56099
56126
|
(function (GameStatus) {
|
|
56100
56127
|
GameStatus["WAITING_FOR_PLAYERS"] = "waiting-for-players";
|
|
@@ -56466,6 +56493,30 @@ const parseGameVariant = (value) => {
|
|
|
56466
56493
|
return "unknown";
|
|
56467
56494
|
}
|
|
56468
56495
|
};
|
|
56496
|
+
/**
|
|
56497
|
+
* The betting structure a table plays. The engine treats an absent
|
|
56498
|
+
* `gameOptions.bettingLimit` as no-limit (poker-vm#2652), so this mirrors that
|
|
56499
|
+
* rule rather than inventing a default (block52/pokerchain#407).
|
|
56500
|
+
*
|
|
56501
|
+
* @param options - the table's gameOptions (or anything carrying bettingLimit)
|
|
56502
|
+
* @returns the table's BettingLimit
|
|
56503
|
+
*/
|
|
56504
|
+
const getBettingLimit = (options) => {
|
|
56505
|
+
return options?.bettingLimit ?? BettingLimit.NO_LIMIT;
|
|
56506
|
+
};
|
|
56507
|
+
/**
|
|
56508
|
+
* Check whether a table is pot-limit (its max bet or raise is the pot cap).
|
|
56509
|
+
*/
|
|
56510
|
+
const isPotLimit = (options) => {
|
|
56511
|
+
return getBettingLimit(options) === BettingLimit.POT_LIMIT;
|
|
56512
|
+
};
|
|
56513
|
+
/**
|
|
56514
|
+
* How many hole cards a variant deals each player: 4 for Omaha, 2 for Texas
|
|
56515
|
+
* Hold'em. Mirrors the engine's HoleCardsPerPlayer (poker-vm#2650).
|
|
56516
|
+
*/
|
|
56517
|
+
const holeCardsPerPlayer = (variant) => {
|
|
56518
|
+
return variant === GameVariant.OMAHA ? 4 : 2;
|
|
56519
|
+
};
|
|
56469
56520
|
|
|
56470
56521
|
/**
|
|
56471
56522
|
* Check if a specific action is available in the legal actions list.
|
|
@@ -56721,6 +56772,41 @@ class PokerSolver {
|
|
|
56721
56772
|
}
|
|
56722
56773
|
return bestHand;
|
|
56723
56774
|
}
|
|
56775
|
+
/**
|
|
56776
|
+
* Find the best Omaha hand: EXACTLY 2 of the 4 hole cards and EXACTLY 3 of
|
|
56777
|
+
* the 5 board cards — C(4,2) x C(5,3) = 60 candidates, ranked like Hold'em.
|
|
56778
|
+
* Mirrors the engine's FindBestOmahaHand (poker-vm#2650).
|
|
56779
|
+
*/
|
|
56780
|
+
static findBestOmahaHand(holeCards, communityCards) {
|
|
56781
|
+
if (holeCards.length !== 4) {
|
|
56782
|
+
throw new Error("Omaha requires exactly 4 hole cards");
|
|
56783
|
+
}
|
|
56784
|
+
if (communityCards.length !== 5) {
|
|
56785
|
+
throw new Error("Omaha requires exactly 5 community cards");
|
|
56786
|
+
}
|
|
56787
|
+
let bestHand = null;
|
|
56788
|
+
for (const pair of this.getCombinationsFlexible(holeCards, 2)) {
|
|
56789
|
+
for (const triple of this.getCombinationsFlexible(communityCards, 3)) {
|
|
56790
|
+
const evaluation = this.evaluateHand([...pair, ...triple]);
|
|
56791
|
+
if (!bestHand || this.compareHands(evaluation, bestHand) > 0) {
|
|
56792
|
+
bestHand = evaluation;
|
|
56793
|
+
}
|
|
56794
|
+
}
|
|
56795
|
+
}
|
|
56796
|
+
if (!bestHand) {
|
|
56797
|
+
throw new Error("Failed to evaluate hand");
|
|
56798
|
+
}
|
|
56799
|
+
return bestHand;
|
|
56800
|
+
}
|
|
56801
|
+
/**
|
|
56802
|
+
* Best hand for a variant from hole cards and a full 5-card board.
|
|
56803
|
+
*/
|
|
56804
|
+
static bestHandForVariant(variant, holeCards, communityCards) {
|
|
56805
|
+
if (variant === GameVariant.OMAHA) {
|
|
56806
|
+
return this.findBestOmahaHand(holeCards, communityCards);
|
|
56807
|
+
}
|
|
56808
|
+
return this.findBestHand([...holeCards, ...communityCards]);
|
|
56809
|
+
}
|
|
56724
56810
|
/**
|
|
56725
56811
|
* Evaluate a hand with any number of cards (2-7)
|
|
56726
56812
|
* This is useful for showing hand strength during all betting rounds
|
|
@@ -57115,12 +57201,14 @@ class PokerSolver {
|
|
|
57115
57201
|
}
|
|
57116
57202
|
/**
|
|
57117
57203
|
* Calculate win percentages for multiple players (2+) using Monte Carlo simulation
|
|
57118
|
-
* @param hands Array of hole cards for each player (each
|
|
57204
|
+
* @param hands Array of hole cards for each player (2 each for Hold'em, 4 for Omaha)
|
|
57119
57205
|
* @param communityCards Current community cards (0-5 cards)
|
|
57120
57206
|
* @param simulations Number of simulations to run (default: 10000)
|
|
57207
|
+
* @param variant The table's variant; omitted = Texas Hold'em. Omaha hands are
|
|
57208
|
+
* scored with the two-plus-three rule (ui#769).
|
|
57121
57209
|
* @returns Object containing win percentages for each player and overall tie percentage
|
|
57122
57210
|
*/
|
|
57123
|
-
static calculateMultiPlayerEquity(hands, communityCards = [], simulations = 10000) {
|
|
57211
|
+
static calculateMultiPlayerEquity(hands, communityCards = [], simulations = 10000, variant) {
|
|
57124
57212
|
// Validate inputs
|
|
57125
57213
|
if (hands.length < 2) {
|
|
57126
57214
|
throw new Error("Need at least 2 hands to calculate equity");
|
|
@@ -57128,9 +57216,10 @@ class PokerSolver {
|
|
|
57128
57216
|
if (hands.length > 10) {
|
|
57129
57217
|
throw new Error("Maximum 10 hands supported");
|
|
57130
57218
|
}
|
|
57219
|
+
const holeCount = holeCardsPerPlayer(variant);
|
|
57131
57220
|
for (let i = 0; i < hands.length; i++) {
|
|
57132
|
-
if (hands[i].length !==
|
|
57133
|
-
throw new Error(`Hand ${i} must have exactly
|
|
57221
|
+
if (hands[i].length !== holeCount) {
|
|
57222
|
+
throw new Error(`Hand ${i} must have exactly ${holeCount} cards`);
|
|
57134
57223
|
}
|
|
57135
57224
|
}
|
|
57136
57225
|
if (communityCards.length > 5) {
|
|
@@ -57157,10 +57246,7 @@ class PokerSolver {
|
|
|
57157
57246
|
// Deal remaining community cards
|
|
57158
57247
|
const fullCommunityCards = [...communityCards, ...shuffledDeck.slice(0, cardsNeeded)];
|
|
57159
57248
|
// Evaluate all hands
|
|
57160
|
-
const evaluations = hands.map(hand =>
|
|
57161
|
-
const fullHand = [...hand, ...fullCommunityCards];
|
|
57162
|
-
return this.findBestHand(fullHand);
|
|
57163
|
-
});
|
|
57249
|
+
const evaluations = hands.map(hand => this.bestHandForVariant(variant, hand, fullCommunityCards));
|
|
57164
57250
|
// Find winners using existing findWinners method
|
|
57165
57251
|
const winnerIndices = this.findWinners(evaluations);
|
|
57166
57252
|
// Update win counters
|
|
@@ -71023,9 +71109,14 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71023
71109
|
return this.sendTokens(fromAddress, toAddress, amount, undefined, memo);
|
|
71024
71110
|
}
|
|
71025
71111
|
/**
|
|
71026
|
-
* Create a new poker game
|
|
71112
|
+
* Create a new poker game.
|
|
71113
|
+
*
|
|
71114
|
+
* `bettingLimit` is the table's betting structure (block52/pokerchain#407).
|
|
71115
|
+
* Omit it for the variant's default: pot-limit for omaha (PLO), no-limit for
|
|
71116
|
+
* texas-holdem. Omitted, the field is not encoded at all, so a chain without
|
|
71117
|
+
* it accepts the tx unchanged. Fixed-limit is not playable yet (poker-vm#2654).
|
|
71027
71118
|
*/
|
|
71028
|
-
async createGame(gameFormat, gameVariant, minPlayers, maxPlayers, minBuyInB52USDC, maxBuyInB52USDC, smallBlindB52USDC, bigBlindB52USDC, timeout, rakeConfig, sngConfig, name) {
|
|
71119
|
+
async createGame(gameFormat, gameVariant, minPlayers, maxPlayers, minBuyInB52USDC, maxBuyInB52USDC, smallBlindB52USDC, bigBlindB52USDC, timeout, rakeConfig, sngConfig, name, bettingLimit) {
|
|
71029
71120
|
// Validate SNG/Tournament config BEFORE any network work — fail fast.
|
|
71030
71121
|
// SNG/Tournament games are DEFINED by startingStack + blindLevelDuration.
|
|
71031
71122
|
// Refuse to create one with missing/zero values rather than silently
|
|
@@ -71045,6 +71136,7 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71045
71136
|
throw new Error(`${gameFormat} games require a positive blindLevelDuration; got ${sngConfig.blindLevelDuration}.`);
|
|
71046
71137
|
}
|
|
71047
71138
|
}
|
|
71139
|
+
assertCreatableBettingLimit(bettingLimit);
|
|
71048
71140
|
await this.initializeSigningClient();
|
|
71049
71141
|
if (!this.signingClient || !this.wallet) {
|
|
71050
71142
|
throw new Error("Signing client not initialized");
|
|
@@ -71077,6 +71169,9 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71077
71169
|
// Optional ENS-style table name (block52/pokerchain#337). Empty = unnamed
|
|
71078
71170
|
// (no fee); a non-empty name costs $0.10/char and must be globally unique.
|
|
71079
71171
|
name: name ?? "",
|
|
71172
|
+
// Betting structure (block52/pokerchain#407). "" = the variant's default
|
|
71173
|
+
// on chain, and an empty proto3 string is not encoded at all.
|
|
71174
|
+
bettingLimit: bettingLimit ?? "",
|
|
71080
71175
|
});
|
|
71081
71176
|
// Create the transaction message
|
|
71082
71177
|
const msg = {
|
|
@@ -71096,6 +71191,7 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71096
71191
|
smallBlind: smallBlindB52USDC.toString(),
|
|
71097
71192
|
bigBlind: bigBlindB52USDC.toString(),
|
|
71098
71193
|
timeout,
|
|
71194
|
+
...(bettingLimit && { bettingLimit }),
|
|
71099
71195
|
...(rakeConfig && {
|
|
71100
71196
|
rakeFreeThreshold: rakeConfig.rakeFreeThreshold.toString(),
|
|
71101
71197
|
rakePercentage: rakeConfig.rakePercentage,
|
|
@@ -71972,6 +72068,21 @@ async function createSigningClientFromMnemonic(config, mnemonic) {
|
|
|
71972
72068
|
});
|
|
71973
72069
|
return createSigningCosmosClient(config, wallet);
|
|
71974
72070
|
}
|
|
72071
|
+
/**
|
|
72072
|
+
* Throws for a betting limit a table cannot be created with (block52/pokerchain#407).
|
|
72073
|
+
* Undefined is allowed: the chain applies the variant's default.
|
|
72074
|
+
*/
|
|
72075
|
+
function assertCreatableBettingLimit(bettingLimit) {
|
|
72076
|
+
if (bettingLimit === undefined) {
|
|
72077
|
+
return;
|
|
72078
|
+
}
|
|
72079
|
+
if (bettingLimit === BettingLimit.FIXED_LIMIT) {
|
|
72080
|
+
throw new Error("Fixed-limit tables are not available yet (poker-vm#2654).");
|
|
72081
|
+
}
|
|
72082
|
+
if (bettingLimit !== BettingLimit.NO_LIMIT && bettingLimit !== BettingLimit.POT_LIMIT) {
|
|
72083
|
+
throw new Error(`Invalid betting limit: ${bettingLimit}.`);
|
|
72084
|
+
}
|
|
72085
|
+
}
|
|
71975
72086
|
|
|
71976
72087
|
// Generated by Ignite ignite.com/cli
|
|
71977
72088
|
const Client = IgniteClient.plugin([
|
|
@@ -72011,5 +72122,5 @@ const registry = new Registry([
|
|
|
72011
72122
|
...msgTypes,
|
|
72012
72123
|
]);
|
|
72013
72124
|
|
|
72014
|
-
export { AllPlayerActions, BLOCK52_HD_PATH, 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, assertExecuted, buildMsgCreateValidator, computeGameNameFee, createSigningClientFromMnemonic, createWalletFromMnemonic, decToAtomics, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry, toValoperAddress, txFailureHash, txFailurePhase };
|
|
72125
|
+
export { AllPlayerActions, 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, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getBettingLimit, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, holeCardsPerPlayer, isCashFormat, isEmptyAddress, isPotLimit, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry, toValoperAddress, txFailureHash, txFailurePhase };
|
|
72015
72126
|
//# sourceMappingURL=index.esm.js.map
|