@blockrun/clawrouter 0.12.26 → 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 +55 -48
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +61 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/skills/clawrouter/SKILL.md +48 -0
- package/skills/imagegen/SKILL.md +80 -0
- package/skills/release/SKILL.md +182 -0
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
|
}
|
|
@@ -5135,6 +5090,58 @@ function transformPaymentError(errorBody) {
|
|
|
5135
5090
|
}
|
|
5136
5091
|
}
|
|
5137
5092
|
}
|
|
5093
|
+
if (parsed.error === "Payment verification failed" && parsed.code === "PAYMENT_INVALID" && parsed.debug) {
|
|
5094
|
+
const debugLower = parsed.debug.toLowerCase();
|
|
5095
|
+
const wallet = parsed.payer || "unknown";
|
|
5096
|
+
const shortWallet = wallet.length > 12 ? `${wallet.slice(0, 6)}...${wallet.slice(-4)}` : wallet;
|
|
5097
|
+
if (debugLower.includes("insufficient")) {
|
|
5098
|
+
return JSON.stringify({
|
|
5099
|
+
error: {
|
|
5100
|
+
message: "Insufficient Solana USDC balance.",
|
|
5101
|
+
type: "insufficient_funds",
|
|
5102
|
+
wallet,
|
|
5103
|
+
help: `Fund wallet ${shortWallet} with USDC on Solana, or switch to Base: /wallet base`
|
|
5104
|
+
}
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
if (debugLower.includes("transaction_simulation_failed") || debugLower.includes("simulation")) {
|
|
5108
|
+
console.error(`[ClawRouter] Solana transaction simulation failed: ${parsed.debug}`);
|
|
5109
|
+
return JSON.stringify({
|
|
5110
|
+
error: {
|
|
5111
|
+
message: "Solana payment simulation failed. Retrying with a different model.",
|
|
5112
|
+
type: "transaction_simulation_failed",
|
|
5113
|
+
help: "This is usually temporary. If it persists, try: /model free"
|
|
5114
|
+
}
|
|
5115
|
+
});
|
|
5116
|
+
}
|
|
5117
|
+
if (debugLower.includes("invalid signature") || debugLower.includes("invalid_signature")) {
|
|
5118
|
+
return JSON.stringify({
|
|
5119
|
+
error: {
|
|
5120
|
+
message: "Solana payment signature invalid.",
|
|
5121
|
+
type: "invalid_payload",
|
|
5122
|
+
help: "Try again. If this persists, reinstall ClawRouter: curl -fsSL https://blockrun.ai/ClawRouter-update | bash"
|
|
5123
|
+
}
|
|
5124
|
+
});
|
|
5125
|
+
}
|
|
5126
|
+
if (debugLower.includes("expired")) {
|
|
5127
|
+
return JSON.stringify({
|
|
5128
|
+
error: {
|
|
5129
|
+
message: "Solana payment expired. Retrying.",
|
|
5130
|
+
type: "expired",
|
|
5131
|
+
help: "This is usually temporary."
|
|
5132
|
+
}
|
|
5133
|
+
});
|
|
5134
|
+
}
|
|
5135
|
+
console.error(`[ClawRouter] Solana payment verification failed: ${parsed.debug} payer=${wallet}`);
|
|
5136
|
+
return JSON.stringify({
|
|
5137
|
+
error: {
|
|
5138
|
+
message: `Solana payment verification failed: ${parsed.debug}`,
|
|
5139
|
+
type: "payment_invalid",
|
|
5140
|
+
wallet,
|
|
5141
|
+
help: "Try again or switch to Base: /wallet base"
|
|
5142
|
+
}
|
|
5143
|
+
});
|
|
5144
|
+
}
|
|
5138
5145
|
if (parsed.error === "Settlement failed" || parsed.error === "Payment settlement failed" || parsed.details?.includes("Settlement failed") || parsed.details?.includes("transaction_simulation_failed")) {
|
|
5139
5146
|
const details = parsed.details || "";
|
|
5140
5147
|
const gasError = details.includes("unable to estimate gas");
|
|
@@ -5703,7 +5710,7 @@ async function startProxy(options) {
|
|
|
5703
5710
|
const solanaSigner = await createKeyPairSignerFromPrivateKeyBytes(solanaPrivateKeyBytes);
|
|
5704
5711
|
solanaAddress = solanaSigner.address;
|
|
5705
5712
|
registerExactSvmScheme(x402, { signer: solanaSigner });
|
|
5706
|
-
console.log(`[ClawRouter] Solana
|
|
5713
|
+
console.log(`[ClawRouter] Solana wallet: ${solanaAddress}`);
|
|
5707
5714
|
}
|
|
5708
5715
|
x402.onAfterPaymentCreation(async (context) => {
|
|
5709
5716
|
const network = context.selectedRequirements.network;
|