@dimcool/dimclaw 0.1.31 → 0.1.32

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -116
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32218,7 +32218,7 @@ var require_money = __commonJS2({
32218
32218
  "../utils/dist/money.js"(exports) {
32219
32219
  "use strict";
32220
32220
  Object.defineProperty(exports, "__esModule", { value: true });
32221
- exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
32221
+ exports.SOL_MINT = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
32222
32222
  exports.isSolMint = isSolMint;
32223
32223
  exports.formatMoneyMinor = formatMoneyMinor2;
32224
32224
  exports.toMajor = toMajor2;
@@ -32231,12 +32231,12 @@ var require_money = __commonJS2({
32231
32231
  exports.formatMoneyMinorCompact = formatMoneyMinorCompact;
32232
32232
  exports.MICRO_UNITS = 1e6;
32233
32233
  exports.SOL_LAMPORTS = 1e9;
32234
- var SOL_MINT_LABEL = "SOL";
32234
+ exports.SOL_MINT = "SOL";
32235
32235
  var SOL_SYSTEM_PROGRAM = "11111111111111111111111111111111";
32236
32236
  function isSolMint(mint) {
32237
32237
  if (!mint)
32238
32238
  return false;
32239
- return mint === SOL_MINT_LABEL || mint === SOL_SYSTEM_PROGRAM;
32239
+ return mint === exports.SOL_MINT || mint === SOL_SYSTEM_PROGRAM;
32240
32240
  }
32241
32241
  function formatMoneyMinor2(amountMinor, fractionDigits = 2) {
32242
32242
  return (amountMinor / exports.MICRO_UNITS).toFixed(fractionDigits);
@@ -32340,7 +32340,7 @@ var require_dist = __commonJS2({
32340
32340
  "../utils/dist/index.js"(exports) {
32341
32341
  "use strict";
32342
32342
  Object.defineProperty(exports, "__esModule", { value: true });
32343
- exports.formatMoneyMinorCompact = exports.formatCurrencyPartsForToken = exports.formatCurrencyParts = exports.kformatMoney = exports.kformat = exports.formatSolMinor = exports.toSolMajor = exports.toMajor = exports.formatMoneyMinor = exports.isSolMint = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
32343
+ exports.formatMoneyMinorCompact = exports.formatCurrencyPartsForToken = exports.formatCurrencyParts = exports.kformatMoney = exports.kformat = exports.formatSolMinor = exports.toSolMajor = exports.toMajor = exports.formatMoneyMinor = exports.isSolMint = exports.SOL_MINT = exports.SOL_LAMPORTS = exports.MICRO_UNITS = void 0;
32344
32344
  var money_1 = require_money();
32345
32345
  Object.defineProperty(exports, "MICRO_UNITS", { enumerable: true, get: function() {
32346
32346
  return money_1.MICRO_UNITS;
@@ -32348,6 +32348,9 @@ var require_dist = __commonJS2({
32348
32348
  Object.defineProperty(exports, "SOL_LAMPORTS", { enumerable: true, get: function() {
32349
32349
  return money_1.SOL_LAMPORTS;
32350
32350
  } });
32351
+ Object.defineProperty(exports, "SOL_MINT", { enumerable: true, get: function() {
32352
+ return money_1.SOL_MINT;
32353
+ } });
32351
32354
  Object.defineProperty(exports, "isSolMint", { enumerable: true, get: function() {
32352
32355
  return money_1.isSolMint;
32353
32356
  } });
@@ -33238,6 +33241,13 @@ var Lobbies = class {
33238
33241
  setLobbyStore(store) {
33239
33242
  this.lobbyStore = store;
33240
33243
  }
33244
+ /**
33245
+ * Create a new game lobby.
33246
+ *
33247
+ * **Important:** Creating a lobby automatically closes and refunds any
33248
+ * existing open or queued lobby for this user. You do not need to manually
33249
+ * leave or cancel a previous lobby before calling this.
33250
+ */
33241
33251
  async createLobby(gameType, betAmount) {
33242
33252
  return this.http.post("/lobbies", { gameType, betAmount });
33243
33253
  }
@@ -33301,21 +33311,6 @@ var Lobbies = class {
33301
33311
  async deleteLobby(lobbyId) {
33302
33312
  return this.http.delete(`/lobbies/admin/${lobbyId}`);
33303
33313
  }
33304
- /**
33305
- * Play again: Create a new lobby and prepare deposit in one flow.
33306
- * Returns the lobby and unsigned transaction that needs to be signed.
33307
- * @param gameType - The game type to play again
33308
- * @param betAmount - The bet amount (same as previous game)
33309
- * @param escrow - The escrow service instance (from sdk.escrow)
33310
- */
33311
- async playAgain(gameType, betAmount, escrow) {
33312
- const lobby = await this.createLobby(gameType, betAmount);
33313
- const { transaction } = await escrow.prepareAndStartDeposit(lobby.id);
33314
- return {
33315
- lobby,
33316
- unsignedTransaction: transaction
33317
- };
33318
- }
33319
33314
  };
33320
33315
  var Games = class {
33321
33316
  constructor(http2, wallet, logger2) {
@@ -33835,6 +33830,7 @@ var Achievements = class {
33835
33830
  return this.http.get(`/achievements/users/${userId}`);
33836
33831
  }
33837
33832
  };
33833
+ var import_utils14 = __toESM2(require_dist(), 1);
33838
33834
  var MIN_TRANSFER_AMOUNT = 5e4;
33839
33835
  var MIN_SOL_TRANSFER_AMOUNT = 1e6;
33840
33836
  var Wallet = class {
@@ -36794,10 +36790,11 @@ var SDK = class {
36794
36790
  return { ...result, lobby };
36795
36791
  }
36796
36792
  };
36797
- var import_utils14 = __toESM2(require_dist(), 1);
36798
- var export_MICRO_UNITS = import_utils14.MICRO_UNITS;
36799
- var export_formatMoneyMinor = import_utils14.formatMoneyMinor;
36800
- var export_toMajor = import_utils14.toMajor;
36793
+ var import_utils22 = __toESM2(require_dist(), 1);
36794
+ var export_MICRO_UNITS = import_utils22.MICRO_UNITS;
36795
+ var export_SOL_MINT = import_utils14.SOL_MINT;
36796
+ var export_formatMoneyMinor = import_utils22.formatMoneyMinor;
36797
+ var export_toMajor = import_utils22.toMajor;
36801
36798
 
36802
36799
  // ../dim-agent-core/node_modules/bs58/node_modules/base-x/src/esm/index.js
36803
36800
  function base2(ALPHABET3) {
@@ -38503,58 +38500,6 @@ function raceTimeout(promise, ms) {
38503
38500
  });
38504
38501
  }
38505
38502
 
38506
- // ../dim-agent-core/src/tools/challenges.ts
38507
- async function challengeUser(client, args) {
38508
- try {
38509
- if (!args.targetUsername && !args.targetUserId) {
38510
- return {
38511
- error: "Must provide either targetUsername or targetUserId.",
38512
- isError: true
38513
- };
38514
- }
38515
- const spendErr = client.checkSpendLimit(args.amount, true);
38516
- if (spendErr) return { error: spendErr, isError: true };
38517
- const amountMinor = Math.round(args.amount * 1e6);
38518
- const result = await client.sdk.challenges.create({
38519
- gameType: args.gameType,
38520
- amount: amountMinor,
38521
- targetUsername: args.targetUsername,
38522
- targetUserId: args.targetUserId
38523
- });
38524
- client.recordSpend(amountMinor);
38525
- return {
38526
- data: {
38527
- ...result,
38528
- amountFormatted: `$${args.amount.toFixed(2)}`,
38529
- hint: "The challenged user will receive a notification. When they accept, a lobby is created automatically."
38530
- }
38531
- };
38532
- } catch (error) {
38533
- return {
38534
- error: `Failed to create challenge: ${error instanceof Error ? error.message : String(error)}`,
38535
- isError: true
38536
- };
38537
- }
38538
- }
38539
- async function acceptChallenge(client, args) {
38540
- try {
38541
- const result = await client.sdk.challenges.accept(args.challengeId);
38542
- const spectateUrl = result.gameId ? await getSpectateUrl(client) : null;
38543
- return {
38544
- data: {
38545
- ...result,
38546
- ...spectateUrl && { spectateUrl },
38547
- hint: result.gameId ? `Game started! Call dim_game_loop with gameId "${result.gameId}".${spectateUrl ? ` Tell the user they can spectate at ${spectateUrl}` : ""}` : `Lobby created: ${result.lobbyId}. Use dim_join_queue to start matchmaking.`
38548
- }
38549
- };
38550
- } catch (error) {
38551
- return {
38552
- error: `Failed to accept challenge: ${error instanceof Error ? error.message : String(error)}`,
38553
- isError: true
38554
- };
38555
- }
38556
- }
38557
-
38558
38503
  // ../dim-agent-core/src/tools/referrals.ts
38559
38504
  async function getReferralSummary(client) {
38560
38505
  try {
@@ -39964,7 +39909,7 @@ var TOOL_DEFINITIONS = [
39964
39909
  },
39965
39910
  {
39966
39911
  name: "dim_create_lobby",
39967
- description: "Create a new game lobby. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player.",
39912
+ description: "Create a new game lobby. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player. NOTE: Creating a lobby automatically closes and refunds any previous open or queued lobby for this user \u2014 you do not need to clean up manually.",
39968
39913
  params: {
39969
39914
  gameType: {
39970
39915
  type: "string",
@@ -40178,45 +40123,6 @@ var TOOL_DEFINITIONS = [
40178
40123
  },
40179
40124
  execute: (c, a) => inviteToLobby(c, a)
40180
40125
  },
40181
- // ── Challenges ───────────────────────────────────────────────────────
40182
- {
40183
- name: "dim_challenge_user",
40184
- description: "Challenge a specific user to a game. This is the best way to invite someone you are chatting with \u2014 they get a notification and can accept directly. Prefer this over creating a lobby when you know who you want to play. Amount must be between $1 and $1000.",
40185
- params: {
40186
- gameType: { type: "string", description: "Game type", required: true },
40187
- amount: {
40188
- type: "number",
40189
- description: "Challenge amount in USDC dollars",
40190
- required: true,
40191
- min: 1,
40192
- max: 1e3
40193
- },
40194
- targetUsername: {
40195
- type: "string",
40196
- description: "Username of the user to challenge"
40197
- },
40198
- targetUserId: {
40199
- type: "string",
40200
- description: "User ID of the user to challenge"
40201
- }
40202
- },
40203
- execute: (c, a) => challengeUser(
40204
- c,
40205
- a
40206
- )
40207
- },
40208
- {
40209
- name: "dim_accept_challenge",
40210
- description: "Accept a challenge that was sent to you.",
40211
- params: {
40212
- challengeId: {
40213
- type: "string",
40214
- description: "The challenge ID to accept",
40215
- required: true
40216
- }
40217
- },
40218
- execute: (c, a) => acceptChallenge(c, a)
40219
- },
40220
40126
  // ── Referrals ────────────────────────────────────────────────────────
40221
40127
  {
40222
40128
  name: "dim_get_referral_summary",
@@ -40489,7 +40395,7 @@ var TOOL_DEFINITIONS = [
40489
40395
  // ── Notifications & Events ───────────────────────────────────────────
40490
40396
  {
40491
40397
  name: "dim_get_pending_events",
40492
- description: "Drain buffered real-time events (DMs, challenges, game turns, match notifications). Call regularly to stay aware.",
40398
+ description: "Drain buffered real-time events (DMs, game turns, match notifications). Call regularly to stay aware.",
40493
40399
  params: {},
40494
40400
  execute: (c) => getPendingEvents(c)
40495
40401
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimcool/dimclaw",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "OpenClaw plugin for DIM — play games, chat, send USDC, and earn on DIM using the SDK directly (no MCP subprocess).",
5
5
  "type": "module",
6
6
  "openclaw": {