diff options
| author | Adam Soltys <[email protected]> | 2026-10-22 23:08:07 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-22 23:08:07 -0700 |
| commit | 56ebe0367021835be7371c70fb2295c439b594c4 (patch) | |
| tree | bd9ee010f75c75551df068ac0e8404451e1d75d4 /src/features/ark.js | |
| parent | a6c30c044a31dd1adc6a7ccf5cffff74ca2d6258 (diff) | |
| download | coinosv3-56ebe0367021835be7371c70fb2295c439b594c4.tar.gz coinosv3-56ebe0367021835be7371c70fb2295c439b594c4.zip | |
Co-operative exit button: the amount in sats or BTC, never fiat
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'src/features/ark.js')
| -rw-r--r-- | src/features/ark.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/features/ark.js b/src/features/ark.js index bc5bd10..3e44805 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -38,7 +38,7 @@ import { t } from '../i18n.js'; import { rateNow } from '../rates.js'; import { resolveBip353, parsePaymentName, parseBip21 as parseBip21Uri } from '../bip353.js'; import { parseZapTarget, fetchPayParams, requestInvoice } from '../lnurl.js'; -import { shortAddr, shortTxid, timeAgo, fmtSats, ARK_ICON, ARK_MARK, BITCOIN_ICON } from '../format.js'; +import { shortAddr, shortTxid, timeAgo, fmtSats, fmtBtc, ARK_ICON, ARK_MARK, BITCOIN_ICON } from '../format.js'; // t?ark1… bech32m — an Ark address for this or another ASP. export function isArkAddress(a) { return /^t?ark1[a-z0-9]{20,}$/i.test((a || '').trim()); } @@ -467,6 +467,10 @@ export function arkFeature(ctx) { // acts (a renewal, an exit) still waits for `ark`. let arkInited = null; const arkView = () => ark || arkInited; + // An amount in bitcoin terms whatever the display unit: sats, or BTC when + // that is the unit chosen — never fiat. A co-operative exit moves coins, + // and the number on its button is the coins' own. + const fmtNative = (sat) => (unitLabel() === 'BTC' ? fmtBtc(sat) + ' BTC' : fmtSats(sat) + ' sats'); // The last server info and chain tip seen, per server, so the first paint // after a refresh shows the real renewal price and expiries instead of // "free" and "—" for the half second the info call takes. @@ -2641,7 +2645,7 @@ export function arkFeature(ctx) { ctx.showSend({ fresh: true }); ui.arkOffboardSend = { address, amount: String(coopSat), fromCoins: true, vtxoIds }; render(); - } }, t('arkOffboardBtn', { n: fmtAmount(coopSat) + ' ' + unitLabel() }))); + } }, t('arkOffboardBtn', { n: fmtNative(coopSat) }))); })(), h('div', { class: 'card col', style: 'gap:8px' }, h('h4', { style: 'margin:0' }, t('arkCoinsExitTitle')), @@ -3770,7 +3774,7 @@ export function arkFeature(ctx) { h('p', { class: 'small muted', style: 'margin:0' }, t('arkCoopDesc')), spendable > 0 ? h('button', { class: 'btn-primary btn-block', disabled: !!ui.arkBusy, onClick: () => doArkOffboard() }, - ui.arkBusy === 'offboard' ? h('span', { class: 'spinner sm' }) : t('arkOffboardBtn', { n: fmtAmount(spendable) + ' ' + unitLabel() })) + ui.arkBusy === 'offboard' ? h('span', { class: 'spinner sm' }) : t('arkOffboardBtn', { n: fmtNative(spendable) })) : h('div', { class: 'small faint' }, exitingSat > 0 ? t('arkExitCoopHeld') : t('arkExitNoBalance'))), // unilateral h('div', { class: 'card col', style: 'gap:8px' }, |
