diff options
| author | Adam Soltys <[email protected]> | 2026-07-29 08:49:41 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-07-29 08:49:41 -0700 |
| commit | fa31fb2721910604abef73049c04b3f872d34a83 (patch) | |
| tree | e8b68c5f0982dabb56ac5bb67f1843193aeaa525 /src/features | |
| parent | 0fb4b03b48bda2ba187d96d1feb4459716b8e73c (diff) | |
| download | coinosv3-fa31fb2721910604abef73049c04b3f872d34a83.tar.gz coinosv3-fa31fb2721910604abef73049c04b3f872d34a83.zip | |
Filter swap providers by network; guard cross-network selection
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 <[email protected]>
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/swaps.js | 4 |
1 files changed, 2 insertions, 2 deletions
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' }, |
