@block52/poker-vm-sdk 1.15.0 → 1.16.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 CHANGED
@@ -45432,12 +45432,20 @@ type AlgorithmicBlindStructureBase = {
45432
45432
  maxLevel?: number;
45433
45433
  ante?: AnteRuleDTO;
45434
45434
  };
45435
+ /**
45436
+ * Rounds every level after the first up to two significant figures once its big
45437
+ * blind reaches 1,000 (640/1,280 → 650/1,300), with sb = bb / 2. Each level
45438
+ * rounds its own exact value. Omitted = exact blinds. (poker-vm#2738)
45439
+ */
45440
+ type RoundBlindsOption = {
45441
+ roundBlinds?: boolean;
45442
+ };
45435
45443
  /** sb_n = startSmallBlind × 2^n — bit-identical to the doubling a structure-less sit-and-go runs. */
45436
- type DoubleBlindStructureDTO = AlgorithmicBlindStructureBase & {
45444
+ type DoubleBlindStructureDTO = AlgorithmicBlindStructureBase & RoundBlindsOption & {
45437
45445
  progression: "double";
45438
45446
  };
45439
45447
  /** sb_n = startSmallBlind + step × n. */
45440
- type LinearBlindStructureDTO = AlgorithmicBlindStructureBase & {
45448
+ type LinearBlindStructureDTO = AlgorithmicBlindStructureBase & RoundBlindsOption & {
45441
45449
  progression: "linear";
45442
45450
  step: string;
45443
45451
  };
@@ -46185,6 +46193,12 @@ declare function formatBlindStructure(structure: BlindStructureDTO, name?: strin
46185
46193
  declare const BLIND_PRESET_STRUCTURES: Readonly<Record<BlindPreset, Exclude<BlindStructureDTO, BlindStructurePresetDTO>>>;
46186
46194
  /** Replaces a preset with its concrete structure (a deep copy); anything else is returned as is. */
46187
46195
  declare function resolveBlindPreset(structure: BlindStructureDTO): Exclude<BlindStructureDTO, BlindStructurePresetDTO>;
46196
+ /**
46197
+ * The engine's roundBlind (poker-vm#2738): a big blind of 1,000 or more rounded
46198
+ * up to two significant figures (1,280 → 1,300; 10,240 → 11,000). The unit is
46199
+ * then at least 100, so the result stays even. Below 1,000 it is returned as is.
46200
+ */
46201
+ declare function roundBlind(bigBlind: bigint): bigint;
46188
46202
  /**
46189
46203
  * Level n (0-based) of a structure, exactly as the engine expands it: the cap
46190
46204
  * (`maxLevel`) freezes the blinds while the level number keeps counting; a
@@ -47462,5 +47476,5 @@ declare const Client: typeof IgniteClient & Constructor<{
47462
47476
  }>;
47463
47477
  declare const registry: Registry;
47464
47478
 
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 };
47479
+ 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, roundBlind, toValoperAddress, txFailureHash, txFailurePhase };
47466
47480
  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.esm.js CHANGED
@@ -56650,7 +56650,8 @@ const isValidPlayerAddress = (address) => {
56650
56650
  * start: 25/50
56651
56651
  * duration: 5m
56652
56652
  * progression: double | linear 25 | percentage 1.5
56653
- * round: 25 percentage only (the engine's roundTo)
56653
+ * round: 25 percentage: the engine's roundTo
56654
+ * round: blinds double / linear: round levels of 1,000+ (roundBlinds)
56654
56655
  * ante: bb | bb * 0.1 | level >= 4 ? bb * 0.1 : 0
56655
56656
  * cap: 15
56656
56657
  * }
@@ -56866,6 +56867,15 @@ function parseTable(body) {
56866
56867
  out.maxLevel = parseInteger("cap", body.fields.get("cap").join(" "));
56867
56868
  return out;
56868
56869
  }
56870
+ /** `round: blinds` on double / linear turns on roundBlinds (poker-vm#2738); no other value is accepted there. */
56871
+ function parseRoundBlinds(f) {
56872
+ if (!f.has("round"))
56873
+ return {};
56874
+ const value = f.get("round").join(" ");
56875
+ if (value !== "blinds")
56876
+ fail(`double and linear take "round: blinds" (round levels of 1,000+), got "round: ${value}"`);
56877
+ return { roundBlinds: true };
56878
+ }
56869
56879
  function parseAlgorithmic(body) {
56870
56880
  const f = body.fields;
56871
56881
  for (const key of f.keys()) {
@@ -56894,16 +56904,16 @@ function parseAlgorithmic(body) {
56894
56904
  const [kind, ...rest] = f.get("progression");
56895
56905
  switch (kind) {
56896
56906
  case "double":
56897
- if (rest.length !== 0 || f.has("round"))
56898
- fail("double takes no argument and no round");
56899
- return { progression: "double", ...base };
56907
+ if (rest.length !== 0)
56908
+ fail("double takes no argument");
56909
+ return { progression: "double", ...base, ...parseRoundBlinds(f) };
56900
56910
  case "linear": {
56901
- if (rest.length !== 1 || f.has("round"))
56902
- fail('linear needs one step, e.g. "linear 25", and no round');
56911
+ if (rest.length !== 1)
56912
+ fail('linear needs one step, e.g. "linear 25"');
56903
56913
  const step = parseAmount("linear step", rest[0]);
56904
56914
  if (BigInt(step) <= 0n)
56905
56915
  fail("linear step must be positive");
56906
- return { progression: "linear", ...base, step };
56916
+ return { progression: "linear", ...base, step, ...parseRoundBlinds(f) };
56907
56917
  }
56908
56918
  case "percentage": {
56909
56919
  if (rest.length !== 1)
@@ -56976,9 +56986,13 @@ function formatBlindStructure(structure, name = "custom") {
56976
56986
  switch (structure.progression) {
56977
56987
  case "double":
56978
56988
  lines.push(" progression: double");
56989
+ if (structure.roundBlinds)
56990
+ lines.push(" round: blinds");
56979
56991
  break;
56980
56992
  case "linear":
56981
56993
  lines.push(` progression: linear ${structure.step}`);
56994
+ if (structure.roundBlinds)
56995
+ lines.push(" round: blinds");
56982
56996
  break;
56983
56997
  case "percentage":
56984
56998
  lines.push(` progression: percentage ${formatBps(structure.factorBps)}`);
@@ -57005,8 +57019,8 @@ function formatBlindStructure(structure, name = "custom") {
57005
57019
  * levels can be previewed before the table exists.
57006
57020
  */
57007
57021
  const BLIND_PRESET_STRUCTURES = {
57008
- turbo: { progression: "double", startSmallBlind: "25", startBigBlind: "50", durationMinutes: 5, ante: { startLevel: 4, bps: 1000 } },
57009
- standard: { progression: "double", startSmallBlind: "25", startBigBlind: "50", durationMinutes: 10, ante: { startLevel: 5, bps: 1000 } },
57022
+ turbo: { progression: "double", startSmallBlind: "25", startBigBlind: "50", durationMinutes: 5, roundBlinds: true, ante: { startLevel: 4, bps: 1000 } },
57023
+ standard: { progression: "double", startSmallBlind: "25", startBigBlind: "50", durationMinutes: 10, roundBlinds: true, ante: { startLevel: 5, bps: 1000 } },
57010
57024
  deep_stack: {
57011
57025
  progression: "percentage",
57012
57026
  startSmallBlind: "25",
@@ -57016,7 +57030,7 @@ const BLIND_PRESET_STRUCTURES = {
57016
57030
  durationMinutes: 15,
57017
57031
  ante: { startLevel: 6, bps: 1250 }
57018
57032
  },
57019
- hyper_turbo: { progression: "double", startSmallBlind: "50", startBigBlind: "100", durationMinutes: 3, ante: { startLevel: 3, bps: 1000 } }
57033
+ hyper_turbo: { progression: "double", startSmallBlind: "50", startBigBlind: "100", durationMinutes: 3, roundBlinds: true, ante: { startLevel: 3, bps: 1000 } }
57020
57034
  };
57021
57035
  /** Replaces a preset with its concrete structure (a deep copy); anything else is returned as is. */
57022
57036
  function resolveBlindPreset(structure) {
@@ -57027,6 +57041,17 @@ function resolveBlindPreset(structure) {
57027
57041
  fail(`"${structure.preset}" is not a preset (${BLIND_PRESETS.join(", ")})`);
57028
57042
  return JSON.parse(JSON.stringify(preset));
57029
57043
  }
57044
+ /**
57045
+ * The engine's roundBlind (poker-vm#2738): a big blind of 1,000 or more rounded
57046
+ * up to two significant figures (1,280 → 1,300; 10,240 → 11,000). The unit is
57047
+ * then at least 100, so the result stays even. Below 1,000 it is returned as is.
57048
+ */
57049
+ function roundBlind(bigBlind) {
57050
+ if (bigBlind < 1000n)
57051
+ return bigBlind;
57052
+ const unit = 10n ** BigInt(bigBlind.toString().length - 2);
57053
+ return ((bigBlind + unit - 1n) / unit) * unit;
57054
+ }
57030
57055
  function algorithmicSmallBlind(structure, n) {
57031
57056
  const sb0 = BigInt(structure.startSmallBlind);
57032
57057
  switch (structure.progression) {
@@ -57075,8 +57100,13 @@ function expandBlindLevel(structure, n) {
57075
57100
  row.durationMinutes = n >= rows.length ? rows[rows.length - 1].durationMinutes : rows[n].durationMinutes;
57076
57101
  return row;
57077
57102
  }
57078
- const sb = algorithmicSmallBlind(structure, m);
57079
- const bb = sb * 2n;
57103
+ let sb = algorithmicSmallBlind(structure, m);
57104
+ let bb = sb * 2n;
57105
+ // Level 0 is the creator's opening blinds and is never rounded.
57106
+ if (structure.progression !== "percentage" && structure.roundBlinds && m > 0) {
57107
+ bb = roundBlind(bb);
57108
+ sb = bb / 2n;
57109
+ }
57080
57110
  let ante = 0n;
57081
57111
  if (structure.ante && n >= structure.ante.startLevel)
57082
57112
  ante = (bb * BigInt(structure.ante.bps)) / BPS;
@@ -72819,5 +72849,5 @@ const registry = new Registry([
72819
72849
  ...msgTypes,
72820
72850
  ]);
72821
72851
 
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 };
72852
+ 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, roundBlind, toValoperAddress, txFailureHash, txFailurePhase };
72823
72853
  //# sourceMappingURL=index.esm.js.map