@block52/poker-vm-sdk 1.2.10 → 1.2.13
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 +36 -3
- package/dist/index.esm.js +131 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +131 -6
- 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 +25 -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],
|
|
@@ -55941,17 +56025,27 @@ exports.PlayerActionType = void 0;
|
|
|
55941
56025
|
PlayerActionType["BET"] = "bet";
|
|
55942
56026
|
PlayerActionType["CALL"] = "call";
|
|
55943
56027
|
PlayerActionType["RAISE"] = "raise";
|
|
56028
|
+
/**
|
|
56029
|
+
* @deprecated Not a dispatchable action. "All-in" is a UX label — going
|
|
56030
|
+
* all-in is a BET/CALL/RAISE whose amount equals the player's whole stack
|
|
56031
|
+
* (a short shove is an all-in-only RAISE, poker-vm#2353). The engine neither
|
|
56032
|
+
* advertises ALL_IN in getLegalActions nor accepts it via performAction (the
|
|
56033
|
+
* handler was removed, poker-vm#2353) — dispatching it throws.
|
|
56034
|
+
*
|
|
56035
|
+
* This member survives ONLY as the internal *recorded* action type:
|
|
56036
|
+
* baseAction.execute rewrites a full-stack commit to ALL_IN, and round-end
|
|
56037
|
+
* reopening + aggression detection (#2134) read it. Do not dispatch it and do
|
|
56038
|
+
* not add new consumers.
|
|
56039
|
+
*
|
|
56040
|
+
* NOTE: distinct from the still-required `PlayerStatus.ALL_IN` (a player's
|
|
56041
|
+
* state once their chips reach 0), which is NOT deprecated.
|
|
56042
|
+
*/
|
|
55944
56043
|
PlayerActionType["ALL_IN"] = "all-in";
|
|
55945
56044
|
PlayerActionType["MUCK"] = "muck";
|
|
55946
56045
|
PlayerActionType["SHOW"] = "show";
|
|
55947
56046
|
})(exports.PlayerActionType || (exports.PlayerActionType = {}));
|
|
55948
56047
|
exports.NonPlayerActionType = void 0;
|
|
55949
56048
|
(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
56049
|
NonPlayerActionType["DEAD_SMALL_BLIND"] = "dead-small-blind";
|
|
55956
56050
|
NonPlayerActionType["DEAL"] = "deal";
|
|
55957
56051
|
NonPlayerActionType["FORCE_CLOSE"] = "force-close";
|
|
@@ -60841,7 +60935,7 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
60841
60935
|
// SNG/Tournament games are DEFINED by startingStack + blindLevelDuration.
|
|
60842
60936
|
// Refuse to create one with missing/zero values rather than silently
|
|
60843
60937
|
// defaulting (Long.UZERO / 0) — a zero startingStack makes the prize pool
|
|
60844
|
-
// zero (
|
|
60938
|
+
// zero (SngPayoutManager.totalPrizePool = startingStack * runners) and pays
|
|
60845
60939
|
// the winner $0; a zero blindLevelDuration breaks blind escalation.
|
|
60846
60940
|
// No defaults — fail loud at creation (Commandment #7). (#2282)
|
|
60847
60941
|
const isSng = gameFormat === exports.GameFormat.SIT_AND_GO || gameFormat === exports.GameFormat.TOURNAMENT;
|
|
@@ -60993,6 +61087,37 @@ class SigningCosmosClient extends CosmosClient {
|
|
|
60993
61087
|
throw error;
|
|
60994
61088
|
}
|
|
60995
61089
|
}
|
|
61090
|
+
/**
|
|
61091
|
+
* Record a hand-end game-state snapshot on the chain (pokerchain#239).
|
|
61092
|
+
*
|
|
61093
|
+
* Signed and broadcast directly by the player who finished the position
|
|
61094
|
+
* being recorded (e.g. the 4th-place finisher pushes the state that records
|
|
61095
|
+
* 4th place), so a finished SNG's results reach the chain and the prize pool
|
|
61096
|
+
* becomes claimable. `gameState` is the hand-end TexasHoldemStateDTO,
|
|
61097
|
+
* JSON-encoded (the canonical shape the chain stores in GameStates).
|
|
61098
|
+
*/
|
|
61099
|
+
async recordHandEnd(gameId, gameState) {
|
|
61100
|
+
await this.initializeSigningClient();
|
|
61101
|
+
if (!this.signingClient || !this.wallet) {
|
|
61102
|
+
throw new Error("Signing client not initialized");
|
|
61103
|
+
}
|
|
61104
|
+
const [account] = await this.wallet.getAccounts();
|
|
61105
|
+
const creator = account.address;
|
|
61106
|
+
const msg = {
|
|
61107
|
+
typeUrl: "/pokerchain.poker.v1.MsgRecordHandEnd",
|
|
61108
|
+
value: { creator, gameId, gameState }
|
|
61109
|
+
};
|
|
61110
|
+
const fee = gaslessFee();
|
|
61111
|
+
const memo = "Record hand end via SDK";
|
|
61112
|
+
try {
|
|
61113
|
+
const result = await this.signingClient.signAndBroadcast(creator, [msg], fee, memo);
|
|
61114
|
+
return result.transactionHash;
|
|
61115
|
+
}
|
|
61116
|
+
catch (error) {
|
|
61117
|
+
console.error("❌ Record hand end failed:", error);
|
|
61118
|
+
throw error;
|
|
61119
|
+
}
|
|
61120
|
+
}
|
|
60996
61121
|
/**
|
|
60997
61122
|
* Delete a poker game
|
|
60998
61123
|
* Only the game creator can delete a game, and the game must have no active players
|