@block52/poker-vm-sdk 1.2.0 → 1.2.3
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 +17 -0
- package/dist/index.esm.js +40 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/dist/signingClient.d.ts +12 -0
- package/dist/signingClient.d.ts.map +1 -1
- package/dist/types/game.d.ts +5 -0
- package/dist/types/game.d.ts.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -45361,6 +45363,8 @@ type LegalActionDTO = {
|
|
|
45361
45363
|
min: string | undefined;
|
|
45362
45364
|
max: string | undefined;
|
|
45363
45365
|
index: number;
|
|
45366
|
+
signature?: string;
|
|
45367
|
+
signerConsAddr?: string;
|
|
45364
45368
|
};
|
|
45365
45369
|
type WinnerDTO = {
|
|
45366
45370
|
address: string;
|
|
@@ -45388,6 +45392,7 @@ type PlayerDTO = {
|
|
|
45388
45392
|
timeout: number;
|
|
45389
45393
|
sitInMethod?: SitInMethod;
|
|
45390
45394
|
pendingSitOut?: string;
|
|
45395
|
+
pendingTopUpAmount?: string;
|
|
45391
45396
|
signature: string;
|
|
45392
45397
|
};
|
|
45393
45398
|
type ResultDTO = {
|
|
@@ -46407,6 +46412,18 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
46407
46412
|
* Only the game creator can delete a game, and the game must have no active players
|
|
46408
46413
|
*/
|
|
46409
46414
|
deleteGame(gameId: string): Promise<string>;
|
|
46415
|
+
/**
|
|
46416
|
+
* Force-close a poker game and refund every seated player.
|
|
46417
|
+
*
|
|
46418
|
+
* Only the table creator can invoke this. Distinct from `deleteGame()`:
|
|
46419
|
+
* `deleteGame` requires zero players, this kicks everyone off and refunds
|
|
46420
|
+
* their stacks (plus any current-hand contribution and queued top-up) to
|
|
46421
|
+
* their wallet, then deletes the table.
|
|
46422
|
+
*
|
|
46423
|
+
* Cash format only. Chain rejects SNG/Tournament — those have separate
|
|
46424
|
+
* cancellation semantics (see block52/poker-vm#2173).
|
|
46425
|
+
*/
|
|
46426
|
+
forceCloseGame(gameId: string): Promise<string>;
|
|
46410
46427
|
/**
|
|
46411
46428
|
* Perform a game action (fold, call, raise, etc.)
|
|
46412
46429
|
* 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
|