@block52/poker-vm-sdk 1.0.7 → 1.0.8

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,9 @@ type TexasHoldemGameState = {
45365
45364
  signature: string;
45366
45365
  };
45367
45366
  type TexasHoldemStateDTO = {
45368
- gameFormat: GameFormat;
45369
45367
  address: string;
45370
45368
  gameOptions: GameOptionsDTO;
45369
+ gameFormat?: GameFormat | string;
45371
45370
  smallBlindPosition?: number;
45372
45371
  bigBlindPosition?: number;
45373
45372
  dealer?: number;
@@ -45385,6 +45384,16 @@ type TexasHoldemStateDTO = {
45385
45384
  results: ResultDTO[];
45386
45385
  signature: string;
45387
45386
  };
45387
+ /**
45388
+ * Game represents a complete game instance from the API.
45389
+ * Format and variant are at the root level (single source of truth).
45390
+ */
45391
+ type Game = {
45392
+ gameId: string;
45393
+ format: GameFormat;
45394
+ variant: GameVariant;
45395
+ gameState: TexasHoldemStateDTO;
45396
+ };
45388
45397
  declare enum SUIT {
45389
45398
  CLUBS = 1,
45390
45399
  DIAMONDS = 2,
@@ -45682,6 +45691,146 @@ declare function isValidMnemonic(mnemonic: string): boolean;
45682
45691
  */
45683
45692
  declare function getAddressFromMnemonic(mnemonic: string, prefix?: string): Promise<string>;
45684
45693
 
45694
+ /**
45695
+ * Game Format Utilities
45696
+ *
45697
+ * Helper functions for working with GameFormat and GameVariant enum values.
45698
+ * GameFormat uses kebab-case values: "cash", "sit-and-go", "tournament"
45699
+ * GameVariant uses kebab-case values: "texas-holdem", "omaha"
45700
+ */
45701
+ /**
45702
+ * Check if a game format is a tournament-style game (SNG or Tournament).
45703
+ * Tournament-style games have fixed buy-ins and elimination mechanics.
45704
+ *
45705
+ * @param format - GameFormat enum value or string
45706
+ * @returns true if the format is SIT_AND_GO or TOURNAMENT
45707
+ */
45708
+ declare const isTournamentFormat: (format: GameFormat | string | undefined) => boolean;
45709
+ /**
45710
+ * Check if a game format is a cash game.
45711
+ * Cash games allow flexible buy-ins and players can leave anytime.
45712
+ *
45713
+ * @param format - GameFormat enum value or string
45714
+ * @returns true if the format is CASH
45715
+ */
45716
+ declare const isCashFormat: (format: GameFormat | string | undefined) => boolean;
45717
+ /**
45718
+ * Check if a game format is a Sit & Go.
45719
+ * Sit & Go games start when all seats are filled.
45720
+ *
45721
+ * @param format - GameFormat enum value or string
45722
+ * @returns true if the format is SIT_AND_GO
45723
+ */
45724
+ declare const isSitAndGoFormat: (format: GameFormat | string | undefined) => boolean;
45725
+ /**
45726
+ * Format a game format value for display.
45727
+ * Capitalizes words and replaces hyphens with spaces.
45728
+ *
45729
+ * @param format - GameFormat enum value or string
45730
+ * @returns Formatted string for display (e.g., "Sit And Go", "Cash", "Tournament")
45731
+ */
45732
+ declare const formatGameFormatDisplay: (format: GameFormat | string | undefined) => string;
45733
+ /**
45734
+ * Get the string value to send to Cosmos blockchain.
45735
+ * Cosmos accepts kebab-case format values directly.
45736
+ *
45737
+ * @deprecated GameFormat enum values are already in kebab-case.
45738
+ * Use gameOptions.format directly instead of this function.
45739
+ * @param format - GameFormat enum value
45740
+ * @returns The kebab-case string value (e.g., "sit-and-go", "cash", "tournament")
45741
+ */
45742
+ declare const getGameFormatForCosmos: (format: GameFormat) => string;
45743
+ /**
45744
+ * Get game format, returning "unknown" if it cannot be determined.
45745
+ * Does NOT default to any value - explicitly returns "unknown" for visibility.
45746
+ *
45747
+ * @param format - GameFormat enum value, string, or undefined
45748
+ * @returns GameFormat enum value, or "unknown" if cannot be determined
45749
+ */
45750
+ declare const getGameFormat: (format: GameFormat | string | undefined) => GameFormat | "unknown";
45751
+ /**
45752
+ * Extract game format from a game object with various property name conventions.
45753
+ * Handles different API response formats (camelCase, snake_case, etc.)
45754
+ *
45755
+ * @param game - Game object that may have gameFormat or format properties
45756
+ * @returns GameFormat enum value, or "unknown" if not found
45757
+ */
45758
+ declare const getGameFormatFromObject: (game: {
45759
+ gameFormat?: GameFormat | string;
45760
+ format?: GameFormat | string;
45761
+ } | undefined) => GameFormat | "unknown";
45762
+ /**
45763
+ * Parse a string value to GameFormat enum.
45764
+ * Handles various input formats (kebab-case, snake_case, etc.)
45765
+ *
45766
+ * @param value - String value to parse
45767
+ * @returns GameFormat enum value, or "unknown" if invalid
45768
+ */
45769
+ declare const parseGameFormat: (value: string | undefined) => GameFormat | "unknown";
45770
+ /**
45771
+ * Format a game variant value for display.
45772
+ * Capitalizes words and replaces hyphens with spaces.
45773
+ *
45774
+ * @param variant - GameVariant enum value or string
45775
+ * @returns Formatted string for display (e.g., "Texas Holdem", "Omaha", "Unknown")
45776
+ */
45777
+ declare const formatGameVariantDisplay: (variant: GameVariant | string | undefined) => string;
45778
+ /**
45779
+ * Get game variant, returning "unknown" if it cannot be determined.
45780
+ * Does NOT default to any value - explicitly returns "unknown" for visibility.
45781
+ *
45782
+ * @param variant - GameVariant enum value, string, or undefined
45783
+ * @returns GameVariant enum value, or "unknown" if cannot be determined
45784
+ */
45785
+ declare const getGameVariant: (variant: GameVariant | string | undefined) => GameVariant | "unknown";
45786
+ /**
45787
+ * Parse a string value to GameVariant enum.
45788
+ * Handles various input formats (kebab-case, snake_case, etc.)
45789
+ *
45790
+ * @param value - String value to parse
45791
+ * @returns GameVariant enum value, or "unknown" if invalid
45792
+ */
45793
+ declare const parseGameVariant: (value: string | undefined) => GameVariant | "unknown";
45794
+
45795
+ /**
45796
+ * Check if a specific action is available in the legal actions list.
45797
+ *
45798
+ * @param legalActions - Array of legal actions available to the player
45799
+ * @param action - The action type to check for
45800
+ * @returns true if the action is available
45801
+ */
45802
+ declare const hasAction: (legalActions: LegalActionDTO[], action: PlayerActionType | NonPlayerActionType) => boolean;
45803
+ /**
45804
+ * Find a specific action by type from the legal actions list.
45805
+ *
45806
+ * @param legalActions - Array of legal actions available to the player
45807
+ * @param actionType - The action type to find
45808
+ * @returns The matching LegalActionDTO or undefined if not found
45809
+ */
45810
+ declare const getActionByType: (legalActions: LegalActionDTO[], actionType: PlayerActionType | NonPlayerActionType) => LegalActionDTO | undefined;
45811
+
45812
+ /**
45813
+ * Address Utilities
45814
+ *
45815
+ * Helper functions for validating and checking Cosmos blockchain addresses.
45816
+ */
45817
+ /**
45818
+ * Check if an address represents an empty/vacant player slot.
45819
+ * For Cosmos addresses (b52...), we only check for null/undefined/empty.
45820
+ *
45821
+ * @param address - The player address to check
45822
+ * @returns true if the address is empty/vacant, false if it's a real player
45823
+ */
45824
+ declare const isEmptyAddress: (address: string | null | undefined) => boolean;
45825
+ /**
45826
+ * Check if an address represents a valid (non-empty) player.
45827
+ * Opposite of isEmptyAddress.
45828
+ *
45829
+ * @param address - The player address to check
45830
+ * @returns true if the address is a valid player address, false if empty
45831
+ */
45832
+ declare const isValidPlayerAddress: (address: string | null | undefined) => boolean;
45833
+
45685
45834
  /**
45686
45835
  * Poker hand types in order of strength (weakest to strongest)
45687
45836
  */
@@ -46495,5 +46644,5 @@ declare const Client: typeof IgniteClient & Constructor<{
46495
46644
  }>;
46496
46645
  declare const registry: Registry;
46497
46646
 
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 };
46647
+ 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 };
46648
+ 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