@block52/poker-vm-sdk 1.2.0 → 1.2.2

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
@@ -45213,6 +45213,7 @@ declare enum PlayerActionType {
45213
45213
  declare enum NonPlayerActionType {
45214
45214
  DEAD_SMALL_BLIND = "dead-small-blind",
45215
45215
  DEAL = "deal",
45216
+ FORCE_CLOSE = "force-close",
45216
45217
  JOIN = "join",
45217
45218
  LEAVE = "leave",
45218
45219
  NEW_HAND = "new-hand",
@@ -45223,6 +45224,7 @@ declare enum NonPlayerActionType {
45223
45224
  declare const AllPlayerActions: {
45224
45225
  DEAD_SMALL_BLIND: NonPlayerActionType.DEAD_SMALL_BLIND;
45225
45226
  DEAL: NonPlayerActionType.DEAL;
45227
+ FORCE_CLOSE: NonPlayerActionType.FORCE_CLOSE;
45226
45228
  JOIN: NonPlayerActionType.JOIN;
45227
45229
  LEAVE: NonPlayerActionType.LEAVE;
45228
45230
  NEW_HAND: NonPlayerActionType.NEW_HAND;
@@ -45388,6 +45390,7 @@ type PlayerDTO = {
45388
45390
  timeout: number;
45389
45391
  sitInMethod?: SitInMethod;
45390
45392
  pendingSitOut?: string;
45393
+ pendingTopUpAmount?: string;
45391
45394
  signature: string;
45392
45395
  };
45393
45396
  type ResultDTO = {
@@ -46407,6 +46410,18 @@ declare class SigningCosmosClient extends CosmosClient {
46407
46410
  * Only the game creator can delete a game, and the game must have no active players
46408
46411
  */
46409
46412
  deleteGame(gameId: string): Promise<string>;
46413
+ /**
46414
+ * Force-close a poker game and refund every seated player.
46415
+ *
46416
+ * Only the table creator can invoke this. Distinct from `deleteGame()`:
46417
+ * `deleteGame` requires zero players, this kicks everyone off and refunds
46418
+ * their stacks (plus any current-hand contribution and queued top-up) to
46419
+ * their wallet, then deletes the table.
46420
+ *
46421
+ * Cash format only. Chain rejects SNG/Tournament — those have separate
46422
+ * cancellation semantics (see block52/poker-vm#2173).
46423
+ */
46424
+ forceCloseGame(gameId: string): Promise<string>;
46410
46425
  /**
46411
46426
  * Perform a game action (fold, call, raise, etc.)
46412
46427
  * The keeper calculates the action index automatically
package/dist/index.esm.js CHANGED
@@ -55860,6 +55860,7 @@ var NonPlayerActionType;
55860
55860
  (function (NonPlayerActionType) {
55861
55861
  NonPlayerActionType["DEAD_SMALL_BLIND"] = "dead-small-blind";
55862
55862
  NonPlayerActionType["DEAL"] = "deal";
55863
+ NonPlayerActionType["FORCE_CLOSE"] = "force-close";
55863
55864
  NonPlayerActionType["JOIN"] = "join";
55864
55865
  NonPlayerActionType["LEAVE"] = "leave";
55865
55866
  NonPlayerActionType["NEW_HAND"] = "new-hand";
@@ -57947,6 +57948,45 @@ class SigningCosmosClient extends CosmosClient {
57947
57948
  throw error;
57948
57949
  }
57949
57950
  }
57951
+ /**
57952
+ * Force-close a poker game and refund every seated player.
57953
+ *
57954
+ * Only the table creator can invoke this. Distinct from `deleteGame()`:
57955
+ * `deleteGame` requires zero players, this kicks everyone off and refunds
57956
+ * their stacks (plus any current-hand contribution and queued top-up) to
57957
+ * their wallet, then deletes the table.
57958
+ *
57959
+ * Cash format only. Chain rejects SNG/Tournament — those have separate
57960
+ * cancellation semantics (see block52/poker-vm#2173).
57961
+ */
57962
+ async forceCloseGame(gameId) {
57963
+ await this.initializeSigningClient();
57964
+ if (!this.signingClient || !this.wallet) {
57965
+ throw new Error("Signing client not initialized");
57966
+ }
57967
+ const [account] = await this.wallet.getAccounts();
57968
+ const creator = account.address;
57969
+ const msgForceCloseGame = {
57970
+ creator,
57971
+ gameId
57972
+ };
57973
+ const msg = {
57974
+ typeUrl: "/pokerchain.poker.v1.MsgForceCloseGame",
57975
+ value: msgForceCloseGame
57976
+ };
57977
+ const fee = gaslessFee();
57978
+ const memo = "Force-close poker game via SDK";
57979
+ console.log("🛑 Force-closing game:", { gameId });
57980
+ try {
57981
+ const result = await this.signingClient.signAndBroadcast(creator, [msg], fee, memo);
57982
+ console.log("✅ Force-close transaction successful:", result.transactionHash);
57983
+ return result.transactionHash;
57984
+ }
57985
+ catch (error) {
57986
+ console.error("❌ Force-close failed:", error);
57987
+ throw error;
57988
+ }
57989
+ }
57950
57990
  /**
57951
57991
  * Perform a game action (fold, call, raise, etc.)
57952
57992
  * The keeper calculates the action index automatically