diff options
| author | Adam Soltys <[email protected]> | 2026-06-27 08:49:09 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-27 08:49:09 -0700 |
| commit | 1d0c1c9bfb9ccfb8a28e0cf147af12c37655cdcc (patch) | |
| tree | 443c23a9320f4e1d494e51e2a13e6f3acaf4f426 /src/app.js | |
| parent | a9a903e7a1f80ed4a6f4163419b25d4e6de5db01 (diff) | |
| download | coinosv3-1d0c1c9bfb9ccfb8a28e0cf147af12c37655cdcc.tar.gz coinosv3-1d0c1c9bfb9ccfb8a28e0cf147af12c37655cdcc.zip | |
Regtest realtime via a local Electrum-over-WebSocket bridge
On regtest there's no realtime push (coinos watcher is mainnet-only), so the UI
only updated on the 5–10s poll — a funded tx took a while to appear and a
just-mined block stayed "pending" until the next reconcile. electrs speaks the
Electrum protocol the watcher already understands, but only over TCP; route it
through a small WS<->TCP bridge (see coinos-server/electrum-ws) so the wallet
subscribes scripthashes and reconciles instantly on each notification. Data
still comes from esplora; this only adds the push channel. Configurable in
Settings (default ws://localhost:50003); falls back to polling if unreachable.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Diffstat (limited to 'src/app.js')
| -rw-r--r-- | src/app.js | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -8,7 +8,7 @@ import { Wallet, newMnemonic, isValidMnemonic, accountXpubFor, cacheKeyFor, utxo import { qrSvg } from './qr.js'; import { scanQr } from './scan.js'; import { getSyncConfig, setSyncConfig } from './nostr.js'; -import { getExplorerConfig, setExplorerConfig, EXPLORER_PRESETS, getDataMode, setDataMode, ELECTRUM_PRESETS, getElectrumServerConfig, setElectrumServerConfig, getNetwork, setNetwork, getRegtestEsplora, setRegtestEsplora } from './api.js'; +import { getExplorerConfig, setExplorerConfig, EXPLORER_PRESETS, getDataMode, setDataMode, ELECTRUM_PRESETS, getElectrumServerConfig, setElectrumServerConfig, getNetwork, setNetwork, getRegtestEsplora, setRegtestEsplora, getRegtestElectrumWs, setRegtestElectrumWs } from './api.js'; import { isSilentPaymentAddress } from './silentpay.js'; import { t, LANGS, getLang, setLang, isRTL, loadLocale } from './i18n.js'; import { @@ -1577,15 +1577,23 @@ function networkCard() { h('option', { value: 'regtest', selected: net === 'regtest' }, 'Regtest') ), net === 'regtest' - ? h('label', { class: 'field' }, - h('span', { class: 'lab' }, 'Regtest Esplora URL'), - h('input', { - type: 'text', class: 'mono-input', placeholder: 'http://localhost:3000', - autocapitalize: 'none', autocomplete: 'off', spellcheck: 'false', value: getRegtestEsplora(), - onChange: (e) => { setRegtestEsplora(e.target.value.trim()); wallet.reloadExplorer(); }, - }), - h('div', { class: 'small faint' }, 'Esplora-compatible REST endpoint (coinos chopsticks/electrs).') - ) + ? h('div', { class: 'col', style: 'gap:10px' }, + h('label', { class: 'field' }, + h('span', { class: 'lab' }, 'Regtest Esplora URL'), + h('input', { + type: 'text', class: 'mono-input', placeholder: 'http://localhost:3000', + autocapitalize: 'none', autocomplete: 'off', spellcheck: 'false', value: getRegtestEsplora(), + onChange: (e) => { setRegtestEsplora(e.target.value.trim()); wallet.reloadExplorer(); }, + }), + h('div', { class: 'small faint' }, 'Esplora-compatible REST endpoint (coinos chopsticks/electrs).')), + h('label', { class: 'field' }, + h('span', { class: 'lab' }, 'Regtest realtime (Electrum WS)'), + h('input', { + type: 'text', class: 'mono-input', placeholder: 'ws://localhost:50003', + autocapitalize: 'none', autocomplete: 'off', spellcheck: 'false', value: getRegtestElectrumWs(), + onChange: (e) => { setRegtestElectrumWs(e.target.value.trim()); wallet.reloadExplorer(); }, + }), + h('div', { class: 'small faint' }, 'Electrum-over-WebSocket bridge (ews) for instant updates; falls back to polling if unreachable.'))) : null ); } |
