@blockrun/clawrouter 0.12.20 → 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 +20 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.js +3 -3
- 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();
|
|
@@ -5631,9 +5635,9 @@ async function startProxy(options) {
|
|
|
5631
5635
|
const paymentChain = options.paymentChain ?? await resolvePaymentChain();
|
|
5632
5636
|
const apiBase = options.apiBase ?? (paymentChain === "solana" && solanaPrivateKeyBytes ? BLOCKRUN_SOLANA_API : BLOCKRUN_API);
|
|
5633
5637
|
if (paymentChain === "solana" && !solanaPrivateKeyBytes) {
|
|
5634
|
-
console.warn(
|
|
5635
|
-
|
|
5636
|
-
);
|
|
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.`);
|
|
5637
5641
|
} else if (paymentChain === "solana") {
|
|
5638
5642
|
console.log(`[ClawRouter] Payment chain: Solana (${BLOCKRUN_SOLANA_API})`);
|
|
5639
5643
|
}
|
|
@@ -7612,6 +7616,8 @@ Commands:
|
|
|
7612
7616
|
partners List available partner APIs with pricing
|
|
7613
7617
|
partners test Test partner API endpoints (expect 402 = alive)
|
|
7614
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)
|
|
7615
7621
|
|
|
7616
7622
|
Examples:
|
|
7617
7623
|
# Start standalone proxy
|
|
@@ -7647,6 +7653,7 @@ function parseArgs(args) {
|
|
|
7647
7653
|
reportPeriod: "daily",
|
|
7648
7654
|
reportJson: false,
|
|
7649
7655
|
walletRecover: false,
|
|
7656
|
+
chain: void 0,
|
|
7650
7657
|
port: void 0
|
|
7651
7658
|
};
|
|
7652
7659
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -7680,6 +7687,9 @@ function parseArgs(args) {
|
|
|
7680
7687
|
} else if (arg === "wallet" && args[i + 1] === "recover") {
|
|
7681
7688
|
result.walletRecover = true;
|
|
7682
7689
|
i++;
|
|
7690
|
+
} else if (arg === "chain" && (args[i + 1] === "solana" || args[i + 1] === "base")) {
|
|
7691
|
+
result.chain = args[i + 1];
|
|
7692
|
+
i++;
|
|
7683
7693
|
} else if (arg === "--port" && args[i + 1]) {
|
|
7684
7694
|
result.port = parseInt(args[i + 1], 10);
|
|
7685
7695
|
i++;
|
|
@@ -7754,6 +7764,13 @@ ClawRouter Partner APIs (v${VERSION})
|
|
|
7754
7764
|
await recoverWalletFromMnemonic();
|
|
7755
7765
|
process.exit(0);
|
|
7756
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
|
+
}
|
|
7757
7774
|
if (args.report) {
|
|
7758
7775
|
const report = await generateReport(args.reportPeriod, args.reportJson);
|
|
7759
7776
|
console.log(report);
|