From fa31fb2721910604abef73049c04b3f872d34a83 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 29 Jul 2026 08:49:41 -0700 Subject: Filter swap providers by network; guard cross-network selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tag each BOLTZ_PRESET with the network(s) it serves and add boltzPresetsFor(net) so the provider dropdown only lists backends valid for the active network — a mainnet wallet no longer shows the local (regtest) or coinos-staging (mutinynet) backends. getBoltzProviderId() now only honors a stored choice if it's valid for the current network, so switching to mainnet can't silently keep using a regtest/mutinynet backend, and the getBoltzProvider() fallback can no longer resolve to staging. Also point the testnet default at custom (was the mainnet Boltz API). Co-Authored-By: Claude Opus 4.8 --- src/features/swaps.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/features') diff --git a/src/features/swaps.js b/src/features/swaps.js index 2ff43ed..3e97412 100644 --- a/src/features/swaps.js +++ b/src/features/swaps.js @@ -3,7 +3,7 @@ // protocol layer lives in ../swap.js. import { SwapManager, installSwapWallet } from '../swap.js'; -import { getNetwork, getBoltzApi, BOLTZ_PRESETS, getBoltzProviderId, setBoltzProviderId, getBoltzCustom, setBoltzCustom } from '../api.js'; +import { getNetwork, getBoltzApi, boltzPresetsFor, getBoltzProviderId, setBoltzProviderId, getBoltzCustom, setBoltzCustom } from '../api.js'; import { t } from '../i18n.js'; import { qrSvg } from '../qr.js'; import { fmtBtc } from '../format.js'; @@ -84,7 +84,7 @@ export function swapsFeature(ctx) { h('h3', {}, '⚡ Swap provider'), h('p', { class: 'small muted', style: 'margin:0' }, 'Boltz-compatible provider for Lightning swaps. Non-custodial: a provider can fail a swap but never take your funds.'), h('select', { onChange: (e) => { setBoltzProviderId(e.target.value); ui.swapLimits = null; render(); } }, - BOLTZ_PRESETS.map((p) => h('option', { value: p.id, selected: p.id === id }, p.label))), + boltzPresetsFor(getNetwork()).map((p) => h('option', { value: p.id, selected: p.id === id }, p.label))), id === 'custom' ? h('div', { class: 'col', style: 'gap:8px' }, h('label', { class: 'field' }, -- cgit v1.2.3