@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.js CHANGED
@@ -55862,6 +55862,7 @@ exports.NonPlayerActionType = void 0;
55862
55862
  (function (NonPlayerActionType) {
55863
55863
  NonPlayerActionType["DEAD_SMALL_BLIND"] = "dead-small-blind";
55864
55864
  NonPlayerActionType["DEAL"] = "deal";
55865
+ NonPlayerActionType["FORCE_CLOSE"] = "force-close";
55865
55866
  NonPlayerActionType["JOIN"] = "join";
55866
55867
  NonPlayerActionType["LEAVE"] = "leave";
55867
55868
  NonPlayerActionType["NEW_HAND"] = "new-hand";
@@ -57949,6 +57950,45 @@ class SigningCosmosClient extends CosmosClient {
57949
57950
  throw error;
57950
57951
  }
57951
57952
  }
57953
+ /**
57954
+ * Force-close a poker game and refund every seated player.
57955
+ *
57956
+ * Only the table creator can invoke this. Distinct from `deleteGame()`:
57957
+ * `deleteGame` requires zero players, this kicks everyone off and refunds
57958
+ * their stacks (plus any current-hand contribution and queued top-up) to
57959
+ * their wallet, then deletes the table.
57960
+ *
57961
+ * Cash format only. Chain rejects SNG/Tournament — those have separate
57962
+ * cancellation semantics (see block52/poker-vm#2173).
57963
+ */
57964
+ async forceCloseGame(gameId) {
57965
+ await this.initializeSigningClient();
57966
+ if (!this.signingClient || !this.wallet) {
57967
+ throw new Error("Signing client not initialized");
57968
+ }
57969
+ const [account] = await this.wallet.getAccounts();
57970
+ const creator = account.address;
57971
+ const msgForceCloseGame = {
57972
+ creator,
57973
+ gameId
57974
+ };
57975
+ const msg = {
57976
+ typeUrl: "/pokerchain.poker.v1.MsgForceCloseGame",
57977
+ value: msgForceCloseGame
57978
+ };
57979
+ const fee = gaslessFee();
57980
+ const memo = "Force-close poker game via SDK";
57981
+ console.log("🛑 Force-closing game:", { gameId });
57982
+ try {
57983
+ const result = await this.signingClient.signAndBroadcast(creator, [msg], fee, memo);
57984
+ console.log("✅ Force-close transaction successful:", result.transactionHash);
57985
+ return result.transactionHash;
57986
+ }
57987
+ catch (error) {
57988
+ console.error("❌ Force-close failed:", error);
57989
+ throw error;
57990
+ }
57991
+ }
57952
57992
  /**
57953
57993
  * Perform a game action (fold, call, raise, etc.)
57954
57994
  * The keeper calculates the action index automatically