@block52/poker-vm-sdk 1.2.10 → 1.2.12
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 +10 -2
- package/dist/index.esm.js +115 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +115 -5
- package/dist/index.js.map +1 -1
- package/dist/pokerchain.poker.v1/registry.d.ts.map +1 -1
- package/dist/pokerchain.poker.v1/types/pokerchain/poker/v1/tx.d.ts +17 -0
- package/dist/pokerchain.poker.v1/types/pokerchain/poker/v1/tx.d.ts.map +1 -1
- package/dist/signingClient.d.ts +10 -0
- package/dist/signingClient.d.ts.map +1 -1
- package/dist/types/game.d.ts +0 -2
- package/dist/types/game.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -45218,7 +45218,6 @@ declare enum PlayerActionType {
|
|
|
45218
45218
|
SHOW = "show"
|
|
45219
45219
|
}
|
|
45220
45220
|
declare enum NonPlayerActionType {
|
|
45221
|
-
CLAIM = "claim",
|
|
45222
45221
|
DEAD_SMALL_BLIND = "dead-small-blind",
|
|
45223
45222
|
DEAL = "deal",
|
|
45224
45223
|
FORCE_CLOSE = "force-close",
|
|
@@ -45231,7 +45230,6 @@ declare enum NonPlayerActionType {
|
|
|
45231
45230
|
TOP_UP = "top-up"
|
|
45232
45231
|
}
|
|
45233
45232
|
declare const AllPlayerActions: {
|
|
45234
|
-
CLAIM: NonPlayerActionType.CLAIM;
|
|
45235
45233
|
DEAD_SMALL_BLIND: NonPlayerActionType.DEAD_SMALL_BLIND;
|
|
45236
45234
|
DEAL: NonPlayerActionType.DEAL;
|
|
45237
45235
|
FORCE_CLOSE: NonPlayerActionType.FORCE_CLOSE;
|
|
@@ -46422,6 +46420,16 @@ declare class SigningCosmosClient extends CosmosClient {
|
|
|
46422
46420
|
* Leave a poker game
|
|
46423
46421
|
*/
|
|
46424
46422
|
leaveGame(gameId: string): Promise<string>;
|
|
46423
|
+
/**
|
|
46424
|
+
* Record a hand-end game-state snapshot on the chain (pokerchain#239).
|
|
46425
|
+
*
|
|
46426
|
+
* Signed and broadcast directly by the player who finished the position
|
|
46427
|
+
* being recorded (e.g. the 4th-place finisher pushes the state that records
|
|
46428
|
+
* 4th place), so a finished SNG's results reach the chain and the prize pool
|
|
46429
|
+
* becomes claimable. `gameState` is the hand-end TexasHoldemStateDTO,
|
|
46430
|
+
* JSON-encoded (the canonical shape the chain stores in GameStates).
|
|
46431
|
+
*/
|
|
46432
|
+
recordHandEnd(gameId: string, gameState: string): Promise<string>;
|
|
46425
46433
|
/**
|
|
46426
46434
|
* Delete a poker game
|
|
46427
46435
|
* Only the game creator can delete a game, and the game must have no active players
|
package/dist/index.esm.js
CHANGED
|
@@ -3324,6 +3324,89 @@ const MsgLeaveGame = {
|
|
|
3324
3324
|
return message;
|
|
3325
3325
|
},
|
|
3326
3326
|
};
|
|
3327
|
+
function createBaseMsgRecordHandEnd() {
|
|
3328
|
+
return { creator: "", gameId: "", gameState: "" };
|
|
3329
|
+
}
|
|
3330
|
+
const MsgRecordHandEnd = {
|
|
3331
|
+
encode(message, writer = new BinaryWriter()) {
|
|
3332
|
+
if (message.creator !== "") {
|
|
3333
|
+
writer.uint32(10).string(message.creator);
|
|
3334
|
+
}
|
|
3335
|
+
if (message.gameId !== "") {
|
|
3336
|
+
writer.uint32(18).string(message.gameId);
|
|
3337
|
+
}
|
|
3338
|
+
if (message.gameState !== "") {
|
|
3339
|
+
writer.uint32(26).string(message.gameState);
|
|
3340
|
+
}
|
|
3341
|
+
return writer;
|
|
3342
|
+
},
|
|
3343
|
+
decode(input, length) {
|
|
3344
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
3345
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
3346
|
+
const message = createBaseMsgRecordHandEnd();
|
|
3347
|
+
while (reader.pos < end) {
|
|
3348
|
+
const tag = reader.uint32();
|
|
3349
|
+
switch (tag >>> 3) {
|
|
3350
|
+
case 1: {
|
|
3351
|
+
if (tag !== 10) {
|
|
3352
|
+
break;
|
|
3353
|
+
}
|
|
3354
|
+
message.creator = reader.string();
|
|
3355
|
+
continue;
|
|
3356
|
+
}
|
|
3357
|
+
case 2: {
|
|
3358
|
+
if (tag !== 18) {
|
|
3359
|
+
break;
|
|
3360
|
+
}
|
|
3361
|
+
message.gameId = reader.string();
|
|
3362
|
+
continue;
|
|
3363
|
+
}
|
|
3364
|
+
case 3: {
|
|
3365
|
+
if (tag !== 26) {
|
|
3366
|
+
break;
|
|
3367
|
+
}
|
|
3368
|
+
message.gameState = reader.string();
|
|
3369
|
+
continue;
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3373
|
+
break;
|
|
3374
|
+
}
|
|
3375
|
+
reader.skip(tag & 7);
|
|
3376
|
+
}
|
|
3377
|
+
return message;
|
|
3378
|
+
},
|
|
3379
|
+
fromJSON(object) {
|
|
3380
|
+
return {
|
|
3381
|
+
creator: isSet$2b(object.creator) ? globalThis.String(object.creator) : "",
|
|
3382
|
+
gameId: isSet$2b(object.gameId) ? globalThis.String(object.gameId) : "",
|
|
3383
|
+
gameState: isSet$2b(object.gameState) ? globalThis.String(object.gameState) : "",
|
|
3384
|
+
};
|
|
3385
|
+
},
|
|
3386
|
+
toJSON(message) {
|
|
3387
|
+
const obj = {};
|
|
3388
|
+
if (message.creator !== "") {
|
|
3389
|
+
obj.creator = message.creator;
|
|
3390
|
+
}
|
|
3391
|
+
if (message.gameId !== "") {
|
|
3392
|
+
obj.gameId = message.gameId;
|
|
3393
|
+
}
|
|
3394
|
+
if (message.gameState !== "") {
|
|
3395
|
+
obj.gameState = message.gameState;
|
|
3396
|
+
}
|
|
3397
|
+
return obj;
|
|
3398
|
+
},
|
|
3399
|
+
create(base) {
|
|
3400
|
+
return MsgRecordHandEnd.fromPartial(base ?? {});
|
|
3401
|
+
},
|
|
3402
|
+
fromPartial(object) {
|
|
3403
|
+
const message = createBaseMsgRecordHandEnd();
|
|
3404
|
+
message.creator = object.creator ?? "";
|
|
3405
|
+
message.gameId = object.gameId ?? "";
|
|
3406
|
+
message.gameState = object.gameState ?? "";
|
|
3407
|
+
return message;
|
|
3408
|
+
},
|
|
3409
|
+
};
|
|
3327
3410
|
function createBaseMsgDealCards() {
|
|
3328
3411
|
return { creator: "", gameId: "" };
|
|
3329
3412
|
}
|
|
@@ -4376,6 +4459,7 @@ const msgTypes$u = [
|
|
|
4376
4459
|
["/pokerchain.poker.v1.MsgCreateGame", MsgCreateGame],
|
|
4377
4460
|
["/pokerchain.poker.v1.MsgJoinGame", MsgJoinGame],
|
|
4378
4461
|
["/pokerchain.poker.v1.MsgLeaveGame", MsgLeaveGame],
|
|
4462
|
+
["/pokerchain.poker.v1.MsgRecordHandEnd", MsgRecordHandEnd],
|
|
4379
4463
|
["/pokerchain.poker.v1.MsgDealCards", MsgDealCards],
|
|
4380
4464
|
["/pokerchain.poker.v1.MsgPerformAction", MsgPerformAction],
|
|
4381
4465
|
["/pokerchain.poker.v1.MsgMint", MsgMint],
|
|
@@ -55945,11 +56029,6 @@ var PlayerActionType;
|
|
|
55945
56029
|
})(PlayerActionType || (PlayerActionType = {}));
|
|
55946
56030
|
var NonPlayerActionType;
|
|
55947
56031
|
(function (NonPlayerActionType) {
|
|
55948
|
-
// Terminal SNG/Tournament settlement: a decided-tournament finisher claims
|
|
55949
|
-
// their prize-pool payout without leaving the (frozen) roster. Replaces the
|
|
55950
|
-
// post-start LEAVE that used to remove the seat and destabilise the terminal
|
|
55951
|
-
// state (#2318/#2184 root cause). (#2343)
|
|
55952
|
-
NonPlayerActionType["CLAIM"] = "claim";
|
|
55953
56032
|
NonPlayerActionType["DEAD_SMALL_BLIND"] = "dead-small-blind";
|
|
55954
56033
|
NonPlayerActionType["DEAL"] = "deal";
|
|
55955
56034
|
NonPlayerActionType["FORCE_CLOSE"] = "force-close";
|
|
@@ -60991,6 +61070,37 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
60991
61070
|
throw error;
|
|
60992
61071
|
}
|
|
60993
61072
|
}
|
|
61073
|
+
/**
|
|
61074
|
+
* Record a hand-end game-state snapshot on the chain (pokerchain#239).
|
|
61075
|
+
*
|
|
61076
|
+
* Signed and broadcast directly by the player who finished the position
|
|
61077
|
+
* being recorded (e.g. the 4th-place finisher pushes the state that records
|
|
61078
|
+
* 4th place), so a finished SNG's results reach the chain and the prize pool
|
|
61079
|
+
* becomes claimable. `gameState` is the hand-end TexasHoldemStateDTO,
|
|
61080
|
+
* JSON-encoded (the canonical shape the chain stores in GameStates).
|
|
61081
|
+
*/
|
|
61082
|
+
async recordHandEnd(gameId, gameState) {
|
|
61083
|
+
await this.initializeSigningClient();
|
|
61084
|
+
if (!this.signingClient || !this.wallet) {
|
|
61085
|
+
throw new Error("Signing client not initialized");
|
|
61086
|
+
}
|
|
61087
|
+
const [account] = await this.wallet.getAccounts();
|
|
61088
|
+
const creator = account.address;
|
|
61089
|
+
const msg = {
|
|
61090
|
+
typeUrl: "/pokerchain.poker.v1.MsgRecordHandEnd",
|
|
61091
|
+
value: { creator, gameId, gameState }
|
|
61092
|
+
};
|
|
61093
|
+
const fee = gaslessFee();
|
|
61094
|
+
const memo = "Record hand end via SDK";
|
|
61095
|
+
try {
|
|
61096
|
+
const result = await this.signingClient.signAndBroadcast(creator, [msg], fee, memo);
|
|
61097
|
+
return result.transactionHash;
|
|
61098
|
+
}
|
|
61099
|
+
catch (error) {
|
|
61100
|
+
console.error("❌ Record hand end failed:", error);
|
|
61101
|
+
throw error;
|
|
61102
|
+
}
|
|
61103
|
+
}
|
|
60994
61104
|
/**
|
|
60995
61105
|
* Delete a poker game
|
|
60996
61106
|
* Only the game creator can delete a game, and the game must have no active players
|