aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-08 22:18:59 -0700
committerAdam Soltys <[email protected]>2026-10-08 22:18:59 -0700
commit4171e33f47756fed218fff6237606310976d2d99 (patch)
tree483973ffb29281252a568dafe6785e7e29ecb2c4 /src/features
parent36205bbd6a8be6ad76488e58862fb16798a6cfd6 (diff)
downloadcoinosv3-4171e33f47756fed218fff6237606310976d2d99.tar.gz
coinosv3-4171e33f47756fed218fff6237606310976d2d99.zip
Auto-pay budgets on offer are round money when fiat is the unit on screen ($1, $5, $10, $100 in the user's currency, kept as sats at today's rate) instead of 1k/5k/10k/100k sats shown as odd fiat figures
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/features')
-rw-r--r--src/features/ark.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index 538246d..39936ac 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -27,6 +27,7 @@ import {
getNetwork, setNetwork, getArkProviderId, getArkConfig, setArkProviderId, arkPresets, getArkCustom, setArkCustom,
} from '../api.js';
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';
@@ -370,6 +371,13 @@ export function adoptArkSnapshot(manager, snapshot) {
export function arkFeature(ctx) {
const { h, ui, render, wallet, blankSend, fmtAmount, unitLabel, unitTag, copyBtn, toast, openExternal } = ctx;
+ // Auto-pay budgets on offer: round money in the user's currency when that's
+ // the unit on screen ($1, $5, $10, $100, kept as sats at today's rate),
+ // round sats otherwise.
+ const budgetChoices = () => {
+ const rate = ctx.getUnit && ctx.getUnit() === 'fiat' && rateNow();
+ return rate ? [1, 5, 10, 100].map((f) => Math.ceil((f / rate) * 1e8)) : [1000, 5000, 10000, 100000];
+ };
installArkWallet(wallet); // ark state storage lives outside the core wallet
// Ride the encrypted sync snapshot so ark funds follow the seed across
@@ -1298,7 +1306,7 @@ export function arkFeature(ctx) {
? h('div', { class: 'col', style: 'gap:6px' },
h('span', { class: 'small muted' }, t('lnAutopaySetLabel', { name: zap.name || zap.address || '' })),
h('div', { class: 'row gap6', style: 'flex-wrap:wrap' },
- ...[1000, 5000, 10000, 100000].map((amt) =>
+ ...budgetChoices().map((amt) =>
h('button', { type: 'button',
class: (p.setBudget === amt ? 'btn-primary' : 'btn-ghost') + ' btn-sm',
onClick: () => { p.setBudget = p.setBudget === amt ? 0 : amt; render(); } },