@block52/poker-vm-sdk 1.2.8 → 1.2.9

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
@@ -3242,7 +3242,7 @@ const MsgJoinGame = {
3242
3242
  },
3243
3243
  };
3244
3244
  function createBaseMsgLeaveGame() {
3245
- return { creator: "", gameId: "" };
3245
+ return { creator: "", gameId: "", finishingOrder: [] };
3246
3246
  }
3247
3247
  const MsgLeaveGame = {
3248
3248
  encode(message, writer = new BinaryWriter()) {
@@ -3252,6 +3252,9 @@ const MsgLeaveGame = {
3252
3252
  if (message.gameId !== "") {
3253
3253
  writer.uint32(18).string(message.gameId);
3254
3254
  }
3255
+ for (const v of message.finishingOrder) {
3256
+ writer.uint32(26).string(v);
3257
+ }
3255
3258
  return writer;
3256
3259
  },
3257
3260
  decode(input, length) {
@@ -3275,6 +3278,13 @@ const MsgLeaveGame = {
3275
3278
  message.gameId = reader.string();
3276
3279
  continue;
3277
3280
  }
3281
+ case 3: {
3282
+ if (tag !== 26) {
3283
+ break;
3284
+ }
3285
+ message.finishingOrder.push(reader.string());
3286
+ continue;
3287
+ }
3278
3288
  }
3279
3289
  if ((tag & 7) === 4 || tag === 0) {
3280
3290
  break;
@@ -3287,6 +3297,9 @@ const MsgLeaveGame = {
3287
3297
  return {
3288
3298
  creator: isSet$2b(object.creator) ? globalThis.String(object.creator) : "",
3289
3299
  gameId: isSet$2b(object.gameId) ? globalThis.String(object.gameId) : "",
3300
+ finishingOrder: globalThis.Array.isArray(object?.finishingOrder)
3301
+ ? object.finishingOrder.map((e) => globalThis.String(e))
3302
+ : [],
3290
3303
  };
3291
3304
  },
3292
3305
  toJSON(message) {
@@ -3297,6 +3310,9 @@ const MsgLeaveGame = {
3297
3310
  if (message.gameId !== "") {
3298
3311
  obj.gameId = message.gameId;
3299
3312
  }
3313
+ if (message.finishingOrder?.length) {
3314
+ obj.finishingOrder = message.finishingOrder;
3315
+ }
3300
3316
  return obj;
3301
3317
  },
3302
3318
  create(base) {
@@ -3306,6 +3322,7 @@ const MsgLeaveGame = {
3306
3322
  const message = createBaseMsgLeaveGame();
3307
3323
  message.creator = object.creator ?? "";
3308
3324
  message.gameId = object.gameId ?? "";
3325
+ message.finishingOrder = object.finishingOrder?.map((e) => e) || [];
3309
3326
  return message;
3310
3327
  },
3311
3328
  };
@@ -61253,17 +61270,26 @@ class SigningCosmosClient extends CosmosClient {
61253
61270
  return this.signMsgOnly(msg, "Join poker game (relay)", signerData);
61254
61271
  }
61255
61272
  /**
61256
- * Sign-only MsgLeaveGame (no broadcast) the chain decides the refund
61257
- * from its own state; the message carries only {creator, gameId}. (#2325)
61273
+ * Sign-only MsgLeaveGame (no broadcast). For cash games and SNGs the chain
61274
+ * already finalized, the chain decides the refund from its own state and
61275
+ * the message carries only {creator, gameId}. (#2325)
61276
+ *
61277
+ * For an SNG that finalized off-chain (WS-first money-movers — the gateway
61278
+ * never relays the tournament-ending gameplay action, so the chain's
61279
+ * Results are empty), pass `finishingOrder`: the place-1-first list of
61280
+ * player addresses. The chain validates the ordering and recomputes the
61281
+ * payouts from its own prize-pool math — this message supplies only the
61282
+ * ORDER, never any amount. (pokerchain#229)
61258
61283
  */
61259
- async signLeaveGame(gameId, signerData) {
61284
+ async signLeaveGame(gameId, signerData, finishingOrder = []) {
61260
61285
  await this.initializeSigningClient();
61261
61286
  const [account] = await this.wallet.getAccounts();
61262
61287
  const msg = {
61263
61288
  typeUrl: "/pokerchain.poker.v1.MsgLeaveGame",
61264
61289
  value: {
61265
61290
  creator: account.address,
61266
- gameId
61291
+ gameId,
61292
+ finishingOrder
61267
61293
  }
61268
61294
  };
61269
61295
  return this.signMsgOnly(msg, "Leave poker game (relay)", signerData);