@block52/poker-vm-sdk 1.3.5 → 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;
@@ -56222,6 +56238,20 @@ exports.SUIT = void 0;
56222
56238
  SUIT[SUIT["HEARTS"] = 3] = "HEARTS";
56223
56239
  SUIT[SUIT["SPADES"] = 4] = "SPADES";
56224
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;
56225
56255
  // Constants for URL parameters
56226
56256
  const KEYS = {
56227
56257
  ACTION_TYPE: "action_type",
@@ -61227,7 +61257,7 @@ class SigningCosmosClient extends CosmosClient {
61227
61257
  /**
61228
61258
  * Create a new poker game
61229
61259
  */
61230
- 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) {
61231
61261
  // Validate SNG/Tournament config BEFORE any network work — fail fast.
61232
61262
  // SNG/Tournament games are DEFINED by startingStack + blindLevelDuration.
61233
61263
  // Refuse to create one with missing/zero values rather than silently
@@ -61276,6 +61306,9 @@ class SigningCosmosClient extends CosmosClient {
61276
61306
  blindLevelDuration: sngConfig?.blindLevelDuration ?? 0,
61277
61307
  // SNG flat entry fee (micro-units), skimmed to the creator at join time (poker-vm#2118)
61278
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 ?? "",
61279
61312
  });
61280
61313
  // Create the transaction message
61281
61314
  const msg = {
@@ -62218,7 +62251,9 @@ exports.COSMOS_CONSTANTS = COSMOS_CONSTANTS;
62218
62251
  exports.Client = Client;
62219
62252
  exports.CosmosClient = CosmosClient;
62220
62253
  exports.Deck = Deck;
62254
+ exports.GAME_NAME_MICRO_PER_CHAR = GAME_NAME_MICRO_PER_CHAR;
62221
62255
  exports.KEYS = KEYS;
62256
+ exports.MAX_GAME_NAME_LENGTH = MAX_GAME_NAME_LENGTH;
62222
62257
  exports.MissingWalletError = MissingWalletError;
62223
62258
  exports.Params = Params$c;
62224
62259
  exports.PokerGameIntegration = PokerGameIntegration;
@@ -62230,6 +62265,7 @@ exports.SIT_OUT_METHOD_NEXT_HAND = SIT_OUT_METHOD_NEXT_HAND;
62230
62265
  exports.SigningCosmosClient = SigningCosmosClient;
62231
62266
  exports.ValidatorBond = ValidatorBond;
62232
62267
  exports.WithdrawalRequest = WithdrawalRequest;
62268
+ exports.computeGameNameFee = computeGameNameFee;
62233
62269
  exports.createSigningClientFromMnemonic = createSigningClientFromMnemonic;
62234
62270
  exports.createWalletFromMnemonic = createWalletFromMnemonic;
62235
62271
  exports.formatGameFormatDisplay = formatGameFormatDisplay;