@block52/poker-vm-sdk 1.12.1 → 1.15.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 +36 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +85 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +86 -6
- package/dist/index.js.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 +6 -3
- 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
|
*/
|
|
@@ -46823,6 +46852,7 @@ interface SNGConfig {
|
|
|
46823
46852
|
entryFee?: bigint;
|
|
46824
46853
|
startTime?: number;
|
|
46825
46854
|
blindStructure?: BlindStructureDTO;
|
|
46855
|
+
lateRegistrationLevels?: number;
|
|
46826
46856
|
}
|
|
46827
46857
|
/**
|
|
46828
46858
|
* Signing Cosmos Client that extends the read-only CosmosClient with transaction capabilities
|
|
@@ -46865,7 +46895,8 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
46865
46895
|
* `bettingLimit` is the table's betting structure (block52/pokerchain#407).
|
|
46866
46896
|
* Omit it for the variant's default: pot-limit for omaha (PLO), no-limit for
|
|
46867
46897
|
* texas-holdem. Omitted, the field is not encoded at all, so a chain without
|
|
46868
|
-
* it accepts the tx unchanged. Fixed-limit is
|
|
46898
|
+
* it accepts the tx unchanged. Fixed-limit is texas-holdem only (poker-vm#2654,
|
|
46899
|
+
* block52/pokerchain#439).
|
|
46869
46900
|
*/
|
|
46870
46901
|
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>;
|
|
46871
46902
|
/**
|
|
@@ -47112,9 +47143,10 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
47112
47143
|
declare function createSigningClientFromMnemonic(config: CosmosConfig, mnemonic: string): Promise<SigningCosmosClient>;
|
|
47113
47144
|
/**
|
|
47114
47145
|
* Throws for a betting limit a table cannot be created with (block52/pokerchain#407).
|
|
47115
|
-
* Undefined is allowed: the chain applies the variant's default.
|
|
47146
|
+
* Undefined is allowed: the chain applies the variant's default. Fixed-limit is
|
|
47147
|
+
* texas-holdem only, as the chain decides (block52/pokerchain#439, poker-vm#2654).
|
|
47116
47148
|
*/
|
|
47117
|
-
declare function assertCreatableBettingLimit(bettingLimit
|
|
47149
|
+
declare function assertCreatableBettingLimit(bettingLimit: BettingLimit | undefined, gameVariant: string): void;
|
|
47118
47150
|
|
|
47119
47151
|
/**
|
|
47120
47152
|
* The part of a broadcast result this module reads. Structurally a subset of
|
|
@@ -47430,5 +47462,5 @@ declare const Client: typeof IgniteClient & Constructor<{
|
|
|
47430
47462
|
}>;
|
|
47431
47463
|
declare const registry: Registry;
|
|
47432
47464
|
|
|
47433
|
-
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 };
|
|
47465
|
+
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 };
|
|
47434
47466
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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|
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
|
*/
|
|
@@ -71614,6 +71676,15 @@ function assertCreatableSngField(minPlayers, maxPlayers, sngConfig, nowSeconds =
|
|
|
71614
71676
|
if (startTime !== undefined && startTime <= nowSeconds) {
|
|
71615
71677
|
throw new Error(`sngConfig.startTime ${startTime} must be in the future (now ${nowSeconds}).`);
|
|
71616
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
|
+
}
|
|
71617
71688
|
}
|
|
71618
71689
|
/**
|
|
71619
71690
|
* Signing Cosmos Client that extends the read-only CosmosClient with transaction capabilities
|
|
@@ -71725,7 +71796,8 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71725
71796
|
* `bettingLimit` is the table's betting structure (block52/pokerchain#407).
|
|
71726
71797
|
* Omit it for the variant's default: pot-limit for omaha (PLO), no-limit for
|
|
71727
71798
|
* texas-holdem. Omitted, the field is not encoded at all, so a chain without
|
|
71728
|
-
* it accepts the tx unchanged. Fixed-limit is
|
|
71799
|
+
* it accepts the tx unchanged. Fixed-limit is texas-holdem only (poker-vm#2654,
|
|
71800
|
+
* block52/pokerchain#439).
|
|
71729
71801
|
*/
|
|
71730
71802
|
async createGame(gameFormat, gameVariant, minPlayers, maxPlayers, minBuyInB52USDC, maxBuyInB52USDC, smallBlindB52USDC, bigBlindB52USDC, timeout, rakeConfig, sngConfig, name, bettingLimit) {
|
|
71731
71803
|
// Validate SNG/Tournament config BEFORE any network work — fail fast.
|
|
@@ -71748,7 +71820,7 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71748
71820
|
}
|
|
71749
71821
|
assertCreatableSngField(minPlayers, maxPlayers, sngConfig);
|
|
71750
71822
|
}
|
|
71751
|
-
assertCreatableBettingLimit(bettingLimit);
|
|
71823
|
+
assertCreatableBettingLimit(bettingLimit, gameVariant);
|
|
71752
71824
|
await this.initializeSigningClient();
|
|
71753
71825
|
if (!this.signingClient || !this.wallet) {
|
|
71754
71826
|
throw new Error("Signing client not initialized");
|
|
@@ -71790,6 +71862,7 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71790
71862
|
// Blind structure (block52/pokerchain#434) as JSON; "" = doubling, and
|
|
71791
71863
|
// an empty proto3 string is not encoded at all.
|
|
71792
71864
|
blindStructure: sngConfig?.blindStructure ? JSON.stringify(sngConfig.blindStructure) : "",
|
|
71865
|
+
lateRegistrationLevels: sngConfig?.lateRegistrationLevels ?? 0,
|
|
71793
71866
|
});
|
|
71794
71867
|
// Create the transaction message
|
|
71795
71868
|
const msg = {
|
|
@@ -71820,7 +71893,8 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
71820
71893
|
startingStack: sngConfig.startingStack.toString(),
|
|
71821
71894
|
blindLevelDuration: sngConfig.blindLevelDuration,
|
|
71822
71895
|
entryFee: sngConfig.entryFee?.toString() ?? "0",
|
|
71823
|
-
...(sngConfig.blindStructure && { blindStructure: sngConfig.blindStructure })
|
|
71896
|
+
...(sngConfig.blindStructure && { blindStructure: sngConfig.blindStructure }),
|
|
71897
|
+
...(sngConfig.lateRegistrationLevels && { lateRegistrationLevels: sngConfig.lateRegistrationLevels })
|
|
71824
71898
|
})
|
|
71825
71899
|
});
|
|
71826
71900
|
try {
|
|
@@ -72689,14 +72763,18 @@ async function createSigningClientFromMnemonic(config, mnemonic) {
|
|
|
72689
72763
|
}
|
|
72690
72764
|
/**
|
|
72691
72765
|
* Throws for a betting limit a table cannot be created with (block52/pokerchain#407).
|
|
72692
|
-
* Undefined is allowed: the chain applies the variant's default.
|
|
72766
|
+
* Undefined is allowed: the chain applies the variant's default. Fixed-limit is
|
|
72767
|
+
* texas-holdem only, as the chain decides (block52/pokerchain#439, poker-vm#2654).
|
|
72693
72768
|
*/
|
|
72694
|
-
function assertCreatableBettingLimit(bettingLimit) {
|
|
72769
|
+
function assertCreatableBettingLimit(bettingLimit, gameVariant) {
|
|
72695
72770
|
if (bettingLimit === undefined) {
|
|
72696
72771
|
return;
|
|
72697
72772
|
}
|
|
72698
72773
|
if (bettingLimit === BettingLimit.FIXED_LIMIT) {
|
|
72699
|
-
|
|
72774
|
+
if (gameVariant !== GameVariant.TEXAS_HOLDEM) {
|
|
72775
|
+
throw new Error(`Betting limit fixed-limit is only available for texas-holdem; got ${gameVariant}.`);
|
|
72776
|
+
}
|
|
72777
|
+
return;
|
|
72700
72778
|
}
|
|
72701
72779
|
if (bettingLimit !== BettingLimit.NO_LIMIT && bettingLimit !== BettingLimit.POT_LIMIT) {
|
|
72702
72780
|
throw new Error(`Invalid betting limit: ${bettingLimit}.`);
|
|
@@ -72741,5 +72819,5 @@ const registry = new Registry([
|
|
|
72741
72819
|
...msgTypes,
|
|
72742
72820
|
]);
|
|
72743
72821
|
|
|
72744
|
-
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 };
|
|
72822
|
+
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 };
|
|
72745
72823
|
//# sourceMappingURL=index.esm.js.map
|