aboutsummaryrefslogtreecommitdiffstats
path: root/dev.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-14 23:01:03 -0700
committerAdam Soltys <[email protected]>2026-06-14 23:01:03 -0700
commitc5443946031ec32a7b3008fa751eb7916654a9f6 (patch)
tree372e8d0ccaa2dec58a6bcaaa19d3902b80eb4396 /dev.js
parent683927e4132651b9198e5421fae16e9c60978fbc (diff)
downloadcoinosv3-c5443946031ec32a7b3008fa751eb7916654a9f6.tar.gz
coinosv3-c5443946031ec32a7b3008fa751eb7916654a9f6.zip
Rebuild as single-file offline BIP84 wallet
Replace the SvelteKit/daisyUI prototype with a vanilla JS + hand-rolled CSS app that Bun bundles (code + scure/noble crypto + QR + CSS) into one self-contained dist/index.html runnable offline from file://. Wallet core (src/wallet.js): - BIP84 native-segwit HD wallet from BIP39 seed (+optional passphrase) - gap-limit scan of receive/change chains, aggregate balance, tx history - fresh receive/change addresses; signs with witnessUtxo only (enables offline signing with no prev-tx fetch) - coin selection + fee estimation via btc-signer selectUTXO; send-max; manual coin control - offline JSON snapshot export/import (keyless) + signed-tx hex/QR export - realtime mempool.space WebSocket: track-addresses -> debounced auto refresh of balances/history (no polling); live status badge UI (src/app.js): clean light paper-wallet; create (with optional, skippable backup verification) / import flow; receive (QR) / send / history / coins / tools tabs; clickable logo returns home. API (src/api.js): mempool.space wrapper with retry/backoff for scan-burst rate limiting; single network choke-point for offline enforcement. Verified: BIP84 spec vectors, build/sign/parse for auto/max/manual flows, snapshot roundtrip, live scan + WebSocket, headless-Chrome UI smoke tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'dev.js')
-rw-r--r--dev.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/dev.js b/dev.js
new file mode 100644
index 0000000..099069c
--- /dev/null
+++ b/dev.js
@@ -0,0 +1,25 @@
+// Dev server: rebuilds the inlined bundle on every request so you just refresh
+// the browser to see changes. Same output as `bun run build`, unminified.
+
+import { buildHtml } from './build.js';
+
+const port = Number(process.env.PORT || 5173);
+
+Bun.serve({
+ port,
+ async fetch() {
+ try {
+ const html = await buildHtml({ minify: false });
+ return new Response(html, {
+ headers: { 'content-type': 'text/html; charset=utf-8' },
+ });
+ } catch (e) {
+ return new Response(`Build error:\n\n${e.stack || e}`, {
+ status: 500,
+ headers: { 'content-type': 'text/plain; charset=utf-8' },
+ });
+ }
+ },
+});
+
+console.log(`dev server → http://localhost:${port}`);