aboutsummaryrefslogtreecommitdiffstats
path: root/src/api.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-27 09:43:07 -0700
committerAdam Soltys <[email protected]>2026-06-27 09:43:07 -0700
commitaa7ccfeae4d778ab62decbd58c3ddb3f74268274 (patch)
treeef8f2225997eeda7706a2dab9756d7152a7b0516 /src/api.js
parent1d0c1c9bfb9ccfb8a28e0cf147af12c37655cdcc (diff)
downloadcoinosv3-aa7ccfeae4d778ab62decbd58c3ddb3f74268274.tar.gz
coinosv3-aa7ccfeae4d778ab62decbd58c3ddb3f74268274.zip
Use Fulcrum (Electrum/WS) for regtest data + push, dropping esplora
Regtest now talks to a local Fulcrum over its native Electrum WebSocket for both chain data and realtime push, instead of esplora REST + a separate watcher. This matches prod (Fulcrum) and gives ~2-3x lower latency than the previous electrs polling. getBackend()/electrumCandidates() route regtest to the Electrum backend at the configured Fulcrum WS (default ws://localhost:50003); the wallet's realtime path is ungated for regtest. ElectrumApi already covers every call (utxos, history, fees, broadcast), incl. the swap feature. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Diffstat (limited to 'src/api.js')
-rw-r--r--src/api.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api.js b/src/api.js
index 98b7528..bcc5f85 100644
--- a/src/api.js
+++ b/src/api.js
@@ -119,6 +119,9 @@ export const COINOS_ELECTRUM = false;
const COINOS_ELECTRUM_URL = 'wss://coinos.io/electrum';
export function getBackend() {
+ // Regtest runs Fulcrum (Electrum over WS) for both data and realtime push —
+ // matches prod and drops the esplora/electrs dependency.
+ if (getNetwork() === 'regtest') return 'electrum';
const m = getDataMode();
if (m === 'electrum') return 'electrum';
if (m === 'coinos' && COINOS_ELECTRUM) return 'electrum';
@@ -156,6 +159,7 @@ export function setElectrumServerConfig({ server, url }) {
// addresses to a public server you didn't pick.
const PUBLIC_ELECTRUM = () => ELECTRUM_PRESETS.filter((x) => x.url).map((x) => x.url);
export function electrumCandidates() {
+ if (getNetwork() === 'regtest') return [getRegtestElectrumWs()]; // local Fulcrum
if (getDataMode() === 'coinos' && COINOS_ELECTRUM) return [COINOS_ELECTRUM_URL, ...PUBLIC_ELECTRUM()];
const cfg = getElectrumServerConfig();
if (cfg.server === 'custom') return cfg.url.trim() ? [cfg.url.trim()] : [];