@blockrun/clawrouter 0.12.27 → 0.12.29

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.d.ts CHANGED
@@ -762,8 +762,6 @@ type WalletResolution = {
762
762
  source: "saved" | "env" | "generated";
763
763
  mnemonic?: string;
764
764
  solanaPrivateKeyBytes?: Uint8Array;
765
- /** Legacy (secp256k1) Solana key bytes, present when migration is needed. */
766
- legacySolanaKeyBytes?: Uint8Array;
767
765
  };
768
766
  /**
769
767
  * Set up Solana wallet for existing EVM-only users.
package/dist/index.js CHANGED
@@ -4214,32 +4214,6 @@ Then run: npx @blockrun/clawrouter`
4214
4214
  solanaPrivateKeyBytes: derived.solanaPrivateKeyBytes
4215
4215
  };
4216
4216
  }
4217
- async function logMigrationWarning(legacyKeyBytes, newKeyBytes) {
4218
- try {
4219
- const { createKeyPairSignerFromPrivateKeyBytes: createKeyPairSignerFromPrivateKeyBytes2 } = await import("@solana/kit");
4220
- const [oldSigner, newSigner] = await Promise.all([
4221
- createKeyPairSignerFromPrivateKeyBytes2(legacyKeyBytes),
4222
- createKeyPairSignerFromPrivateKeyBytes2(newKeyBytes)
4223
- ]);
4224
- console.log(`[ClawRouter]`);
4225
- console.log(`[ClawRouter] \u26A0 SOLANA WALLET MIGRATION DETECTED`);
4226
- console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
4227
- console.log(`[ClawRouter] Old address (secp256k1): ${oldSigner.address}`);
4228
- console.log(`[ClawRouter] New address (SLIP-10): ${newSigner.address}`);
4229
- console.log(`[ClawRouter]`);
4230
- console.log(`[ClawRouter] Your Solana wallet derivation has been fixed to use`);
4231
- console.log(`[ClawRouter] SLIP-10 Ed25519 (Phantom/Solflare compatible).`);
4232
- console.log(`[ClawRouter]`);
4233
- console.log(`[ClawRouter] If you had funds in the old wallet, run:`);
4234
- console.log(`[ClawRouter] /wallet migrate-solana`);
4235
- console.log(`[ClawRouter]`);
4236
- console.log(`[ClawRouter] The new wallet pays gas. Send ~0.005 SOL to:`);
4237
- console.log(`[ClawRouter] ${newSigner.address}`);
4238
- console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
4239
- console.log(`[ClawRouter]`);
4240
- } catch {
4241
- }
4242
- }
4243
4217
  async function resolveOrGenerateWalletKey() {
4244
4218
  const saved = await loadSavedWallet();
4245
4219
  if (saved) {
@@ -4247,19 +4221,13 @@ async function resolveOrGenerateWalletKey() {
4247
4221
  const mnemonic = await loadMnemonic();
4248
4222
  if (mnemonic) {
4249
4223
  const solanaKeyBytes = deriveSolanaKeyBytes(mnemonic);
4250
- const result2 = {
4224
+ return {
4251
4225
  key: saved,
4252
4226
  address: account.address,
4253
4227
  source: "saved",
4254
4228
  mnemonic,
4255
4229
  solanaPrivateKeyBytes: solanaKeyBytes
4256
4230
  };
4257
- const legacyKeyBytes = deriveSolanaKeyBytesLegacy(mnemonic);
4258
- if (Buffer.from(legacyKeyBytes).toString("hex") !== Buffer.from(solanaKeyBytes).toString("hex")) {
4259
- result2.legacySolanaKeyBytes = legacyKeyBytes;
4260
- await logMigrationWarning(legacyKeyBytes, solanaKeyBytes);
4261
- }
4262
- return result2;
4263
4231
  }
4264
4232
  return { key: saved, address: account.address, source: "saved" };
4265
4233
  }
@@ -4269,19 +4237,13 @@ async function resolveOrGenerateWalletKey() {
4269
4237
  const mnemonic = await loadMnemonic();
4270
4238
  if (mnemonic) {
4271
4239
  const solanaKeyBytes = deriveSolanaKeyBytes(mnemonic);
4272
- const result2 = {
4240
+ return {
4273
4241
  key: envKey,
4274
4242
  address: account.address,
4275
4243
  source: "env",
4276
4244
  mnemonic,
4277
4245
  solanaPrivateKeyBytes: solanaKeyBytes
4278
4246
  };
4279
- const legacyKeyBytes = deriveSolanaKeyBytesLegacy(mnemonic);
4280
- if (Buffer.from(legacyKeyBytes).toString("hex") !== Buffer.from(solanaKeyBytes).toString("hex")) {
4281
- result2.legacySolanaKeyBytes = legacyKeyBytes;
4282
- await logMigrationWarning(legacyKeyBytes, solanaKeyBytes);
4283
- }
4284
- return result2;
4285
4247
  }
4286
4248
  return { key: envKey, address: account.address, source: "env" };
4287
4249
  }
@@ -5620,7 +5582,9 @@ function transformPaymentError(errorBody) {
5620
5582
  }
5621
5583
  });
5622
5584
  }
5623
- console.error(`[ClawRouter] Solana payment verification failed: ${parsed.debug} payer=${wallet}`);
5585
+ console.error(
5586
+ `[ClawRouter] Solana payment verification failed: ${parsed.debug} payer=${wallet}`
5587
+ );
5624
5588
  return JSON.stringify({
5625
5589
  error: {
5626
5590
  message: `Solana payment verification failed: ${parsed.debug}`,
@@ -6198,7 +6162,7 @@ async function startProxy(options) {
6198
6162
  const solanaSigner = await createKeyPairSignerFromPrivateKeyBytes2(solanaPrivateKeyBytes);
6199
6163
  solanaAddress = solanaSigner.address;
6200
6164
  registerExactSvmScheme(x402, { signer: solanaSigner });
6201
- console.log(`[ClawRouter] Solana x402 scheme registered: ${solanaAddress}`);
6165
+ console.log(`[ClawRouter] Solana wallet: ${solanaAddress}`);
6202
6166
  }
6203
6167
  x402.onAfterPaymentCreation(async (context) => {
6204
6168
  const network = context.selectedRequirements.network;
@@ -6324,9 +6288,18 @@ async function startProxy(options) {
6324
6288
  const s = await fsStat(filePath);
6325
6289
  if (!s.isFile()) throw new Error("not a file");
6326
6290
  const ext = filename.split(".").pop()?.toLowerCase() ?? "png";
6327
- const mime = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", webp: "image/webp", gif: "image/gif" };
6291
+ const mime = {
6292
+ png: "image/png",
6293
+ jpg: "image/jpeg",
6294
+ jpeg: "image/jpeg",
6295
+ webp: "image/webp",
6296
+ gif: "image/gif"
6297
+ };
6328
6298
  const data = await readFile(filePath);
6329
- res.writeHead(200, { "Content-Type": mime[ext] ?? "application/octet-stream", "Content-Length": data.length });
6299
+ res.writeHead(200, {
6300
+ "Content-Type": mime[ext] ?? "application/octet-stream",
6301
+ "Content-Length": data.length
6302
+ });
6330
6303
  res.end(data);
6331
6304
  } catch {
6332
6305
  res.writeHead(404, { "Content-Type": "application/json" });
@@ -8498,17 +8471,22 @@ async function startProxyInBackground(api) {
8498
8471
  api.logger.info(`Pricing: Simple ~$0.001 | Code ~$0.01 | Complex ~$0.05 | Free: $0`);
8499
8472
  const currentChain = await resolvePaymentChain();
8500
8473
  const displayAddress = currentChain === "solana" && proxy.solanaAddress ? proxy.solanaAddress : wallet.address;
8474
+ const network = currentChain === "solana" ? "Solana" : "Base";
8501
8475
  proxy.balanceMonitor.checkBalance().then((balance) => {
8502
8476
  if (balance.isEmpty) {
8503
- api.logger.info(`Wallet: ${displayAddress} | Balance: $0.00`);
8504
- api.logger.info(`Using FREE model. Fund wallet for premium models.`);
8477
+ api.logger.info(`Wallet (${network}): ${displayAddress}`);
8478
+ api.logger.info(
8479
+ `Balance: $0.00 \u2014 send USDC on ${network} to the address above to unlock paid models.`
8480
+ );
8505
8481
  } else if (balance.isLow) {
8506
- api.logger.info(`Wallet: ${displayAddress} | Balance: ${balance.balanceUSD} (low)`);
8482
+ api.logger.info(
8483
+ `Wallet (${network}): ${displayAddress} | Balance: ${balance.balanceUSD} (low \u2014 top up soon)`
8484
+ );
8507
8485
  } else {
8508
- api.logger.info(`Wallet: ${displayAddress} | Balance: ${balance.balanceUSD}`);
8486
+ api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: ${balance.balanceUSD}`);
8509
8487
  }
8510
8488
  }).catch(() => {
8511
- api.logger.info(`Wallet: ${displayAddress} | Balance: (checking...)`);
8489
+ api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: (checking...)`);
8512
8490
  });
8513
8491
  }
8514
8492
  async function createStatsCommand() {