@blockrun/clawrouter 0.12.19 → 0.12.21
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 +21 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3867,6 +3867,10 @@ async function recoverWalletFromMnemonic() {
|
|
|
3867
3867
|
console.log(`[ClawRouter] Run: npx @blockrun/clawrouter`);
|
|
3868
3868
|
console.log(`[ClawRouter]`);
|
|
3869
3869
|
}
|
|
3870
|
+
async function savePaymentChain(chain) {
|
|
3871
|
+
await mkdir2(WALLET_DIR, { recursive: true });
|
|
3872
|
+
await writeFile(CHAIN_FILE, chain + "\n", { mode: 384 });
|
|
3873
|
+
}
|
|
3870
3874
|
async function loadPaymentChain() {
|
|
3871
3875
|
try {
|
|
3872
3876
|
const content = (await readTextFile(CHAIN_FILE)).trim();
|
|
@@ -4811,7 +4815,6 @@ function hashRequestContent(lastUserContent, toolCallNames) {
|
|
|
4811
4815
|
|
|
4812
4816
|
// src/updater.ts
|
|
4813
4817
|
var NPM_REGISTRY = "https://registry.npmjs.org/@blockrun/clawrouter/latest";
|
|
4814
|
-
var UPDATE_URL = "https://blockrun.ai/ClawRouter-update";
|
|
4815
4818
|
var CHECK_TIMEOUT_MS = 5e3;
|
|
4816
4819
|
function compareSemver(a, b) {
|
|
4817
4820
|
const pa = a.split(".").map(Number);
|
|
@@ -4838,7 +4841,7 @@ async function checkForUpdates() {
|
|
|
4838
4841
|
if (compareSemver(latest, VERSION) > 0) {
|
|
4839
4842
|
console.log("");
|
|
4840
4843
|
console.log(`\x1B[33m\u2B06\uFE0F ClawRouter ${latest} available (you have ${VERSION})\x1B[0m`);
|
|
4841
|
-
console.log(` Run: \x1B[
|
|
4844
|
+
console.log(` Run: \x1B[36mnpx @blockrun/clawrouter@latest\x1B[0m`);
|
|
4842
4845
|
console.log("");
|
|
4843
4846
|
}
|
|
4844
4847
|
} catch {
|
|
@@ -5632,9 +5635,9 @@ async function startProxy(options) {
|
|
|
5632
5635
|
const paymentChain = options.paymentChain ?? await resolvePaymentChain();
|
|
5633
5636
|
const apiBase = options.apiBase ?? (paymentChain === "solana" && solanaPrivateKeyBytes ? BLOCKRUN_SOLANA_API : BLOCKRUN_API);
|
|
5634
5637
|
if (paymentChain === "solana" && !solanaPrivateKeyBytes) {
|
|
5635
|
-
console.warn(
|
|
5636
|
-
|
|
5637
|
-
);
|
|
5638
|
+
console.warn(`[ClawRouter] \u26A0 Payment chain is Solana but no mnemonic found \u2014 falling back to Base (EVM).`);
|
|
5639
|
+
console.warn(`[ClawRouter] To fix: run "npx @blockrun/clawrouter wallet recover" if your mnemonic exists,`);
|
|
5640
|
+
console.warn(`[ClawRouter] or run "npx @blockrun/clawrouter chain base" to switch to EVM.`);
|
|
5638
5641
|
} else if (paymentChain === "solana") {
|
|
5639
5642
|
console.log(`[ClawRouter] Payment chain: Solana (${BLOCKRUN_SOLANA_API})`);
|
|
5640
5643
|
}
|
|
@@ -7613,6 +7616,8 @@ Commands:
|
|
|
7613
7616
|
partners List available partner APIs with pricing
|
|
7614
7617
|
partners test Test partner API endpoints (expect 402 = alive)
|
|
7615
7618
|
wallet recover Restore wallet.key from mnemonic (if generated by ClawRouter)
|
|
7619
|
+
chain solana Switch payment chain to Solana (persists across restarts)
|
|
7620
|
+
chain base Switch payment chain to Base EVM (persists across restarts)
|
|
7616
7621
|
|
|
7617
7622
|
Examples:
|
|
7618
7623
|
# Start standalone proxy
|
|
@@ -7648,6 +7653,7 @@ function parseArgs(args) {
|
|
|
7648
7653
|
reportPeriod: "daily",
|
|
7649
7654
|
reportJson: false,
|
|
7650
7655
|
walletRecover: false,
|
|
7656
|
+
chain: void 0,
|
|
7651
7657
|
port: void 0
|
|
7652
7658
|
};
|
|
7653
7659
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -7681,6 +7687,9 @@ function parseArgs(args) {
|
|
|
7681
7687
|
} else if (arg === "wallet" && args[i + 1] === "recover") {
|
|
7682
7688
|
result.walletRecover = true;
|
|
7683
7689
|
i++;
|
|
7690
|
+
} else if (arg === "chain" && (args[i + 1] === "solana" || args[i + 1] === "base")) {
|
|
7691
|
+
result.chain = args[i + 1];
|
|
7692
|
+
i++;
|
|
7684
7693
|
} else if (arg === "--port" && args[i + 1]) {
|
|
7685
7694
|
result.port = parseInt(args[i + 1], 10);
|
|
7686
7695
|
i++;
|
|
@@ -7755,6 +7764,13 @@ ClawRouter Partner APIs (v${VERSION})
|
|
|
7755
7764
|
await recoverWalletFromMnemonic();
|
|
7756
7765
|
process.exit(0);
|
|
7757
7766
|
}
|
|
7767
|
+
if (args.chain) {
|
|
7768
|
+
await savePaymentChain(args.chain);
|
|
7769
|
+
console.log(`[ClawRouter] Payment chain set to: ${args.chain}`);
|
|
7770
|
+
console.log(`[ClawRouter] This persists across restarts.`);
|
|
7771
|
+
console.log(`[ClawRouter] Run: npx @blockrun/clawrouter`);
|
|
7772
|
+
process.exit(0);
|
|
7773
|
+
}
|
|
7758
7774
|
if (args.report) {
|
|
7759
7775
|
const report = await generateReport(args.reportPeriod, args.reportJson);
|
|
7760
7776
|
console.log(report);
|