@johngalt5/bsv-overlay 0.2.3 → 0.2.4
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/index.ts +12 -15
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -194,7 +194,7 @@ function stopBackgroundService() {
|
|
|
194
194
|
stopAutoImport();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export default
|
|
197
|
+
export default function register(api) {
|
|
198
198
|
// Capture config at registration time (api.getConfig may not be available later)
|
|
199
199
|
const pluginConfig = api.getConfig?.()?.plugins?.entries?.['bsv-overlay']?.config || api.config || {};
|
|
200
200
|
|
|
@@ -472,26 +472,23 @@ export default async function register(api) {
|
|
|
472
472
|
});
|
|
473
473
|
}, { commands: ["overlay"] });
|
|
474
474
|
|
|
475
|
-
// Auto-setup: ensure wallet exists (best-effort, non-fatal)
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
475
|
+
// Auto-setup: ensure wallet exists (best-effort, non-fatal, fire-and-forget)
|
|
476
|
+
(async () => {
|
|
477
|
+
try {
|
|
478
|
+
const config = pluginConfig;
|
|
479
|
+
const walletDir = config?.walletDir || path.join(process.env.HOME || '', '.clawdbot', 'bsv-wallet');
|
|
480
|
+
const identityFile = path.join(walletDir, 'wallet-identity.json');
|
|
481
|
+
if (!fs.existsSync(identityFile)) {
|
|
482
|
+
api.log?.info?.('[bsv-overlay] No wallet found — running auto-setup...');
|
|
483
483
|
const env = buildEnvironment(config || {});
|
|
484
484
|
const cliPath = path.join(__dirname, 'scripts', 'overlay-cli.mjs');
|
|
485
485
|
await execFileAsync('node', [cliPath, 'setup'], { env });
|
|
486
486
|
api.log?.info?.('[bsv-overlay] Wallet initialized. Fund it and run: overlay({ action: "register" })');
|
|
487
|
-
} catch (err: any) {
|
|
488
|
-
api.log?.warn?.('[bsv-overlay] Auto-setup failed:', err.message);
|
|
489
487
|
}
|
|
488
|
+
} catch (err: any) {
|
|
489
|
+
api.log?.debug?.('[bsv-overlay] Auto-setup skipped:', err.message);
|
|
490
490
|
}
|
|
491
|
-
}
|
|
492
|
-
// Non-fatal — plugin still loads if auto-setup fails
|
|
493
|
-
api.log?.debug?.('[bsv-overlay] Auto-setup skipped:', err.message);
|
|
494
|
-
}
|
|
491
|
+
})();
|
|
495
492
|
}
|
|
496
493
|
|
|
497
494
|
async function executeOverlayAction(params, config, api) {
|