diff options
| author | Adam Soltys <[email protected]> | 2026-10-08 16:34:06 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-08 16:34:06 -0700 |
| commit | e35764950b59bde6e36bdfad1ca671eef564a6d1 (patch) | |
| tree | a72a950e6e8ffd21312b6e2610ee7c73092026bc /src/features/zaps.js | |
| parent | d3a0af140dabdd6b53c1be0532b37f28254633be (diff) | |
| download | coinosv3-e35764950b59bde6e36bdfad1ca671eef564a6d1.tar.gz coinosv3-e35764950b59bde6e36bdfad1ca671eef564a6d1.zip | |
Max fills the amount in the unit the field shows: in fiat that's money floored to the cent (so it never parses back above the maximum), not a BTC figure under a CAD label. One ctx.amountField helper for the ark send/LN Max, the gift Max and fixed-amount zap/BOLT 12 fills
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/features/zaps.js')
| -rw-r--r-- | src/features/zaps.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/features/zaps.js b/src/features/zaps.js index a23ecdd..d327f9d 100644 --- a/src/features/zaps.js +++ b/src/features/zaps.js @@ -94,7 +94,7 @@ export function zapsFeature(ctx) { const off = target.offer; if (off.currency) throw new Error(t('bolt12Currency', { currency: off.currency })); const fixedSat = off.amountMsat ? Number((off.amountMsat + 999n) / 1000n) : null; - if (fixedSat) z.amount = getUnit() === 'sats' ? String(fixedSat) : (fixedSat / 1e8).toFixed(8); + if (fixedSat) z.amount = ctx.amountField(fixedSat); z.params = { minSendable: 1000, maxSendable: 21e15, commentAllowed: 0, allowsNostr: false, fixedSat }; z.status = 'ready'; render(); @@ -118,7 +118,7 @@ export function zapsFeature(ctx) { return; } const fixedSat = n.priceType === 0 && n.priceSats ? n.priceSats : null; - if (fixedSat) z.amount = getUnit() === 'sats' ? String(fixedSat) : (fixedSat / 1e8).toFixed(8); + if (fixedSat) z.amount = ctx.amountField(fixedSat); z.params = { minSendable: 1000, maxSendable: 21e15, commentAllowed: 100, allowsNostr: false, fixedSat }; z.status = 'ready'; render(); @@ -165,7 +165,7 @@ export function zapsFeature(ctx) { // exactly like a fixed-amount BOLT 12 offer. if (params.minSendable === params.maxSendable && params.minSendable >= 1000) { params.fixedSat = Math.ceil(params.minSendable / 1000); - z.amount = getUnit() === 'sats' ? String(params.fixedSat) : (params.fixedSat / 1e8).toFixed(8); + z.amount = ctx.amountField(params.fixedSat); } z.params = params; z.status = 'ready'; @@ -363,7 +363,7 @@ export function zapsFeature(ctx) { !p.fixedSat && (hook('lnMaxSendSat') || 0) > 0 ? h('button', { type: 'button', onClick: () => { const sat = hook('lnMaxSendSat'); - z.amount = getUnit() === 'sats' ? String(sat) : (sat / 1e8).toFixed(8); + z.amount = ctx.amountField(sat); render(); } }, t('max')) : null, |
