@block52/poker-vm-sdk 1.3.4 → 1.4.0

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
@@ -2846,6 +2846,7 @@ function createBaseMsgCreateGame() {
2846
2846
  blindLevelDuration: 0,
2847
2847
  gameVariant: "",
2848
2848
  entryFee: Long.UZERO,
2849
+ name: "",
2849
2850
  };
2850
2851
  }
2851
2852
  const MsgCreateGame = {
@@ -2901,6 +2902,9 @@ const MsgCreateGame = {
2901
2902
  if (!message.entryFee.equals(Long.UZERO)) {
2902
2903
  writer.uint32(136).uint64(message.entryFee.toString());
2903
2904
  }
2905
+ if (message.name !== "") {
2906
+ writer.uint32(154).string(message.name);
2907
+ }
2904
2908
  return writer;
2905
2909
  },
2906
2910
  decode(input, length) {
@@ -3029,6 +3033,13 @@ const MsgCreateGame = {
3029
3033
  message.entryFee = Long.fromString(reader.uint64().toString(), true);
3030
3034
  continue;
3031
3035
  }
3036
+ case 19: {
3037
+ if (tag !== 154) {
3038
+ break;
3039
+ }
3040
+ message.name = reader.string();
3041
+ continue;
3042
+ }
3032
3043
  }
3033
3044
  if ((tag & 7) === 4 || tag === 0) {
3034
3045
  break;
@@ -3056,6 +3067,7 @@ const MsgCreateGame = {
3056
3067
  blindLevelDuration: isSet$2b(object.blindLevelDuration) ? globalThis.Number(object.blindLevelDuration) : 0,
3057
3068
  gameVariant: isSet$2b(object.gameVariant) ? globalThis.String(object.gameVariant) : "",
3058
3069
  entryFee: isSet$2b(object.entryFee) ? Long.fromValue(object.entryFee) : Long.UZERO,
3070
+ name: isSet$2b(object.name) ? globalThis.String(object.name) : "",
3059
3071
  };
3060
3072
  },
3061
3073
  toJSON(message) {
@@ -3111,6 +3123,9 @@ const MsgCreateGame = {
3111
3123
  if (!message.entryFee.equals(Long.UZERO)) {
3112
3124
  obj.entryFee = (message.entryFee || Long.UZERO).toString();
3113
3125
  }
3126
+ if (message.name !== "") {
3127
+ obj.name = message.name;
3128
+ }
3114
3129
  return obj;
3115
3130
  },
3116
3131
  create(base) {
@@ -3154,6 +3169,7 @@ const MsgCreateGame = {
3154
3169
  : Long.UZERO;
3155
3170
  message.blindLevelDuration = object.blindLevelDuration ?? 0;
3156
3171
  message.gameVariant = object.gameVariant ?? "";
3172
+ message.name = object.name ?? "";
3157
3173
  message.entryFee = (object.entryFee !== undefined && object.entryFee !== null)
3158
3174
  ? Long.fromValue(object.entryFee)
3159
3175
  : Long.UZERO;
@@ -8830,6 +8846,76 @@ const WithdrawalRequest = {
8830
8846
  return message;
8831
8847
  },
8832
8848
  };
8849
+ function createBaseValidatorBond() {
8850
+ return { validator: "", bondedUsdc: Long.UZERO };
8851
+ }
8852
+ const ValidatorBond = {
8853
+ encode(message, writer = new BinaryWriter()) {
8854
+ if (message.validator !== "") {
8855
+ writer.uint32(10).string(message.validator);
8856
+ }
8857
+ if (!message.bondedUsdc.equals(Long.UZERO)) {
8858
+ writer.uint32(16).uint64(message.bondedUsdc.toString());
8859
+ }
8860
+ return writer;
8861
+ },
8862
+ decode(input, length) {
8863
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
8864
+ const end = length === undefined ? reader.len : reader.pos + length;
8865
+ const message = createBaseValidatorBond();
8866
+ while (reader.pos < end) {
8867
+ const tag = reader.uint32();
8868
+ switch (tag >>> 3) {
8869
+ case 1: {
8870
+ if (tag !== 10) {
8871
+ break;
8872
+ }
8873
+ message.validator = reader.string();
8874
+ continue;
8875
+ }
8876
+ case 2: {
8877
+ if (tag !== 16) {
8878
+ break;
8879
+ }
8880
+ message.bondedUsdc = Long.fromString(reader.uint64().toString(), true);
8881
+ continue;
8882
+ }
8883
+ }
8884
+ if ((tag & 7) === 4 || tag === 0) {
8885
+ break;
8886
+ }
8887
+ reader.skip(tag & 7);
8888
+ }
8889
+ return message;
8890
+ },
8891
+ fromJSON(object) {
8892
+ return {
8893
+ validator: isSet$2a(object.validator) ? globalThis.String(object.validator) : "",
8894
+ bondedUsdc: isSet$2a(object.bondedUsdc) ? Long.fromValue(object.bondedUsdc) : Long.UZERO,
8895
+ };
8896
+ },
8897
+ toJSON(message) {
8898
+ const obj = {};
8899
+ if (message.validator !== "") {
8900
+ obj.validator = message.validator;
8901
+ }
8902
+ if (!message.bondedUsdc.equals(Long.UZERO)) {
8903
+ obj.bondedUsdc = (message.bondedUsdc || Long.UZERO).toString();
8904
+ }
8905
+ return obj;
8906
+ },
8907
+ create(base) {
8908
+ return ValidatorBond.fromPartial(base ?? {});
8909
+ },
8910
+ fromPartial(object) {
8911
+ const message = createBaseValidatorBond();
8912
+ message.validator = object.validator ?? "";
8913
+ message.bondedUsdc = (object.bondedUsdc !== undefined && object.bondedUsdc !== null)
8914
+ ? Long.fromValue(object.bondedUsdc)
8915
+ : Long.UZERO;
8916
+ return message;
8917
+ },
8918
+ };
8833
8919
  function bytesFromBase64$E(b64) {
8834
8920
  if (globalThis.Buffer) {
8835
8921
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
@@ -56124,6 +56210,12 @@ exports.PlayerStatus = void 0;
56124
56210
  // post the big blind via the normal ante flow. (#2139)
56125
56211
  PlayerStatus["WAITING_FOR_BIG_BLIND"] = "waiting-for-big-blind";
56126
56212
  PlayerStatus["SHOWING"] = "showing";
56213
+ // A player who declined to show a losing hand at showdown. Distinct from
56214
+ // FOLDED (folded during a betting round) so the UI/logs can tell them apart;
56215
+ // excluded from hand evaluation exactly like folded. The engine keeps the
56216
+ // internal status FOLDED and surfaces MUCKED only in the serialized DTO
56217
+ // (poker-vm#2140).
56218
+ PlayerStatus["MUCKED"] = "mucked";
56127
56219
  })(exports.PlayerStatus || (exports.PlayerStatus = {}));
56128
56220
  const SIT_IN_METHOD_NEXT_BB = "next-bb";
56129
56221
  const SIT_IN_METHOD_POST_NOW = "post-now";
@@ -56146,6 +56238,20 @@ exports.SUIT = void 0;
56146
56238
  SUIT[SUIT["HEARTS"] = 3] = "HEARTS";
56147
56239
  SUIT[SUIT["SPADES"] = 4] = "SPADES";
56148
56240
  })(exports.SUIT || (exports.SUIT = {}));
56241
+ /**
56242
+ * Cost of ONE character of a paid table name, in micro-USDC ($0.10). The total
56243
+ * naming fee is `length * GAME_NAME_MICRO_PER_CHAR`, charged on top of the
56244
+ * game-creation cost and paid to validators. This is the SINGLE SOURCE OF TRUTH
56245
+ * for the price so the UI preview and the chain agree. (block52/pokerchain#337)
56246
+ */
56247
+ const GAME_NAME_MICRO_PER_CHAR = 100000n;
56248
+ /** Maximum table-name length (code points); bounds the max fee at 32 * $0.10. */
56249
+ const MAX_GAME_NAME_LENGTH = 32;
56250
+ /**
56251
+ * Total naming fee (micro-USDC) for a table name: $0.10 per character. Counts
56252
+ * code points to match the chain's rune-based charge. An empty name is free.
56253
+ */
56254
+ const computeGameNameFee = (name) => BigInt([...name].length) * GAME_NAME_MICRO_PER_CHAR;
56149
56255
  // Constants for URL parameters
56150
56256
  const KEYS = {
56151
56257
  ACTION_TYPE: "action_type",
@@ -61151,7 +61257,7 @@ class SigningCosmosClient extends CosmosClient {
61151
61257
  /**
61152
61258
  * Create a new poker game
61153
61259
  */
61154
- async createGame(gameFormat, gameVariant, minPlayers, maxPlayers, minBuyInB52USDC, maxBuyInB52USDC, smallBlindB52USDC, bigBlindB52USDC, timeout, rakeConfig, sngConfig) {
61260
+ async createGame(gameFormat, gameVariant, minPlayers, maxPlayers, minBuyInB52USDC, maxBuyInB52USDC, smallBlindB52USDC, bigBlindB52USDC, timeout, rakeConfig, sngConfig, name) {
61155
61261
  // Validate SNG/Tournament config BEFORE any network work — fail fast.
61156
61262
  // SNG/Tournament games are DEFINED by startingStack + blindLevelDuration.
61157
61263
  // Refuse to create one with missing/zero values rather than silently
@@ -61200,6 +61306,9 @@ class SigningCosmosClient extends CosmosClient {
61200
61306
  blindLevelDuration: sngConfig?.blindLevelDuration ?? 0,
61201
61307
  // SNG flat entry fee (micro-units), skimmed to the creator at join time (poker-vm#2118)
61202
61308
  entryFee: sngConfig?.entryFee ? Long.fromString(sngConfig.entryFee.toString(), true) : Long.UZERO,
61309
+ // Optional ENS-style table name (block52/pokerchain#337). Empty = unnamed
61310
+ // (no fee); a non-empty name costs $0.10/char and must be globally unique.
61311
+ name: name ?? "",
61203
61312
  });
61204
61313
  // Create the transaction message
61205
61314
  const msg = {
@@ -62142,7 +62251,9 @@ exports.COSMOS_CONSTANTS = COSMOS_CONSTANTS;
62142
62251
  exports.Client = Client;
62143
62252
  exports.CosmosClient = CosmosClient;
62144
62253
  exports.Deck = Deck;
62254
+ exports.GAME_NAME_MICRO_PER_CHAR = GAME_NAME_MICRO_PER_CHAR;
62145
62255
  exports.KEYS = KEYS;
62256
+ exports.MAX_GAME_NAME_LENGTH = MAX_GAME_NAME_LENGTH;
62146
62257
  exports.MissingWalletError = MissingWalletError;
62147
62258
  exports.Params = Params$c;
62148
62259
  exports.PokerGameIntegration = PokerGameIntegration;
@@ -62152,7 +62263,9 @@ exports.SIT_IN_METHOD_POST_NOW = SIT_IN_METHOD_POST_NOW;
62152
62263
  exports.SIT_OUT_METHOD_NEXT_BB = SIT_OUT_METHOD_NEXT_BB;
62153
62264
  exports.SIT_OUT_METHOD_NEXT_HAND = SIT_OUT_METHOD_NEXT_HAND;
62154
62265
  exports.SigningCosmosClient = SigningCosmosClient;
62266
+ exports.ValidatorBond = ValidatorBond;
62155
62267
  exports.WithdrawalRequest = WithdrawalRequest;
62268
+ exports.computeGameNameFee = computeGameNameFee;
62156
62269
  exports.createSigningClientFromMnemonic = createSigningClientFromMnemonic;
62157
62270
  exports.createWalletFromMnemonic = createWalletFromMnemonic;
62158
62271
  exports.formatGameFormatDisplay = formatGameFormatDisplay;