@blockrun/clawrouter 0.12.115 → 0.12.116

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/index.js CHANGED
@@ -80727,7 +80727,26 @@ Usage:
80727
80727
  }
80728
80728
  };
80729
80729
  }
80730
- async function createWalletCommand() {
80730
+ function restartProxyForChainSwitch(api) {
80731
+ const oldHandle = activeProxyHandle;
80732
+ activeProxyHandle = null;
80733
+ const doRestart = async () => {
80734
+ if (oldHandle) {
80735
+ try {
80736
+ await oldHandle.close();
80737
+ } catch {
80738
+ }
80739
+ }
80740
+ await new Promise((r) => setTimeout(r, 300));
80741
+ await startProxyInBackground(api);
80742
+ };
80743
+ doRestart().catch((err) => {
80744
+ api.logger.error(
80745
+ `Failed to restart proxy after chain switch: ${err instanceof Error ? err.message : String(err)}`
80746
+ );
80747
+ });
80748
+ }
80749
+ async function createWalletCommand(api) {
80731
80750
  return {
80732
80751
  name: "wallet",
80733
80752
  description: "Show BlockRun wallet info, usage stats, or export private key",
@@ -80819,9 +80838,11 @@ Run \`openclaw plugins install @blockrun/clawrouter\` to generate a wallet.`,
80819
80838
  const { createKeyPairSignerFromPrivateKeyBytes: createKeyPairSignerFromPrivateKeyBytes3 } = await Promise.resolve().then(() => (init_index_node37(), index_node_exports));
80820
80839
  const signer2 = await createKeyPairSignerFromPrivateKeyBytes3(solKeyBytes);
80821
80840
  solanaAddr = signer2.address;
80841
+ if (api) restartProxyForChainSwitch(api);
80822
80842
  return {
80823
80843
  text: [
80824
- "Payment chain set to Solana. Restart the gateway to apply.",
80844
+ "\u2713 Payment chain switched to **Solana**.",
80845
+ api ? "Proxy restarting in background (~2s)." : "Restart the gateway to apply.",
80825
80846
  "",
80826
80847
  `**Solana Address:** \`${solanaAddr}\``,
80827
80848
  `**Fund with USDC on Solana:** https://solscan.io/account/${solanaAddr}`
@@ -80833,6 +80854,7 @@ Run \`openclaw plugins install @blockrun/clawrouter\` to generate a wallet.`,
80833
80854
  await savePaymentChain("solana");
80834
80855
  const { createKeyPairSignerFromPrivateKeyBytes: createKeyPairSignerFromPrivateKeyBytes2 } = await Promise.resolve().then(() => (init_index_node37(), index_node_exports));
80835
80856
  const signer = await createKeyPairSignerFromPrivateKeyBytes2(solanaPrivateKeyBytes);
80857
+ if (api) restartProxyForChainSwitch(api);
80836
80858
  return {
80837
80859
  text: [
80838
80860
  "**Solana Wallet Set Up**",
@@ -80841,7 +80863,7 @@ Run \`openclaw plugins install @blockrun/clawrouter\` to generate a wallet.`,
80841
80863
  `**Mnemonic File:** \`${MNEMONIC_FILE}\``,
80842
80864
  "",
80843
80865
  "Your existing EVM wallet is unchanged.",
80844
- "Payment chain set to Solana. Restart the gateway to apply.",
80866
+ api ? "\u2713 Payment chain switched to Solana. Proxy restarting in background (~2s)." : "Payment chain set to Solana. Restart the gateway to apply.",
80845
80867
  "",
80846
80868
  `**Fund with USDC on Solana:** https://solscan.io/account/${signer.address}`
80847
80869
  ].join("\n")
@@ -80856,8 +80878,9 @@ Run \`openclaw plugins install @blockrun/clawrouter\` to generate a wallet.`,
80856
80878
  if (subcommand === "base") {
80857
80879
  try {
80858
80880
  await savePaymentChain("base");
80881
+ if (api) restartProxyForChainSwitch(api);
80859
80882
  return {
80860
- text: "Payment chain set to Base (EVM). Restart the gateway to apply."
80883
+ text: api ? "\u2713 Payment chain switched to **Base (EVM)**. Proxy restarting in background (~2s)." : "Payment chain set to Base (EVM). Restart the gateway to apply."
80861
80884
  };
80862
80885
  } catch (err) {
80863
80886
  return {
@@ -81029,7 +81052,7 @@ var plugin = {
81029
81052
  `Failed to register partner tools: ${err instanceof Error ? err.message : String(err)}`
81030
81053
  );
81031
81054
  }
81032
- createWalletCommand().then((walletCommand) => {
81055
+ createWalletCommand(api).then((walletCommand) => {
81033
81056
  api.registerCommand(walletCommand);
81034
81057
  }).catch((err) => {
81035
81058
  api.logger.warn(