@block52/poker-vm-sdk 1.0.7 → 1.0.9

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
@@ -45278,7 +45278,6 @@ type GameOptions = {
45278
45278
  smallBlind: bigint;
45279
45279
  bigBlind: bigint;
45280
45280
  timeout: number;
45281
- format: GameFormat;
45282
45281
  rake?: RakeConfig$1;
45283
45282
  owner?: string;
45284
45283
  startingStack?: bigint;
@@ -45293,11 +45292,11 @@ type GameOptionsDTO = {
45293
45292
  smallBlind?: string;
45294
45293
  bigBlind?: string;
45295
45294
  timeout?: number;
45296
- format?: GameFormat;
45297
45295
  rake?: RakeConfigDTO;
45298
45296
  owner?: string;
45299
45297
  startingStack?: string;
45300
45298
  blindLevelDuration?: number;
45299
+ format?: GameFormat | string;
45301
45300
  otherOptions?: Record<string, any>;
45302
45301
  };
45303
45302
  type ActionDTO = {
@@ -45365,9 +45364,10 @@ type TexasHoldemGameState = {
45365
45364
  signature: string;
45366
45365
  };
45367
45366
  type TexasHoldemStateDTO = {
45368
- gameFormat: GameFormat;
45369
45367
  address: string;
45370
45368
  gameOptions: GameOptionsDTO;
45369
+ format?: GameFormat | string;
45370
+ variant?: GameVariant | string;
45371
45371
  smallBlindPosition?: number;
45372
45372
  bigBlindPosition?: number;
45373
45373
  dealer?: number;
@@ -45385,6 +45385,16 @@ type TexasHoldemStateDTO = {
45385
45385
  results: ResultDTO[];
45386
45386
  signature: string;
45387
45387
  };
45388
+ /**
45389
+ * Game represents a complete game instance from the API.
45390
+ * Format and variant are at the root level (single source of truth).
45391
+ */
45392
+ type Game = {
45393
+ gameId: string;
45394
+ format: GameFormat;
45395
+ variant: GameVariant;
45396
+ gameState: TexasHoldemStateDTO;
45397
+ };
45388
45398
  declare enum SUIT {
45389
45399
  CLUBS = 1,
45390
45400
  DIAMONDS = 2,
@@ -45682,6 +45692,146 @@ declare function isValidMnemonic(mnemonic: string): boolean;
45682
45692
  */
45683
45693
  declare function getAddressFromMnemonic(mnemonic: string, prefix?: string): Promise<string>;
45684
45694
 
45695
+ /**
45696
+ * Game Format Utilities
45697
+ *
45698
+ * Helper functions for working with GameFormat and GameVariant enum values.
45699
+ * GameFormat uses kebab-case values: "cash", "sit-and-go", "tournament"
45700
+ * GameVariant uses kebab-case values: "texas-holdem", "omaha"
45701
+ */
45702
+ /**
45703
+ * Check if a game format is a tournament-style game (SNG or Tournament).
45704
+ * Tournament-style games have fixed buy-ins and elimination mechanics.
45705
+ *
45706
+ * @param format - GameFormat enum value or string
45707
+ * @returns true if the format is SIT_AND_GO or TOURNAMENT
45708
+ */
45709
+ declare const isTournamentFormat: (format: GameFormat | string | undefined) => boolean;
45710
+ /**
45711
+ * Check if a game format is a cash game.
45712
+ * Cash games allow flexible buy-ins and players can leave anytime.
45713
+ *
45714
+ * @param format - GameFormat enum value or string
45715
+ * @returns true if the format is CASH
45716
+ */
45717
+ declare const isCashFormat: (format: GameFormat | string | undefined) => boolean;
45718
+ /**
45719
+ * Check if a game format is a Sit & Go.
45720
+ * Sit & Go games start when all seats are filled.
45721
+ *
45722
+ * @param format - GameFormat enum value or string
45723
+ * @returns true if the format is SIT_AND_GO
45724
+ */
45725
+ declare const isSitAndGoFormat: (format: GameFormat | string | undefined) => boolean;
45726
+ /**
45727
+ * Format a game format value for display.
45728
+ * Capitalizes words and replaces hyphens with spaces.
45729
+ *
45730
+ * @param format - GameFormat enum value or string
45731
+ * @returns Formatted string for display (e.g., "Sit And Go", "Cash", "Tournament")
45732
+ */
45733
+ declare const formatGameFormatDisplay: (format: GameFormat | string | undefined) => string;
45734
+ /**
45735
+ * Get the string value to send to Cosmos blockchain.
45736
+ * Cosmos accepts kebab-case format values directly.
45737
+ *
45738
+ * @deprecated GameFormat enum values are already in kebab-case.
45739
+ * Use gameOptions.format directly instead of this function.
45740
+ * @param format - GameFormat enum value
45741
+ * @returns The kebab-case string value (e.g., "sit-and-go", "cash", "tournament")
45742
+ */
45743
+ declare const getGameFormatForCosmos: (format: GameFormat) => string;
45744
+ /**
45745
+ * Get game format, returning "unknown" if it cannot be determined.
45746
+ * Does NOT default to any value - explicitly returns "unknown" for visibility.
45747
+ *
45748
+ * @param format - GameFormat enum value, string, or undefined
45749
+ * @returns GameFormat enum value, or "unknown" if cannot be determined
45750
+ */
45751
+ declare const getGameFormat: (format: GameFormat | string | undefined) => GameFormat | "unknown";
45752
+ /**
45753
+ * Extract game format from a game object with various property name conventions.
45754
+ * Handles different API response formats (camelCase, snake_case, etc.)
45755
+ *
45756
+ * @param game - Game object that may have gameFormat or format properties
45757
+ * @returns GameFormat enum value, or "unknown" if not found
45758
+ */
45759
+ declare const getGameFormatFromObject: (game: {
45760
+ gameFormat?: GameFormat | string;
45761
+ format?: GameFormat | string;
45762
+ } | undefined) => GameFormat | "unknown";
45763
+ /**
45764
+ * Parse a string value to GameFormat enum.
45765
+ * Handles various input formats (kebab-case, snake_case, etc.)
45766
+ *
45767
+ * @param value - String value to parse
45768
+ * @returns GameFormat enum value, or "unknown" if invalid
45769
+ */
45770
+ declare const parseGameFormat: (value: string | undefined) => GameFormat | "unknown";
45771
+ /**
45772
+ * Format a game variant value for display.
45773
+ * Capitalizes words and replaces hyphens with spaces.
45774
+ *
45775
+ * @param variant - GameVariant enum value or string
45776
+ * @returns Formatted string for display (e.g., "Texas Holdem", "Omaha", "Unknown")
45777
+ */
45778
+ declare const formatGameVariantDisplay: (variant: GameVariant | string | undefined) => string;
45779
+ /**
45780
+ * Get game variant, returning "unknown" if it cannot be determined.
45781
+ * Does NOT default to any value - explicitly returns "unknown" for visibility.
45782
+ *
45783
+ * @param variant - GameVariant enum value, string, or undefined
45784
+ * @returns GameVariant enum value, or "unknown" if cannot be determined
45785
+ */
45786
+ declare const getGameVariant: (variant: GameVariant | string | undefined) => GameVariant | "unknown";
45787
+ /**
45788
+ * Parse a string value to GameVariant enum.
45789
+ * Handles various input formats (kebab-case, snake_case, etc.)
45790
+ *
45791
+ * @param value - String value to parse
45792
+ * @returns GameVariant enum value, or "unknown" if invalid
45793
+ */
45794
+ declare const parseGameVariant: (value: string | undefined) => GameVariant | "unknown";
45795
+
45796
+ /**
45797
+ * Check if a specific action is available in the legal actions list.
45798
+ *
45799
+ * @param legalActions - Array of legal actions available to the player
45800
+ * @param action - The action type to check for
45801
+ * @returns true if the action is available
45802
+ */
45803
+ declare const hasAction: (legalActions: LegalActionDTO[], action: PlayerActionType | NonPlayerActionType) => boolean;
45804
+ /**
45805
+ * Find a specific action by type from the legal actions list.
45806
+ *
45807
+ * @param legalActions - Array of legal actions available to the player
45808
+ * @param actionType - The action type to find
45809
+ * @returns The matching LegalActionDTO or undefined if not found
45810
+ */
45811
+ declare const getActionByType: (legalActions: LegalActionDTO[], actionType: PlayerActionType | NonPlayerActionType) => LegalActionDTO | undefined;
45812
+
45813
+ /**
45814
+ * Address Utilities
45815
+ *
45816
+ * Helper functions for validating and checking Cosmos blockchain addresses.
45817
+ */
45818
+ /**
45819
+ * Check if an address represents an empty/vacant player slot.
45820
+ * For Cosmos addresses (b52...), we only check for null/undefined/empty.
45821
+ *
45822
+ * @param address - The player address to check
45823
+ * @returns true if the address is empty/vacant, false if it's a real player
45824
+ */
45825
+ declare const isEmptyAddress: (address: string | null | undefined) => boolean;
45826
+ /**
45827
+ * Check if an address represents a valid (non-empty) player.
45828
+ * Opposite of isEmptyAddress.
45829
+ *
45830
+ * @param address - The player address to check
45831
+ * @returns true if the address is a valid player address, false if empty
45832
+ */
45833
+ declare const isValidPlayerAddress: (address: string | null | undefined) => boolean;
45834
+
45685
45835
  /**
45686
45836
  * Poker hand types in order of strength (weakest to strongest)
45687
45837
  */
@@ -46495,5 +46645,5 @@ declare const Client: typeof IgniteClient & Constructor<{
46495
46645
  }>;
46496
46646
  declare const registry: Registry;
46497
46647
 
46498
- export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, generateWallet, getAddressFromMnemonic, getDefaultCosmosConfig, isValidMnemonic, registry };
46499
- export type { AccountDTO, ActionDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, EquityHand, EquityRequest, EquityResponse, EquityResult, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, HandEvaluation, ISignedResponse, LegalActionDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, TexasHoldemGameState, TexasHoldemStateDTO, TransactionDTO, TransactionResponse, WalletInfo, WinnerDTO, WithdrawResponseDTO };
46648
+ export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
46649
+ export type { AccountDTO, ActionDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, EquityHand, EquityRequest, EquityResponse, EquityResult, Game, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, HandEvaluation, ISignedResponse, LegalActionDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, TexasHoldemGameState, TexasHoldemStateDTO, TransactionDTO, TransactionResponse, WalletInfo, WinnerDTO, WithdrawResponseDTO };
@@ -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,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGvG,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGzF,OAAO,EACL,MAAM,EACN,QAAQ,EACR,kBAAkB,EACnB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAkC/C,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEV,CAAC;AAEH,QAAA,MAAM,QAAQ,UAiCZ,CAAA;AAGF,cAAc,6BAA6B,CAAA;AAG3C,cAAc,cAAc,CAAA;AAG5B,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGpG,cAAc,eAAe,CAAA;AAG7B,cAAc,eAAe,CAAA;AAG7B,cAAc,yBAAyB,CAAA;AAGvC,cAAc,qBAAqB,CAAA;AAGnC,cAAc,sBAAsB,CAAA;AAGpC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGvG,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGzF,OAAO,EACL,MAAM,EACN,QAAQ,EACR,kBAAkB,EACnB,CAAA"}
package/dist/index.esm.js CHANGED
@@ -55818,6 +55818,246 @@ async function getAddressFromMnemonic(mnemonic, prefix = "b52") {
55818
55818
  return account.address;
55819
55819
  }
55820
55820
 
55821
+ /**
55822
+ * Game Format Utilities
55823
+ *
55824
+ * Helper functions for working with GameFormat and GameVariant enum values.
55825
+ * GameFormat uses kebab-case values: "cash", "sit-and-go", "tournament"
55826
+ * GameVariant uses kebab-case values: "texas-holdem", "omaha"
55827
+ */
55828
+ /**
55829
+ * Check if a game format is a tournament-style game (SNG or Tournament).
55830
+ * Tournament-style games have fixed buy-ins and elimination mechanics.
55831
+ *
55832
+ * @param format - GameFormat enum value or string
55833
+ * @returns true if the format is SIT_AND_GO or TOURNAMENT
55834
+ */
55835
+ const isTournamentFormat = (format) => {
55836
+ if (!format)
55837
+ return false;
55838
+ return format === GameFormat.SIT_AND_GO ||
55839
+ format === GameFormat.TOURNAMENT ||
55840
+ format === "sit-and-go" ||
55841
+ format === "tournament";
55842
+ };
55843
+ /**
55844
+ * Check if a game format is a cash game.
55845
+ * Cash games allow flexible buy-ins and players can leave anytime.
55846
+ *
55847
+ * @param format - GameFormat enum value or string
55848
+ * @returns true if the format is CASH
55849
+ */
55850
+ const isCashFormat = (format) => {
55851
+ if (!format)
55852
+ return false;
55853
+ return format === GameFormat.CASH || format === "cash";
55854
+ };
55855
+ /**
55856
+ * Check if a game format is a Sit & Go.
55857
+ * Sit & Go games start when all seats are filled.
55858
+ *
55859
+ * @param format - GameFormat enum value or string
55860
+ * @returns true if the format is SIT_AND_GO
55861
+ */
55862
+ const isSitAndGoFormat = (format) => {
55863
+ if (!format)
55864
+ return false;
55865
+ return format === GameFormat.SIT_AND_GO || format === "sit-and-go";
55866
+ };
55867
+ /**
55868
+ * Format a game format value for display.
55869
+ * Capitalizes words and replaces hyphens with spaces.
55870
+ *
55871
+ * @param format - GameFormat enum value or string
55872
+ * @returns Formatted string for display (e.g., "Sit And Go", "Cash", "Tournament")
55873
+ */
55874
+ const formatGameFormatDisplay = (format) => {
55875
+ if (!format)
55876
+ return "Unknown";
55877
+ // Replace hyphens with spaces and capitalize each word
55878
+ return format
55879
+ .split("-")
55880
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
55881
+ .join(" ");
55882
+ };
55883
+ /**
55884
+ * Get the string value to send to Cosmos blockchain.
55885
+ * Cosmos accepts kebab-case format values directly.
55886
+ *
55887
+ * @deprecated GameFormat enum values are already in kebab-case.
55888
+ * Use gameOptions.format directly instead of this function.
55889
+ * @param format - GameFormat enum value
55890
+ * @returns The kebab-case string value (e.g., "sit-and-go", "cash", "tournament")
55891
+ */
55892
+ const getGameFormatForCosmos = (format) => {
55893
+ // GameFormat enum values are already in kebab-case, which Cosmos accepts
55894
+ return format;
55895
+ };
55896
+ /**
55897
+ * Get game format, returning "unknown" if it cannot be determined.
55898
+ * Does NOT default to any value - explicitly returns "unknown" for visibility.
55899
+ *
55900
+ * @param format - GameFormat enum value, string, or undefined
55901
+ * @returns GameFormat enum value, or "unknown" if cannot be determined
55902
+ */
55903
+ const getGameFormat = (format) => {
55904
+ if (!format)
55905
+ return "unknown";
55906
+ // If it's already a valid GameFormat enum value, return it
55907
+ if (Object.values(GameFormat).includes(format)) {
55908
+ return format;
55909
+ }
55910
+ // Otherwise parse it
55911
+ return parseGameFormat(format);
55912
+ };
55913
+ /**
55914
+ * Extract game format from a game object with various property name conventions.
55915
+ * Handles different API response formats (camelCase, snake_case, etc.)
55916
+ *
55917
+ * @param game - Game object that may have gameFormat or format properties
55918
+ * @returns GameFormat enum value, or "unknown" if not found
55919
+ */
55920
+ const getGameFormatFromObject = (game) => {
55921
+ if (!game)
55922
+ return "unknown";
55923
+ const format = game.gameFormat || game.format;
55924
+ return getGameFormat(format);
55925
+ };
55926
+ /**
55927
+ * Parse a string value to GameFormat enum.
55928
+ * Handles various input formats (kebab-case, snake_case, etc.)
55929
+ *
55930
+ * @param value - String value to parse
55931
+ * @returns GameFormat enum value, or "unknown" if invalid
55932
+ */
55933
+ const parseGameFormat = (value) => {
55934
+ if (!value)
55935
+ return "unknown";
55936
+ const normalized = value.toLowerCase().replace(/_/g, "-");
55937
+ switch (normalized) {
55938
+ case "sit-and-go":
55939
+ case "sitandgo":
55940
+ case "sng":
55941
+ return GameFormat.SIT_AND_GO;
55942
+ case "tournament":
55943
+ case "tourney":
55944
+ return GameFormat.TOURNAMENT;
55945
+ case "cash":
55946
+ case "ring":
55947
+ return GameFormat.CASH;
55948
+ default:
55949
+ return "unknown";
55950
+ }
55951
+ };
55952
+ /**
55953
+ * Format a game variant value for display.
55954
+ * Capitalizes words and replaces hyphens with spaces.
55955
+ *
55956
+ * @param variant - GameVariant enum value or string
55957
+ * @returns Formatted string for display (e.g., "Texas Holdem", "Omaha", "Unknown")
55958
+ */
55959
+ const formatGameVariantDisplay = (variant) => {
55960
+ if (!variant)
55961
+ return "Unknown";
55962
+ // Replace hyphens with spaces and capitalize each word
55963
+ return variant
55964
+ .split("-")
55965
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
55966
+ .join(" ");
55967
+ };
55968
+ /**
55969
+ * Get game variant, returning "unknown" if it cannot be determined.
55970
+ * Does NOT default to any value - explicitly returns "unknown" for visibility.
55971
+ *
55972
+ * @param variant - GameVariant enum value, string, or undefined
55973
+ * @returns GameVariant enum value, or "unknown" if cannot be determined
55974
+ */
55975
+ const getGameVariant = (variant) => {
55976
+ if (!variant)
55977
+ return "unknown";
55978
+ // If it's already a valid GameVariant enum value, return it
55979
+ if (Object.values(GameVariant).includes(variant)) {
55980
+ return variant;
55981
+ }
55982
+ // Otherwise parse it
55983
+ return parseGameVariant(variant);
55984
+ };
55985
+ /**
55986
+ * Parse a string value to GameVariant enum.
55987
+ * Handles various input formats (kebab-case, snake_case, etc.)
55988
+ *
55989
+ * @param value - String value to parse
55990
+ * @returns GameVariant enum value, or "unknown" if invalid
55991
+ */
55992
+ const parseGameVariant = (value) => {
55993
+ if (!value)
55994
+ return "unknown";
55995
+ const normalized = value.toLowerCase().replace(/_/g, "-");
55996
+ switch (normalized) {
55997
+ case "texas-holdem":
55998
+ case "texasholdem":
55999
+ case "holdem":
56000
+ case "nlh":
56001
+ return GameVariant.TEXAS_HOLDEM;
56002
+ case "omaha":
56003
+ case "plo":
56004
+ return GameVariant.OMAHA;
56005
+ default:
56006
+ return "unknown";
56007
+ }
56008
+ };
56009
+
56010
+ /**
56011
+ * Check if a specific action is available in the legal actions list.
56012
+ *
56013
+ * @param legalActions - Array of legal actions available to the player
56014
+ * @param action - The action type to check for
56015
+ * @returns true if the action is available
56016
+ */
56017
+ const hasAction = (legalActions, action) => {
56018
+ return legalActions.some(legalAction => legalAction.action === action);
56019
+ };
56020
+ /**
56021
+ * Find a specific action by type from the legal actions list.
56022
+ *
56023
+ * @param legalActions - Array of legal actions available to the player
56024
+ * @param actionType - The action type to find
56025
+ * @returns The matching LegalActionDTO or undefined if not found
56026
+ */
56027
+ const getActionByType = (legalActions, actionType) => {
56028
+ return legalActions.find(action => action.action === actionType || action.action?.toString() === actionType?.toString());
56029
+ };
56030
+
56031
+ /**
56032
+ * Address Utilities
56033
+ *
56034
+ * Helper functions for validating and checking Cosmos blockchain addresses.
56035
+ */
56036
+ /**
56037
+ * Check if an address represents an empty/vacant player slot.
56038
+ * For Cosmos addresses (b52...), we only check for null/undefined/empty.
56039
+ *
56040
+ * @param address - The player address to check
56041
+ * @returns true if the address is empty/vacant, false if it's a real player
56042
+ */
56043
+ const isEmptyAddress = (address) => {
56044
+ if (!address)
56045
+ return true;
56046
+ if (address === "")
56047
+ return true;
56048
+ return false;
56049
+ };
56050
+ /**
56051
+ * Check if an address represents a valid (non-empty) player.
56052
+ * Opposite of isEmptyAddress.
56053
+ *
56054
+ * @param address - The player address to check
56055
+ * @returns true if the address is a valid player address, false if empty
56056
+ */
56057
+ const isValidPlayerAddress = (address) => {
56058
+ return !isEmptyAddress(address);
56059
+ };
56060
+
55821
56061
  /**
55822
56062
  * Poker hand types in order of strength (weakest to strongest)
55823
56063
  */
@@ -57820,5 +58060,5 @@ const registry = new Registry([
57820
58060
  ...msgTypes,
57821
58061
  ]);
57822
58062
 
57823
- export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params$c as Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, generateWallet, getAddressFromMnemonic, getDefaultCosmosConfig, isValidMnemonic, registry };
58063
+ export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params$c as Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
57824
58064
  //# sourceMappingURL=index.esm.js.map