@dimcool/dimclaw 0.1.13 → 0.1.14

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 (3) hide show
  1. package/dist/index.js +38 -30
  2. package/index.ts +2 -1
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -53700,6 +53700,27 @@ var VoteAccountLayout2 = BufferLayout2.struct([
53700
53700
  BufferLayout2.seq(BufferLayout2.struct([BufferLayout2.nu64("epoch"), BufferLayout2.nu64("credits"), BufferLayout2.nu64("prevCredits")]), BufferLayout2.offset(BufferLayout2.u32(), -8), "epochCredits"),
53701
53701
  BufferLayout2.struct([BufferLayout2.nu64("slot"), BufferLayout2.nu64("timestamp")], "lastTimestamp")
53702
53702
  ]);
53703
+ function base64ToBytes(base64) {
53704
+ if (typeof Buffer !== "undefined") {
53705
+ return Buffer.from(base64, "base64");
53706
+ }
53707
+ const binary = atob(base64);
53708
+ const bytes = new Uint8Array(binary.length);
53709
+ for (let i = 0; i < binary.length; i++) {
53710
+ bytes[i] = binary.charCodeAt(i);
53711
+ }
53712
+ return bytes;
53713
+ }
53714
+ function bytesToBase64(bytes) {
53715
+ if (typeof Buffer !== "undefined") {
53716
+ return Buffer.from(bytes).toString("base64");
53717
+ }
53718
+ let binary = "";
53719
+ for (let i = 0; i < bytes.length; i++) {
53720
+ binary += String.fromCharCode(bytes[i]);
53721
+ }
53722
+ return btoa(binary);
53723
+ }
53703
53724
  var HttpClient = class {
53704
53725
  constructor(baseUrl, storage, logger2, appId, autoPayConfig) {
53705
53726
  this.baseUrl = baseUrl.replace(/\/$/, "");
@@ -53971,11 +53992,11 @@ var HttpClient = class {
53971
53992
  }
53972
53993
  }
53973
53994
  );
53974
- const unsignedTx = Transaction2.from(
53975
- Buffer.from(prepare.transaction, "base64")
53976
- );
53995
+ const unsignedTx = Transaction2.from(base64ToBytes(prepare.transaction));
53977
53996
  const signedTx = await this.signTransactionHandler(unsignedTx);
53978
- const signedTransaction = signedTx.serialize({ requireAllSignatures: false }).toString("base64");
53997
+ const signedTransaction = bytesToBase64(
53998
+ signedTx.serialize({ requireAllSignatures: false })
53999
+ );
53979
54000
  const submitted = await this.post(
53980
54001
  "/payments/submit",
53981
54002
  {
@@ -53989,19 +54010,6 @@ var HttpClient = class {
53989
54010
  return submitted.paymentProof;
53990
54011
  }
53991
54012
  };
53992
- function toBase64(bytes) {
53993
- if (typeof Buffer !== "undefined") {
53994
- return Buffer.from(bytes).toString("base64");
53995
- }
53996
- let binary = "";
53997
- for (let i = 0; i < bytes.length; i++) {
53998
- binary += String.fromCharCode(bytes[i]);
53999
- }
54000
- if (typeof btoa === "undefined") {
54001
- throw new Error("Base64 encoding is not available in this environment");
54002
- }
54003
- return btoa(binary);
54004
- }
54005
54013
  var Auth = class {
54006
54014
  constructor(http22, storage, wallet, logger2) {
54007
54015
  this.http = http22;
@@ -54066,7 +54074,7 @@ var Auth = class {
54066
54074
  }
54067
54075
  const { message } = await this.generateHandshake(address);
54068
54076
  const signatureResult = await this.wallet.signMessage(message);
54069
- const signedMessage = typeof signatureResult === "string" ? signatureResult : toBase64(signatureResult);
54077
+ const signedMessage = typeof signatureResult === "string" ? signatureResult : bytesToBase64(signatureResult);
54070
54078
  this.logger.debug("Auth.loginWithWallet called", {
54071
54079
  address,
54072
54080
  walletMeta: options?.walletMeta
@@ -54540,11 +54548,11 @@ var Games = class {
54540
54548
  );
54541
54549
  }
54542
54550
  const prepared = await this.prepareGameDonation(gameId, amountMinor);
54543
- const unsignedTx = Transaction2.from(
54544
- Buffer.from(prepared.transaction, "base64")
54545
- );
54551
+ const unsignedTx = Transaction2.from(base64ToBytes(prepared.transaction));
54546
54552
  const signedTx = await this.wallet.signTransaction(unsignedTx);
54547
- const signedTransaction = signedTx.serialize({ requireAllSignatures: false }).toString("base64");
54553
+ const signedTransaction = bytesToBase64(
54554
+ signedTx.serialize({ requireAllSignatures: false })
54555
+ );
54548
54556
  const result = await this.donateToGame(
54549
54557
  gameId,
54550
54558
  amountMinor,
@@ -54812,11 +54820,11 @@ var Tips = class {
54812
54820
  }
54813
54821
  const { publicKey: senderAddress } = await this.wallet.loadWallet();
54814
54822
  const prepared = await this.prepare({ recipientUsername, amount });
54815
- const unsignedTx = Transaction2.from(
54816
- Buffer.from(prepared.transaction, "base64")
54817
- );
54823
+ const unsignedTx = Transaction2.from(base64ToBytes(prepared.transaction));
54818
54824
  const signedTx = await this.wallet.signTransaction(unsignedTx);
54819
- const signedTxBase64 = signedTx.serialize({ requireAllSignatures: false }).toString("base64");
54825
+ const signedTxBase64 = bytesToBase64(
54826
+ signedTx.serialize({ requireAllSignatures: false })
54827
+ );
54820
54828
  const transfer = await this.wallet.submitTransfer(
54821
54829
  signedTxBase64,
54822
54830
  senderAddress,
@@ -55181,11 +55189,11 @@ var Wallet = class {
55181
55189
  amount,
55182
55190
  token
55183
55191
  );
55184
- const unsignedTx = Transaction2.from(
55185
- Buffer.from(prepared.transaction, "base64")
55186
- );
55192
+ const unsignedTx = Transaction2.from(base64ToBytes(prepared.transaction));
55187
55193
  const signedTx = await this.signTransaction(unsignedTx);
55188
- const signedTxBase64 = signedTx.serialize({ requireAllSignatures: false }).toString("base64");
55194
+ const signedTxBase64 = bytesToBase64(
55195
+ signedTx.serialize({ requireAllSignatures: false })
55196
+ );
55189
55197
  const submitted = await this.submitTransfer(
55190
55198
  signedTxBase64,
55191
55199
  senderAddress,
package/index.ts CHANGED
@@ -345,7 +345,8 @@ export default function register(api: {
345
345
  },
346
346
  {
347
347
  name: 'dim_join_queue',
348
- description: 'Join matchmaking queue. If not matched immediately, poll dim_get_lobby until gameId appears.',
348
+ description:
349
+ 'Join matchmaking queue. If not matched immediately, poll dim_get_lobby until gameId appears.',
349
350
  },
350
351
  { name: 'dim_get_lobby', description: 'Get lobby details by ID.' },
351
352
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimcool/dimclaw",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
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": {