@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/README.md +11 -11
- package/dist/cli.js +17 -51
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +27 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/release/SKILL.md +11 -8
package/README.md
CHANGED
|
@@ -330,17 +330,17 @@ npm test
|
|
|
330
330
|
|
|
331
331
|
## 📚 More Resources
|
|
332
332
|
|
|
333
|
-
| Resource
|
|
334
|
-
|
|
|
335
|
-
| [Documentation](https://blockrun.ai/docs)
|
|
336
|
-
| [Model Pricing](https://blockrun.ai/models)
|
|
337
|
-
| [Image Generation](docs/image-generation.md)
|
|
338
|
-
| [Routing Profiles](docs/routing-profiles.md)
|
|
339
|
-
| [Architecture](docs/architecture.md)
|
|
340
|
-
| [Configuration](docs/configuration.md)
|
|
341
|
-
| [vs OpenRouter](docs/vs-openrouter.md)
|
|
342
|
-
| [Features](docs/features.md)
|
|
343
|
-
| [Troubleshooting](docs/troubleshooting.md)
|
|
333
|
+
| Resource | Description |
|
|
334
|
+
| -------------------------------------------- | ------------------------ |
|
|
335
|
+
| [Documentation](https://blockrun.ai/docs) | Full docs |
|
|
336
|
+
| [Model Pricing](https://blockrun.ai/models) | All models & prices |
|
|
337
|
+
| [Image Generation](docs/image-generation.md) | API examples, 5 models |
|
|
338
|
+
| [Routing Profiles](docs/routing-profiles.md) | ECO/AUTO/PREMIUM details |
|
|
339
|
+
| [Architecture](docs/architecture.md) | Technical deep dive |
|
|
340
|
+
| [Configuration](docs/configuration.md) | Environment variables |
|
|
341
|
+
| [vs OpenRouter](docs/vs-openrouter.md) | Why ClawRouter wins |
|
|
342
|
+
| [Features](docs/features.md) | All features |
|
|
343
|
+
| [Troubleshooting](docs/troubleshooting.md) | Common issues |
|
|
344
344
|
|
|
345
345
|
---
|
|
346
346
|
|
package/dist/cli.js
CHANGED
|
@@ -3621,13 +3621,6 @@ function deriveSolanaKeyBytes(mnemonic) {
|
|
|
3621
3621
|
}
|
|
3622
3622
|
return new Uint8Array(key);
|
|
3623
3623
|
}
|
|
3624
|
-
function deriveSolanaKeyBytesLegacy(mnemonic) {
|
|
3625
|
-
const seed = mnemonicToSeedSync(mnemonic);
|
|
3626
|
-
const hdKey = HDKey.fromMasterSeed(seed);
|
|
3627
|
-
const derived = hdKey.derive("m/44'/501'/0'/0'");
|
|
3628
|
-
if (!derived.privateKey) throw new Error("Failed to derive legacy Solana private key");
|
|
3629
|
-
return new Uint8Array(derived.privateKey);
|
|
3630
|
-
}
|
|
3631
3624
|
function deriveAllKeys(mnemonic) {
|
|
3632
3625
|
const { privateKey: evmPrivateKey, address: evmAddress } = deriveEvmKey(mnemonic);
|
|
3633
3626
|
const solanaPrivateKeyBytes = deriveSolanaKeyBytes(mnemonic);
|
|
@@ -3753,32 +3746,6 @@ Then run: npx @blockrun/clawrouter`
|
|
|
3753
3746
|
solanaPrivateKeyBytes: derived.solanaPrivateKeyBytes
|
|
3754
3747
|
};
|
|
3755
3748
|
}
|
|
3756
|
-
async function logMigrationWarning(legacyKeyBytes, newKeyBytes) {
|
|
3757
|
-
try {
|
|
3758
|
-
const { createKeyPairSignerFromPrivateKeyBytes } = await import("@solana/kit");
|
|
3759
|
-
const [oldSigner, newSigner] = await Promise.all([
|
|
3760
|
-
createKeyPairSignerFromPrivateKeyBytes(legacyKeyBytes),
|
|
3761
|
-
createKeyPairSignerFromPrivateKeyBytes(newKeyBytes)
|
|
3762
|
-
]);
|
|
3763
|
-
console.log(`[ClawRouter]`);
|
|
3764
|
-
console.log(`[ClawRouter] \u26A0 SOLANA WALLET MIGRATION DETECTED`);
|
|
3765
|
-
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`);
|
|
3766
|
-
console.log(`[ClawRouter] Old address (secp256k1): ${oldSigner.address}`);
|
|
3767
|
-
console.log(`[ClawRouter] New address (SLIP-10): ${newSigner.address}`);
|
|
3768
|
-
console.log(`[ClawRouter]`);
|
|
3769
|
-
console.log(`[ClawRouter] Your Solana wallet derivation has been fixed to use`);
|
|
3770
|
-
console.log(`[ClawRouter] SLIP-10 Ed25519 (Phantom/Solflare compatible).`);
|
|
3771
|
-
console.log(`[ClawRouter]`);
|
|
3772
|
-
console.log(`[ClawRouter] If you had funds in the old wallet, run:`);
|
|
3773
|
-
console.log(`[ClawRouter] /wallet migrate-solana`);
|
|
3774
|
-
console.log(`[ClawRouter]`);
|
|
3775
|
-
console.log(`[ClawRouter] The new wallet pays gas. Send ~0.005 SOL to:`);
|
|
3776
|
-
console.log(`[ClawRouter] ${newSigner.address}`);
|
|
3777
|
-
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`);
|
|
3778
|
-
console.log(`[ClawRouter]`);
|
|
3779
|
-
} catch {
|
|
3780
|
-
}
|
|
3781
|
-
}
|
|
3782
3749
|
async function resolveOrGenerateWalletKey() {
|
|
3783
3750
|
const saved = await loadSavedWallet();
|
|
3784
3751
|
if (saved) {
|
|
@@ -3786,19 +3753,13 @@ async function resolveOrGenerateWalletKey() {
|
|
|
3786
3753
|
const mnemonic = await loadMnemonic();
|
|
3787
3754
|
if (mnemonic) {
|
|
3788
3755
|
const solanaKeyBytes = deriveSolanaKeyBytes(mnemonic);
|
|
3789
|
-
|
|
3756
|
+
return {
|
|
3790
3757
|
key: saved,
|
|
3791
3758
|
address: account.address,
|
|
3792
3759
|
source: "saved",
|
|
3793
3760
|
mnemonic,
|
|
3794
3761
|
solanaPrivateKeyBytes: solanaKeyBytes
|
|
3795
3762
|
};
|
|
3796
|
-
const legacyKeyBytes = deriveSolanaKeyBytesLegacy(mnemonic);
|
|
3797
|
-
if (Buffer.from(legacyKeyBytes).toString("hex") !== Buffer.from(solanaKeyBytes).toString("hex")) {
|
|
3798
|
-
result2.legacySolanaKeyBytes = legacyKeyBytes;
|
|
3799
|
-
await logMigrationWarning(legacyKeyBytes, solanaKeyBytes);
|
|
3800
|
-
}
|
|
3801
|
-
return result2;
|
|
3802
3763
|
}
|
|
3803
3764
|
return { key: saved, address: account.address, source: "saved" };
|
|
3804
3765
|
}
|
|
@@ -3808,19 +3769,13 @@ async function resolveOrGenerateWalletKey() {
|
|
|
3808
3769
|
const mnemonic = await loadMnemonic();
|
|
3809
3770
|
if (mnemonic) {
|
|
3810
3771
|
const solanaKeyBytes = deriveSolanaKeyBytes(mnemonic);
|
|
3811
|
-
|
|
3772
|
+
return {
|
|
3812
3773
|
key: envKey,
|
|
3813
3774
|
address: account.address,
|
|
3814
3775
|
source: "env",
|
|
3815
3776
|
mnemonic,
|
|
3816
3777
|
solanaPrivateKeyBytes: solanaKeyBytes
|
|
3817
3778
|
};
|
|
3818
|
-
const legacyKeyBytes = deriveSolanaKeyBytesLegacy(mnemonic);
|
|
3819
|
-
if (Buffer.from(legacyKeyBytes).toString("hex") !== Buffer.from(solanaKeyBytes).toString("hex")) {
|
|
3820
|
-
result2.legacySolanaKeyBytes = legacyKeyBytes;
|
|
3821
|
-
await logMigrationWarning(legacyKeyBytes, solanaKeyBytes);
|
|
3822
|
-
}
|
|
3823
|
-
return result2;
|
|
3824
3779
|
}
|
|
3825
3780
|
return { key: envKey, address: account.address, source: "env" };
|
|
3826
3781
|
}
|
|
@@ -5177,7 +5132,9 @@ function transformPaymentError(errorBody) {
|
|
|
5177
5132
|
}
|
|
5178
5133
|
});
|
|
5179
5134
|
}
|
|
5180
|
-
console.error(
|
|
5135
|
+
console.error(
|
|
5136
|
+
`[ClawRouter] Solana payment verification failed: ${parsed.debug} payer=${wallet}`
|
|
5137
|
+
);
|
|
5181
5138
|
return JSON.stringify({
|
|
5182
5139
|
error: {
|
|
5183
5140
|
message: `Solana payment verification failed: ${parsed.debug}`,
|
|
@@ -5755,7 +5712,7 @@ async function startProxy(options) {
|
|
|
5755
5712
|
const solanaSigner = await createKeyPairSignerFromPrivateKeyBytes(solanaPrivateKeyBytes);
|
|
5756
5713
|
solanaAddress = solanaSigner.address;
|
|
5757
5714
|
registerExactSvmScheme(x402, { signer: solanaSigner });
|
|
5758
|
-
console.log(`[ClawRouter] Solana
|
|
5715
|
+
console.log(`[ClawRouter] Solana wallet: ${solanaAddress}`);
|
|
5759
5716
|
}
|
|
5760
5717
|
x402.onAfterPaymentCreation(async (context) => {
|
|
5761
5718
|
const network = context.selectedRequirements.network;
|
|
@@ -5881,9 +5838,18 @@ async function startProxy(options) {
|
|
|
5881
5838
|
const s = await fsStat(filePath);
|
|
5882
5839
|
if (!s.isFile()) throw new Error("not a file");
|
|
5883
5840
|
const ext = filename.split(".").pop()?.toLowerCase() ?? "png";
|
|
5884
|
-
const mime = {
|
|
5841
|
+
const mime = {
|
|
5842
|
+
png: "image/png",
|
|
5843
|
+
jpg: "image/jpeg",
|
|
5844
|
+
jpeg: "image/jpeg",
|
|
5845
|
+
webp: "image/webp",
|
|
5846
|
+
gif: "image/gif"
|
|
5847
|
+
};
|
|
5885
5848
|
const data = await readFile(filePath);
|
|
5886
|
-
res.writeHead(200, {
|
|
5849
|
+
res.writeHead(200, {
|
|
5850
|
+
"Content-Type": mime[ext] ?? "application/octet-stream",
|
|
5851
|
+
"Content-Length": data.length
|
|
5852
|
+
});
|
|
5887
5853
|
res.end(data);
|
|
5888
5854
|
} catch {
|
|
5889
5855
|
res.writeHead(404, { "Content-Type": "application/json" });
|