diff options
| author | Adam Soltys <[email protected]> | 2026-06-27 09:09:31 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-27 09:09:31 -0700 |
| commit | 33bbdd3c1a2c92e8d39d461f3b198f034283633b (patch) | |
| tree | 052b1c4a76bac8531d18b97b612b496e09c23d1e /src/api.js | |
| parent | 2b739d818acd045905bcd5e9c9c7c8b0cab98cc9 (diff) | |
| parent | 1d0c1c9bfb9ccfb8a28e0cf147af12c37655cdcc (diff) | |
| download | coinosv3-33bbdd3c1a2c92e8d39d461f3b198f034283633b.tar.gz coinosv3-33bbdd3c1a2c92e8d39d461f3b198f034283633b.zip | |
Merge branch 'master' into boltz-swaps
# Conflicts:
# src/app.js
Diffstat (limited to 'src/api.js')
| -rw-r--r-- | src/api.js | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -204,8 +204,20 @@ export function resolveElectrumUrl() { return electrumCandidates()[0] || null; } +// Regtest realtime push: a local electrs reached over a WS<->TCP bridge (electrs +// is TCP-only). Same Electrum protocol the watcher already speaks, so the wallet +// subscribes scripthashes and reconciles via esplora on each notification. +const REGTEST_ELECTRUM_KEY = 'btc-wallet-regtest-electrum'; +export function getRegtestElectrumWs() { + try { return (localStorage.getItem(REGTEST_ELECTRUM_KEY) || '').trim() || 'ws://localhost:50003'; } + catch { return 'ws://localhost:50003'; } +} +export function setRegtestElectrumWs(url) { try { localStorage.setItem(REGTEST_ELECTRUM_KEY, (url || '').trim()); } catch {} } + export function wsUrl(net) { - if (net !== 'mainnet') return null; // coinos watcher is mainnet-only + // Regtest gets realtime via the local electrs WS bridge (data still via esplora). + if (net === 'regtest') return getRealtimeEnabled() ? getRegtestElectrumWs() : null; + if (net !== 'mainnet') return null; // testnet: poll-only // Electrum backend selects/rotates candidates in the wallet; here we only // resolve the coinos watcher (esplora 'coinos' mode) or null (esplora 'explorer'). if (getBackend() === 'electrum') return null; |
