@block52/poker-vm-sdk 1.17.0 → 1.19.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/IClient.d.ts +2 -1
- package/dist/IClient.d.ts.map +1 -1
- package/dist/cosmosClient.d.ts +12 -1
- package/dist/cosmosClient.d.ts.map +1 -1
- package/dist/index.d.ts +72 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +140 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +142 -6
- package/dist/index.js.map +1 -1
- package/dist/types/game.d.ts +50 -0
- package/dist/types/game.d.ts.map +1 -1
- package/dist/types/rest.d.ts +8 -0
- package/dist/types/rest.d.ts.map +1 -1
- package/dist/utils/tournamentLeaderboard.d.ts +9 -0
- package/dist/utils/tournamentLeaderboard.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/IClient.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Coin } from "./sdkTypes";
|
|
2
2
|
import type { AccountQueryResponse, GetTxResponse, WithdrawalRequestResponse } from "./types/rest";
|
|
3
|
-
import type { LegalActionDTO, GameOptionsResponse, GameListItem, BlockResponse, GameStateResponse } from "./types/game";
|
|
3
|
+
import type { LegalActionDTO, GameOptionsResponse, GameListItem, BlockResponse, GameStateResponse, LeaderboardDTO } from "./types/game";
|
|
4
4
|
export interface IClient {
|
|
5
5
|
getAccount(address: string): Promise<AccountQueryResponse>;
|
|
6
6
|
getAllBalances(address: string): Promise<Coin[]>;
|
|
@@ -28,6 +28,7 @@ export interface IClient {
|
|
|
28
28
|
createGame(gameFormat: string, gameVariant: string, minPlayers: number, maxPlayers: number, minBuyInB52USDC: bigint, maxBuyInB52USDC: bigint, smallBlindB52USDC: bigint, bigBlindB52USDC: bigint, timeout: number): Promise<string>;
|
|
29
29
|
initiateWithdrawal(baseAddress: string, amount: bigint): Promise<string>;
|
|
30
30
|
listWithdrawalRequests(cosmosAddress?: string): Promise<WithdrawalRequestResponse[]>;
|
|
31
|
+
getTournamentLeaderboard(tournamentId: string): Promise<LeaderboardDTO | null>;
|
|
31
32
|
disconnect(): Promise<void>;
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=IClient.d.ts.map
|
package/dist/IClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IClient.d.ts","sourceRoot":"","sources":["../src/IClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"IClient.d.ts","sourceRoot":"","sources":["../src/IClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExI,MAAM,WAAW,OAAO;IACpB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC3D,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,MAAM,EAAE,MAAM,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CAAC,CAAC;IACnG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,UAAU,CACN,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,EACvB,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzE,sBAAsB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAC;IACrF,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/E,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B"}
|
package/dist/cosmosClient.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EquityResult, EquityResponse, CosmosConfig, Coin } from "./sdkTypes";
|
|
2
2
|
import type { AccountQueryResponse, GetTxResponse, WithdrawalRequestResponse } from "./types/rest";
|
|
3
3
|
import { IClient } from "./IClient";
|
|
4
|
-
import type { LegalActionDTO, GameOptionsResponse, GameListItem, BlockResponse, GameStateResponse } from "./types/game";
|
|
4
|
+
import type { LegalActionDTO, GameOptionsResponse, GameListItem, BlockResponse, GameStateResponse, LeaderboardDTO } from "./types/game";
|
|
5
5
|
export declare class CosmosClient implements IClient {
|
|
6
6
|
protected readonly config: CosmosConfig;
|
|
7
7
|
private readonly restClient;
|
|
@@ -99,6 +99,17 @@ export declare class CosmosClient implements IClient {
|
|
|
99
99
|
* List withdrawal requests via REST API
|
|
100
100
|
*/
|
|
101
101
|
listWithdrawalRequests(cosmosAddress?: string): Promise<WithdrawalRequestResponse[]>;
|
|
102
|
+
/**
|
|
103
|
+
* A multi-table tournament's live standings (block52/pokerchain#405,
|
|
104
|
+
* poker-vm#2613), ranked by the engine: the chain runs engine.Leaderboard
|
|
105
|
+
* over the stored tournament state and serves the LeaderboardDTO verbatim.
|
|
106
|
+
* Unauthenticated: standings are public.
|
|
107
|
+
*
|
|
108
|
+
* @returns the board, or null when the chain has no tournament with this ID
|
|
109
|
+
* (gRPC NotFound, HTTP 404). Any other failure — including an empty or
|
|
110
|
+
* malformed leaderboard — throws.
|
|
111
|
+
*/
|
|
112
|
+
getTournamentLeaderboard(tournamentId: string): Promise<LeaderboardDTO | null>;
|
|
102
113
|
/**
|
|
103
114
|
* Calculate equity for multiple hands using Monte Carlo simulation
|
|
104
115
|
* Used when players are all-in and showing to display win percentages
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmosClient.d.ts","sourceRoot":"","sources":["../src/cosmosClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"cosmosClient.d.ts","sourceRoot":"","sources":["../src/cosmosClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,YAAY,EAAE,cAAc,EAAE,YA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,MAAoB,KAAG,YAOpE,CAAC;AAGH,OAAO,EACH,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACtB,MAAM,YAAY,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -45268,6 +45268,7 @@ declare enum NonPlayerActionType {
|
|
|
45268
45268
|
LEAVE = "leave",
|
|
45269
45269
|
NEW_HAND = "new-hand",
|
|
45270
45270
|
POST = "post",
|
|
45271
|
+
POST_DEAD = "post-dead",
|
|
45271
45272
|
SIT_IN = "sit-in",
|
|
45272
45273
|
SIT_IN_AND_WAIT = "sit-in-and-wait",
|
|
45273
45274
|
SIT_OUT = "sit-out",
|
|
@@ -45287,6 +45288,7 @@ declare const AllPlayerActions: {
|
|
|
45287
45288
|
LEAVE: NonPlayerActionType.LEAVE;
|
|
45288
45289
|
NEW_HAND: NonPlayerActionType.NEW_HAND;
|
|
45289
45290
|
POST: NonPlayerActionType.POST;
|
|
45291
|
+
POST_DEAD: NonPlayerActionType.POST_DEAD;
|
|
45290
45292
|
SIT_IN: NonPlayerActionType.SIT_IN;
|
|
45291
45293
|
SIT_IN_AND_WAIT: NonPlayerActionType.SIT_IN_AND_WAIT;
|
|
45292
45294
|
SIT_OUT: NonPlayerActionType.SIT_OUT;
|
|
@@ -45587,7 +45589,11 @@ type PlayerDTO = {
|
|
|
45587
45589
|
sitInMethod?: SitInMethod;
|
|
45588
45590
|
pendingSitOut?: string;
|
|
45589
45591
|
pendingTopUpAmount?: string;
|
|
45592
|
+
missedSmallBlind?: boolean;
|
|
45593
|
+
missedBigBlind?: boolean;
|
|
45590
45594
|
timeBankRemainingMs?: number;
|
|
45595
|
+
timeBankUses?: number;
|
|
45596
|
+
timeBankLastGrantMs?: number;
|
|
45591
45597
|
signature: string;
|
|
45592
45598
|
};
|
|
45593
45599
|
type ResultDTO = {
|
|
@@ -45604,6 +45610,50 @@ type PayoutPlaceDTO = {
|
|
|
45604
45610
|
place: number;
|
|
45605
45611
|
amount: string;
|
|
45606
45612
|
};
|
|
45613
|
+
/**
|
|
45614
|
+
* Multi-table tournament standings (poker-vm#2613, block52/pokerchain#405).
|
|
45615
|
+
* Mirrors pvm/go/engine/tournament.go and tournament_leaderboard.go field for
|
|
45616
|
+
* field: the chain's TournamentLeaderboard query serves the engine's
|
|
45617
|
+
* LeaderboardDTO as JSON verbatim, so these are the wire shapes. Optional
|
|
45618
|
+
* fields are the Go `omitempty` ones.
|
|
45619
|
+
*/
|
|
45620
|
+
type TournamentStatus = "registering" | "running" | "finished" | "cancelled";
|
|
45621
|
+
declare const TOURNAMENT_STATUSES: readonly TournamentStatus[];
|
|
45622
|
+
/** An entrant's status in a tournament (engine Entrant* constants). */
|
|
45623
|
+
type TournamentEntrantStatus = "registered" | "playing" | "busted" | "unregistered";
|
|
45624
|
+
declare const TOURNAMENT_ENTRANT_STATUSES: readonly TournamentEntrantStatus[];
|
|
45625
|
+
/** The current blind level of a running tournament. Amounts are chip strings. */
|
|
45626
|
+
type TournamentClockDTO = {
|
|
45627
|
+
level: number;
|
|
45628
|
+
smallBlind: string;
|
|
45629
|
+
bigBlind: string;
|
|
45630
|
+
ante: string;
|
|
45631
|
+
levelStartTime?: number;
|
|
45632
|
+
};
|
|
45633
|
+
/** One entrant's line on the leaderboard. */
|
|
45634
|
+
type LeaderboardEntryDTO = {
|
|
45635
|
+
rank: number;
|
|
45636
|
+
address: string;
|
|
45637
|
+
status: TournamentEntrantStatus;
|
|
45638
|
+
stack: string;
|
|
45639
|
+
tableId?: string;
|
|
45640
|
+
seat?: number;
|
|
45641
|
+
place?: number;
|
|
45642
|
+
payout?: string;
|
|
45643
|
+
};
|
|
45644
|
+
/** A tournament's standings, ranked by the engine (engine.Leaderboard). */
|
|
45645
|
+
type LeaderboardDTO = {
|
|
45646
|
+
tournamentId: string;
|
|
45647
|
+
status: TournamentStatus;
|
|
45648
|
+
entrants: number;
|
|
45649
|
+
remaining: number;
|
|
45650
|
+
averageStack: string;
|
|
45651
|
+
prizePool: string;
|
|
45652
|
+
payouts: PayoutPlaceDTO[];
|
|
45653
|
+
clock?: TournamentClockDTO;
|
|
45654
|
+
nextLevelAt?: number;
|
|
45655
|
+
entries: LeaderboardEntryDTO[];
|
|
45656
|
+
};
|
|
45607
45657
|
/**
|
|
45608
45658
|
* The reveal a sealed hand is stopped on (poker-vm#2695): "board" = the next
|
|
45609
45659
|
* street is due from the dealer, "deal" = the deck is due at showdown, "" =
|
|
@@ -46223,6 +46273,14 @@ declare function lateRegistrationClosesAt(options: GameOptionsDTO): number | und
|
|
|
46223
46273
|
* lateRegistrationClosesAt, or once any result carries a payout. */
|
|
46224
46274
|
declare function isLateRegistrationOpen(options: GameOptionsDTO, results: ResultDTO[], nowMs: number): boolean;
|
|
46225
46275
|
|
|
46276
|
+
/**
|
|
46277
|
+
* Parses the `leaderboard` JSON string of the chain's TournamentLeaderboard
|
|
46278
|
+
* query (block52/pokerchain#405, poker-vm#2613) into a LeaderboardDTO. Checks
|
|
46279
|
+
* the required fields and throws on anything missing or mistyped — never fills
|
|
46280
|
+
* a default (Commandment 7): a malformed board is a chain/engine bug to surface.
|
|
46281
|
+
*/
|
|
46282
|
+
declare function parseLeaderboardDTO(json: string): LeaderboardDTO;
|
|
46283
|
+
|
|
46226
46284
|
/**
|
|
46227
46285
|
* Poker hand types in order of strength (weakest to strongest)
|
|
46228
46286
|
*/
|
|
@@ -46776,6 +46834,7 @@ interface IClient {
|
|
|
46776
46834
|
createGame(gameFormat: string, gameVariant: string, minPlayers: number, maxPlayers: number, minBuyInB52USDC: bigint, maxBuyInB52USDC: bigint, smallBlindB52USDC: bigint, bigBlindB52USDC: bigint, timeout: number): Promise<string>;
|
|
46777
46835
|
initiateWithdrawal(baseAddress: string, amount: bigint): Promise<string>;
|
|
46778
46836
|
listWithdrawalRequests(cosmosAddress?: string): Promise<WithdrawalRequestResponse[]>;
|
|
46837
|
+
getTournamentLeaderboard(tournamentId: string): Promise<LeaderboardDTO | null>;
|
|
46779
46838
|
disconnect(): Promise<void>;
|
|
46780
46839
|
}
|
|
46781
46840
|
|
|
@@ -46876,6 +46935,17 @@ declare class CosmosClient implements IClient {
|
|
|
46876
46935
|
* List withdrawal requests via REST API
|
|
46877
46936
|
*/
|
|
46878
46937
|
listWithdrawalRequests(cosmosAddress?: string): Promise<WithdrawalRequestResponse[]>;
|
|
46938
|
+
/**
|
|
46939
|
+
* A multi-table tournament's live standings (block52/pokerchain#405,
|
|
46940
|
+
* poker-vm#2613), ranked by the engine: the chain runs engine.Leaderboard
|
|
46941
|
+
* over the stored tournament state and serves the LeaderboardDTO verbatim.
|
|
46942
|
+
* Unauthenticated: standings are public.
|
|
46943
|
+
*
|
|
46944
|
+
* @returns the board, or null when the chain has no tournament with this ID
|
|
46945
|
+
* (gRPC NotFound, HTTP 404). Any other failure — including an empty or
|
|
46946
|
+
* malformed leaderboard — throws.
|
|
46947
|
+
*/
|
|
46948
|
+
getTournamentLeaderboard(tournamentId: string): Promise<LeaderboardDTO | null>;
|
|
46879
46949
|
/**
|
|
46880
46950
|
* Calculate equity for multiple hands using Monte Carlo simulation
|
|
46881
46951
|
* Used when players are all-in and showing to display win percentages
|
|
@@ -47567,5 +47637,5 @@ declare const Client: typeof IgniteClient & Constructor<{
|
|
|
47567
47637
|
}>;
|
|
47568
47638
|
declare const registry: Registry;
|
|
47569
47639
|
|
|
47570
|
-
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 };
|
|
47571
|
-
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 };
|
|
47640
|
+
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, TOURNAMENT_ENTRANT_STATUSES, TOURNAMENT_STATUSES, 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, parseLeaderboardDTO, registry, resolveBlindPreset, roundBlind, toValoperAddress, txFailureHash, txFailurePhase };
|
|
47641
|
+
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, LeaderboardDTO, LeaderboardEntryDTO, LegalActionDTO, LinearBlindStructureDTO, PayoutPlaceDTO, PercentageBlindStructureDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, SealedAwaiting, SealedDTO, SitInMethod, SitOutMethod, TableBlindStructureDTO, TexasHoldemGameState, TexasHoldemStateDTO, TournamentClockDTO, TournamentEntrantStatus, TournamentStatus, 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;AA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AA+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
|
@@ -56134,6 +56134,9 @@ var NonPlayerActionType;
|
|
|
56134
56134
|
// player's bet (they're matched) but excluded from the first-to-act /
|
|
56135
56135
|
// has-acted scans (it's a non-player action, like DEAD_SMALL_BLIND).
|
|
56136
56136
|
NonPlayerActionType["POST"] = "post";
|
|
56137
|
+
// A missed small blind posted dead on sitting back in (poker-vm#2200).
|
|
56138
|
+
// Recorded in ANTE; in the pot but not a bet anyone must match (like ANTE).
|
|
56139
|
+
NonPlayerActionType["POST_DEAD"] = "post-dead";
|
|
56137
56140
|
NonPlayerActionType["SIT_IN"] = "sit-in";
|
|
56138
56141
|
// Sit in and wait for the big blind — distinct action from SIT_IN (post now)
|
|
56139
56142
|
// so each has a single responsibility. Sets WAITING_FOR_BIG_BLIND. (#2139)
|
|
@@ -56147,12 +56150,13 @@ var NonPlayerActionType;
|
|
|
56147
56150
|
// SHOW at showdown — and records THAT action; no "timeout" turn is ever
|
|
56148
56151
|
// written to previousActions. Rejected while the turn has time remaining.
|
|
56149
56152
|
NonPlayerActionType["TIMEOUT"] = "timeout";
|
|
56150
|
-
// Time bank (ui#19): the player to act extends their turn's action-clock
|
|
56151
|
-
// deadline by
|
|
56152
|
-
//
|
|
56153
|
-
// Records a no-chip turn that does NOT advance the
|
|
56154
|
-
// clock anchor; the deadline
|
|
56155
|
-
// current turn. Rejected off-turn,
|
|
56153
|
+
// Time bank (ui#19/#20): the player to act extends their turn's action-clock
|
|
56154
|
+
// deadline by their whole bank, once per decision: gameOptions.timeBankMs
|
|
56155
|
+
// the first time, 30s the second, then 5s refilling 5s per orbit up to
|
|
56156
|
+
// gameOptions.timeBankCapMs. Records a no-chip turn that does NOT advance the
|
|
56157
|
+
// betting order or move the clock anchor; the deadline adds the user's
|
|
56158
|
+
// PlayerDTO.timeBankLastGrantMs for the current turn. Rejected off-turn,
|
|
56159
|
+
// past the deadline, or with no bank left.
|
|
56156
56160
|
NonPlayerActionType["TIME_BANK"] = "time-bank";
|
|
56157
56161
|
NonPlayerActionType["TOP_UP"] = "top-up";
|
|
56158
56162
|
// Scheduled single-table tournament (poker-vm#2680): any registered player
|
|
@@ -56243,6 +56247,8 @@ const BLIND_PRESETS = ["turbo", "standard", "deep_stack", "hyper_turbo"];
|
|
|
56243
56247
|
const BLIND_PROGRESSIONS = ["double", "linear", "percentage", "table"];
|
|
56244
56248
|
const SIT_OUT_METHOD_NEXT_HAND = "next-hand";
|
|
56245
56249
|
const SIT_OUT_METHOD_NEXT_BB = "next-bb";
|
|
56250
|
+
const TOURNAMENT_STATUSES = ["registering", "running", "finished", "cancelled"];
|
|
56251
|
+
const TOURNAMENT_ENTRANT_STATUSES = ["registered", "playing", "busted", "unregistered"];
|
|
56246
56252
|
var SUIT;
|
|
56247
56253
|
(function (SUIT) {
|
|
56248
56254
|
SUIT[SUIT["CLUBS"] = 1] = "CLUBS";
|
|
@@ -57163,6 +57169,91 @@ function levelMinutes(options) {
|
|
|
57163
57169
|
return options.blindLevelDuration;
|
|
57164
57170
|
}
|
|
57165
57171
|
|
|
57172
|
+
/**
|
|
57173
|
+
* Parses the `leaderboard` JSON string of the chain's TournamentLeaderboard
|
|
57174
|
+
* query (block52/pokerchain#405, poker-vm#2613) into a LeaderboardDTO. Checks
|
|
57175
|
+
* the required fields and throws on anything missing or mistyped — never fills
|
|
57176
|
+
* a default (Commandment 7): a malformed board is a chain/engine bug to surface.
|
|
57177
|
+
*/
|
|
57178
|
+
function parseLeaderboardDTO(json) {
|
|
57179
|
+
if (json === "") {
|
|
57180
|
+
throw new Error("tournament leaderboard: empty leaderboard JSON");
|
|
57181
|
+
}
|
|
57182
|
+
const raw = JSON.parse(json);
|
|
57183
|
+
if (!isRecord(raw)) {
|
|
57184
|
+
throw new Error("tournament leaderboard: expected a JSON object");
|
|
57185
|
+
}
|
|
57186
|
+
requireString(raw, "tournamentId", "leaderboard");
|
|
57187
|
+
requireStatus(raw, "leaderboard");
|
|
57188
|
+
requireNumber(raw, "entrants", "leaderboard");
|
|
57189
|
+
requireNumber(raw, "remaining", "leaderboard");
|
|
57190
|
+
requireString(raw, "averageStack", "leaderboard");
|
|
57191
|
+
requireString(raw, "prizePool", "leaderboard");
|
|
57192
|
+
if (!Array.isArray(raw.payouts)) {
|
|
57193
|
+
throw new Error("tournament leaderboard: payouts must be an array");
|
|
57194
|
+
}
|
|
57195
|
+
raw.payouts.forEach((p, i) => {
|
|
57196
|
+
const where = `payouts[${i}]`;
|
|
57197
|
+
if (!isRecord(p))
|
|
57198
|
+
throw new Error(`tournament leaderboard: ${where} must be an object`);
|
|
57199
|
+
requireNumber(p, "place", where);
|
|
57200
|
+
requireString(p, "amount", where);
|
|
57201
|
+
});
|
|
57202
|
+
if (raw.clock !== undefined) {
|
|
57203
|
+
if (!isRecord(raw.clock))
|
|
57204
|
+
throw new Error("tournament leaderboard: clock must be an object");
|
|
57205
|
+
requireNumber(raw.clock, "level", "clock");
|
|
57206
|
+
requireString(raw.clock, "smallBlind", "clock");
|
|
57207
|
+
requireString(raw.clock, "bigBlind", "clock");
|
|
57208
|
+
requireString(raw.clock, "ante", "clock");
|
|
57209
|
+
optionalNumber(raw.clock, "levelStartTime", "clock");
|
|
57210
|
+
}
|
|
57211
|
+
optionalNumber(raw, "nextLevelAt", "leaderboard");
|
|
57212
|
+
if (!Array.isArray(raw.entries)) {
|
|
57213
|
+
throw new Error("tournament leaderboard: entries must be an array");
|
|
57214
|
+
}
|
|
57215
|
+
raw.entries.forEach((e, i) => requireEntry(e, `entries[${i}]`));
|
|
57216
|
+
return raw;
|
|
57217
|
+
}
|
|
57218
|
+
function requireEntry(e, where) {
|
|
57219
|
+
if (!isRecord(e))
|
|
57220
|
+
throw new Error(`tournament leaderboard: ${where} must be an object`);
|
|
57221
|
+
requireNumber(e, "rank", where);
|
|
57222
|
+
requireString(e, "address", where);
|
|
57223
|
+
if (!TOURNAMENT_ENTRANT_STATUSES.includes(e.status)) {
|
|
57224
|
+
throw new Error(`tournament leaderboard: ${where}.status "${String(e.status)}" is not an entrant status`);
|
|
57225
|
+
}
|
|
57226
|
+
requireString(e, "stack", where);
|
|
57227
|
+
optionalString(e, "tableId", where);
|
|
57228
|
+
optionalNumber(e, "seat", where);
|
|
57229
|
+
optionalNumber(e, "place", where);
|
|
57230
|
+
optionalString(e, "payout", where);
|
|
57231
|
+
}
|
|
57232
|
+
function requireStatus(o, where) {
|
|
57233
|
+
if (!TOURNAMENT_STATUSES.includes(o.status)) {
|
|
57234
|
+
throw new Error(`tournament leaderboard: ${where}.status "${String(o.status)}" is not a tournament status`);
|
|
57235
|
+
}
|
|
57236
|
+
}
|
|
57237
|
+
function isRecord(v) {
|
|
57238
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
57239
|
+
}
|
|
57240
|
+
function requireString(o, key, where) {
|
|
57241
|
+
if (typeof o[key] !== "string")
|
|
57242
|
+
throw new Error(`tournament leaderboard: ${where}.${key} must be a string`);
|
|
57243
|
+
}
|
|
57244
|
+
function requireNumber(o, key, where) {
|
|
57245
|
+
if (typeof o[key] !== "number")
|
|
57246
|
+
throw new Error(`tournament leaderboard: ${where}.${key} must be a number`);
|
|
57247
|
+
}
|
|
57248
|
+
function optionalString(o, key, where) {
|
|
57249
|
+
if (o[key] !== undefined)
|
|
57250
|
+
requireString(o, key, where);
|
|
57251
|
+
}
|
|
57252
|
+
function optionalNumber(o, key, where) {
|
|
57253
|
+
if (o[key] !== undefined)
|
|
57254
|
+
requireNumber(o, key, where);
|
|
57255
|
+
}
|
|
57256
|
+
|
|
57166
57257
|
/**
|
|
57167
57258
|
* Poker hand types in order of strength (weakest to strongest)
|
|
57168
57259
|
*/
|
|
@@ -58794,6 +58885,35 @@ class CosmosClient {
|
|
|
58794
58885
|
return [];
|
|
58795
58886
|
}
|
|
58796
58887
|
}
|
|
58888
|
+
/**
|
|
58889
|
+
* A multi-table tournament's live standings (block52/pokerchain#405,
|
|
58890
|
+
* poker-vm#2613), ranked by the engine: the chain runs engine.Leaderboard
|
|
58891
|
+
* over the stored tournament state and serves the LeaderboardDTO verbatim.
|
|
58892
|
+
* Unauthenticated: standings are public.
|
|
58893
|
+
*
|
|
58894
|
+
* @returns the board, or null when the chain has no tournament with this ID
|
|
58895
|
+
* (gRPC NotFound, HTTP 404). Any other failure — including an empty or
|
|
58896
|
+
* malformed leaderboard — throws.
|
|
58897
|
+
*/
|
|
58898
|
+
async getTournamentLeaderboard(tournamentId) {
|
|
58899
|
+
if (tournamentId === "") {
|
|
58900
|
+
throw new Error("tournamentId is required");
|
|
58901
|
+
}
|
|
58902
|
+
try {
|
|
58903
|
+
const response = await this.restClient.get(`/block52/pokerchain/poker/v1/tournament_leaderboard/${encodeURIComponent(tournamentId)}`);
|
|
58904
|
+
if (!response.data || typeof response.data.leaderboard !== "string") {
|
|
58905
|
+
throw new Error(`Empty tournament leaderboard response for ${tournamentId}`);
|
|
58906
|
+
}
|
|
58907
|
+
return parseLeaderboardDTO(response.data.leaderboard);
|
|
58908
|
+
}
|
|
58909
|
+
catch (error) {
|
|
58910
|
+
if (isGrpcNotFound(error)) {
|
|
58911
|
+
return null;
|
|
58912
|
+
}
|
|
58913
|
+
console.error("Error fetching tournament leaderboard:", error);
|
|
58914
|
+
throw error;
|
|
58915
|
+
}
|
|
58916
|
+
}
|
|
58797
58917
|
/**
|
|
58798
58918
|
* Calculate equity for multiple hands using Monte Carlo simulation
|
|
58799
58919
|
* Used when players are all-in and showing to display win percentages
|
|
@@ -58864,6 +58984,19 @@ const getDefaultCosmosConfig = (domain = "localhost") => ({
|
|
|
58864
58984
|
denom: "stake", // Use stake as the denomination (lowercase, as stored on blockchain)
|
|
58865
58985
|
gasPrice: "0.0stake" // Gas price in stake (not used in REST-only mode)
|
|
58866
58986
|
});
|
|
58987
|
+
/** gRPC code NOT_FOUND as grpc-gateway reports it in an error body. */
|
|
58988
|
+
const GRPC_NOT_FOUND = 5;
|
|
58989
|
+
/**
|
|
58990
|
+
* True for a grpc-gateway NotFound reply: HTTP 404 whose body carries gRPC code
|
|
58991
|
+
* 5. An unknown route (an older chain without the query) is a 501, not this.
|
|
58992
|
+
*/
|
|
58993
|
+
function isGrpcNotFound(error) {
|
|
58994
|
+
if (!axios.isAxiosError(error) || error.response?.status !== 404) {
|
|
58995
|
+
return false;
|
|
58996
|
+
}
|
|
58997
|
+
const body = error.response.data;
|
|
58998
|
+
return typeof body === "object" && body !== null && body.code === GRPC_NOT_FOUND;
|
|
58999
|
+
}
|
|
58867
59000
|
|
|
58868
59001
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
58869
59002
|
|
|
@@ -72805,5 +72938,5 @@ const registry = new Registry([
|
|
|
72805
72938
|
...msgTypes,
|
|
72806
72939
|
]);
|
|
72807
72940
|
|
|
72808
|
-
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 };
|
|
72941
|
+
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, TOURNAMENT_ENTRANT_STATUSES, TOURNAMENT_STATUSES, 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, parseLeaderboardDTO, registry, resolveBlindPreset, roundBlind, toValoperAddress, txFailureHash, txFailurePhase };
|
|
72809
72942
|
//# sourceMappingURL=index.esm.js.map
|