aboutsummaryrefslogtreecommitdiffstats
path: root/src/api.js
Commit message (Collapse)AuthorAgeFilesLines
* Defeat scan 429s with multi-backend rotation + cooldownAdam Soltys2026-06-141-39/+105
| | | | | | | | | | | | | | | | | | The "CORS" errors were 429 Too Many Requests (a 429 has no CORS headers, so the browser reports it as a CORS failure). SSL/hosting is irrelevant. Per-request retries made it worse by multiplying load on an already rate-limited host. Replace with: - round-robin across two Esplora-compatible backends (mempool.space + Blockstream), halving per-host load - park a host on an 8s cooldown when it 429s instead of retrying it - keep the global throttle (2 concurrent, 200ms gap) - map Blockstream's /fee-estimates to the named fee tiers Unit-tested rotation/cooldown; live scan of 40 addresses now completes in ~8s with no failures. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Fix scan rate-limiting (CORS errors) + tidy seed inputAdam Soltys2026-06-141-9/+52
| | | | | | | | | | | | | | | | | The "CORS" errors during scan were actually mempool.space rate-limiting: bursting ~40 address lookups gets some throttled, and throttled responses lack the access-control-allow-origin header, which the browser reports as a CORS failure. - api.js: route all requests through a global throttle (max 2 concurrent, 250ms min gap between starts, ~4 req/s) with exponential backoff retry so occasional throttles recover instead of failing. Unit-tested spacing + retry recovery. - Import pane: drop the "(12 or 24 words)" parenthetical (we generate 12), and replace the scrunched ellipsis placeholder with an enumerated word1..word12. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* Rebuild as single-file offline BIP84 walletAdam Soltys2026-06-141-0/+104
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]>