@blockrun/clawrouter 0.12.27 → 0.12.28
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/cli.js +3 -48
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +9 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -6198,7 +6160,7 @@ async function startProxy(options) {
|
|
|
6198
6160
|
const solanaSigner = await createKeyPairSignerFromPrivateKeyBytes2(solanaPrivateKeyBytes);
|
|
6199
6161
|
solanaAddress = solanaSigner.address;
|
|
6200
6162
|
registerExactSvmScheme(x402, { signer: solanaSigner });
|
|
6201
|
-
console.log(`[ClawRouter] Solana
|
|
6163
|
+
console.log(`[ClawRouter] Solana wallet: ${solanaAddress}`);
|
|
6202
6164
|
}
|
|
6203
6165
|
x402.onAfterPaymentCreation(async (context) => {
|
|
6204
6166
|
const network = context.selectedRequirements.network;
|
|
@@ -8498,17 +8460,18 @@ async function startProxyInBackground(api) {
|
|
|
8498
8460
|
api.logger.info(`Pricing: Simple ~$0.001 | Code ~$0.01 | Complex ~$0.05 | Free: $0`);
|
|
8499
8461
|
const currentChain = await resolvePaymentChain();
|
|
8500
8462
|
const displayAddress = currentChain === "solana" && proxy.solanaAddress ? proxy.solanaAddress : wallet.address;
|
|
8463
|
+
const network = currentChain === "solana" ? "Solana" : "Base";
|
|
8501
8464
|
proxy.balanceMonitor.checkBalance().then((balance) => {
|
|
8502
8465
|
if (balance.isEmpty) {
|
|
8503
|
-
api.logger.info(`Wallet
|
|
8504
|
-
api.logger.info(`
|
|
8466
|
+
api.logger.info(`Wallet (${network}): ${displayAddress}`);
|
|
8467
|
+
api.logger.info(`Balance: $0.00 \u2014 send USDC on ${network} to the address above to unlock paid models.`);
|
|
8505
8468
|
} else if (balance.isLow) {
|
|
8506
|
-
api.logger.info(`Wallet: ${displayAddress} | Balance: ${balance.balanceUSD} (low)`);
|
|
8469
|
+
api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: ${balance.balanceUSD} (low \u2014 top up soon)`);
|
|
8507
8470
|
} else {
|
|
8508
|
-
api.logger.info(`Wallet: ${displayAddress} | Balance: ${balance.balanceUSD}`);
|
|
8471
|
+
api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: ${balance.balanceUSD}`);
|
|
8509
8472
|
}
|
|
8510
8473
|
}).catch(() => {
|
|
8511
|
-
api.logger.info(`Wallet: ${displayAddress} | Balance: (checking...)`);
|
|
8474
|
+
api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: (checking...)`);
|
|
8512
8475
|
});
|
|
8513
8476
|
}
|
|
8514
8477
|
async function createStatsCommand() {
|