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