diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.js | 145 | ||||
| -rw-r--r-- | src/features/ark.js | 60 | ||||
| -rw-r--r-- | src/features/names.js | 2 | ||||
| -rw-r--r-- | src/features/nostrlogin.js | 13 | ||||
| -rw-r--r-- | src/i18n.js | 12 |
5 files changed, 191 insertions, 41 deletions
@@ -1886,6 +1886,12 @@ async function enterWallet(mnemonic, passphrase, opts = {}) { if (opts.spendingOnly && !acc.kind && !acc.deriveIndex && !acc.savingsAdded && acc.type === 'full') { acc.kind = 'spending'; acc.savingsLater = true; } else if (opts.signup && acc.kind === 'spending') acc.savingsLater = true; + // ...unless balances are one: then a sign-up is simply the account, its + // on-chain side there underneath for whenever someone pays on-chain + if (acc.kind === 'spending' && acc.savingsLater && !acc.deriveIndex && !separateBalances()) { + delete acc.kind; delete acc.savingsLater; + if (!acc.spendingSetup) acc.spendingSetup = Date.now(); + } await activateAccount(acc, { ...opts, fresh: true }); } @@ -3705,8 +3711,8 @@ function accountsScreen() { // has to say which identity. ...groupAccounts().flatMap(({ pk, rows }) => [ identityHeading(pk), - ...rows.flatMap((a) => viewsOf(a).map((view) => { - const isActive = a.id === activeId && accountSel() === view; + ...rows.flatMap((a) => (a.id === activeId && unifiedOn(a) ? ['all'] : viewsOf(a)).map((view) => { + const isActive = a.id === activeId && (view === 'all' || accountSel() === view); const netTag = a.network && a.network !== 'mainnet' ? ' · ' + a.network : ''; const seedTag = ''; const tag = (a.type === 'watch' ? ' · ' + t('watchOnlyTag') : '') + netTag + seedTag; @@ -3947,12 +3953,13 @@ function recoveryCard(a) { // cannot find this option" (Nils, 2026-11-12) about the Spending card's gear. function balanceSettingsCard(a) { if (a.id !== activeId) return null; - const views = a.kind ? [a.kind] : spendingActive() ? ['spending', 'savings'] : ['savings']; + const unified = unifiedOn(a); + const views = unified ? ['all'] : a.kind ? [a.kind] : spendingActive() ? ['spending', 'savings'] : ['savings']; // Each balance wears its own mark in a tinted tile — the bolt and the // bitcoin disc the balance card uses — rather than a gear beside one and a // coin beside the other (Adam, 2026-11-15: "Icons and padding need work"). const BOLT = '<svg width="21" height="21" viewBox="0 0 24 24" fill="currentColor" style="display:block"><path d="M13.5 2 4 13.5h6.5L9.5 22 20 9.5h-6.6z"/></svg>'; - const tile = (view) => h('span', { class: 'bs-tile ' + (view === 'spending' ? 'spend' : 'save'), html: view === 'spending' ? BOLT : BITCOIN_ICON(22) }); + const tile = (view) => h('span', { class: 'bs-tile ' + (view === 'savings' ? 'save' : 'spend'), html: view === 'savings' ? BITCOIN_ICON(22) : BOLT }); const rowOf = (attrs, view, title, desc, tail) => h('button', { class: 'balance-settings-row', ...attrs }, tile(view), h('span', { class: 'col bs-text' }, @@ -3960,13 +3967,20 @@ function balanceSettingsCard(a) { h('span', { class: 'small muted' }, desc)), h('span', { class: 'bs-tail', 'aria-hidden': 'true' }, tail)); const row = (view) => rowOf({ 'data-view': view, onClick: () => openWalletSettings(view) }, view, - viewLabel(a, view), t(view === 'spending' ? 'spendingSettingsDesc' : 'savingsSettingsDesc'), '›'); + viewLabel(a, view), t(view === 'all' ? 'allSettingsDesc' : view === 'spending' ? 'spendingSettingsDesc' : 'savingsSettingsDesc'), '›'); // a sign-up's Spending-only account: Savings is one tap away const addRow = a.kind === 'spending' && a.savingsLater && !a.deriveIndex ? rowOf({ id: 'add-savings', onClick: () => { addSavings(a); toast(t('savingsAddedToast')); } }, 'savings', t('addSavings'), t('addSavingsDesc'), '+') : null; - return h('div', { class: 'card col', style: 'gap:8px' }, h('h3', {}, t('balanceSettingsTitle')), ...views.map(row), addRow); + // one balance or two, per device: the same seed and coins either way + const apart = !a.kind && a.type === 'full' && spendingActive() + ? h('label', { class: 'row gap6', style: 'align-items:center;cursor:pointer;padding:6px 2px 0' }, + h('input', { type: 'checkbox', id: 'separate-balances', checked: separateBalances(), + onChange: (e) => { setSeparateBalances(e.target.checked); ui.recvOnchain = false; render(); } }), + h('span', { class: 'small' }, t('separateBalances'))) + : null; + return h('div', { class: 'card col', style: 'gap:8px' }, h('h3', {}, t('balanceSettingsTitle')), ...views.map(row), unified ? null : addRow, apart); } function walletNameCard(a) { const saveName = () => { @@ -4097,7 +4111,7 @@ function accountSettingsScreen() { const a = accounts.find((x) => x.id === ui.settingsId) || activeAccount(); if (!a) { ui.screen = 'accounts'; return accountsScreen(); } const view = ui.settingsView || accountSel(); - const spending = view === 'spending' && a.id === activeId; + const spending = (view === 'spending' || view === 'all') && a.id === activeId; const leave = () => { ui.editLabel = null; ui.revealShown = false; ui.pubkeyShown = false; ui.loadSeed = null; goBack(() => { ui.screen = 'wallet'; }); }; return h( 'div', @@ -4642,7 +4656,7 @@ function onboardScreen() { // A sign-up's name is the account itself — what people pay, follow and // message — so it's claimed here, not skipped. const signupAcc = activeAccount(); - const signup = !o.fromGift && !!(signupAcc && signupAcc.signupAt && signupAcc.kind === 'spending'); + const signup = !o.fromGift && !!(signupAcc && signupAcc.signupAt && (signupAcc.kind === 'spending' || !signupAcc.kind)); return page([ title(t(o.fromGift ? 'onbGiftNameTitle' : signup ? 'onbNameTitle' : 'onbSpendTitle')), h('p', { class: 'muted', style: 'margin:0' }, t(o.fromGift ? 'onbGiftNameBody' : signup ? 'onbNameBody' : 'onbSpendBody')), @@ -5007,6 +5021,8 @@ function addSavings(acc, { quiet = false } = {}) { function savingsEvident() { const a = activeAccount(); if (!a || a.kind !== 'spending' || !a.savingsLater || !wallet.loaded) return; + // one balance: on-chain is part of the account from the start, nothing to add + if (!separateBalances()) { addSavings(a, { quiet: true }); return; } if ((wallet.spendable || 0) > 0 || (wallet.pendingIncoming || 0) > 0 || (wallet.txs || []).length) addSavings(a, { quiet: true }); } // The shape rides the synced snapshot, so the phone opens the account the @@ -5024,7 +5040,7 @@ wallet.registerCacheExtension({ const a = activeAccount(); if (!d || !a || a.type !== 'full' || a.deriveIndex) return; if (d.savingsAdded) { if (addSavings(a, { quiet: true }) === false && !a.savingsAdded) { a.savingsAdded = d.savingsAdded; persistAccounts(); } return; } - if (d.spendingOnly && !a.kind && !a.savingsAdded && !(wallet.txs || []).length && !(wallet.spendable || 0)) { + if (d.spendingOnly && separateBalances() && !a.kind && !a.savingsAdded && !(wallet.txs || []).length && !(wallet.spendable || 0)) { a.kind = 'spending'; a.savingsLater = true; persistAccounts(); } @@ -5155,6 +5171,37 @@ function offlineBanner() { // Lightning) or Savings (on-chain). The balance card headline, the Receive // pane, and the gift source all follow it. const ACCOUNT_KEY = 'btc-wallet-account'; +// One balance (Adam, 2026-11-15: "combine the Ark and savings Bitcoin +// accounts into a single account … a combined history … the balance would +// be unified"). A seed with both sides shows ONE account: the total, one +// timeline (a move between the two is one row, priced at what it cost), and +// Receive leading with the payment address, an on-chain address a tap away. +// Money stays where it lands; a payment picks its coins by where it's going +// (Lightning/Ark from the Ark coins, an on-chain address from on-chain coins +// first). Settings → Wallet can still show the two apart, per device. +const SEPARATE_KEY = 'btc-wallet-separate-balances'; +function separateBalances() { + try { return localStorage.getItem(SEPARATE_KEY) === '1'; } catch { return false; } +} +function setSeparateBalances(on) { + try { on ? localStorage.setItem(SEPARATE_KEY, '1') : localStorage.removeItem(SEPARATE_KEY); } catch {} +} +function unifiedOn(a = activeAccount()) { + return !!a && !a.kind && a.type === 'full' && !separateBalances() && spendingActive(); +} +// History rows, both rails merged: on-chain transactions plus the features' +// entries. A feature row can stand in for an on-chain transaction +// (`replacesTxid` — a board or an offboard to our own address, told once). +function historyEntriesFor(sel) { + const all = sel === 'spending' ? [] : wallet.history || []; + const feat = featureAll('historyEntries', all, sel); + const replaced = new Set(feat.map((e) => e.replacesTxid).filter(Boolean)); + const txs = replaced.size ? all.filter((tx) => !replaced.has(tx.txid)) : all; + return [ + ...txs.map((tx) => ({ time: tx.confirmed ? (tx.blockTime || 0) * 1000 : Date.now(), render: () => txHistoryItem(tx) })), + ...feat, + ].sort((a, b) => b.time - a.time); +} // Spending is opt-in: a wallet is born on-chain only, and the second balance // (with its toggle, swipe, and Move money) appears once the user sets it up — // or the moment money is already there (a restored wallet, a claimed gift), @@ -5212,6 +5259,7 @@ function seedName(a) { } function viewLabel(a, view) { if (a && a.viewLabels && a.viewLabels[view]) return a.viewLabels[view]; + if (view === 'all') return t('balance'); return view === 'spending' ? t('spendingName') : t('savingsName'); } function switchToView(id, view) { @@ -5228,6 +5276,9 @@ function switchToView(id, view) { function accountSel() { const a = activeAccount(); if (a && a.kind) return a.kind; // single-purpose wallet: no other side + // one balance: payments start from the Ark coins; the send flow picks + // on-chain coins for an on-chain address itself (ark.js matchSend) + if (unifiedOn(a)) return 'spending'; if (!spendingActive()) return 'savings'; // one balance, no choice if (!ui.account) { let saved = null; @@ -5264,12 +5315,9 @@ function walletSide() { const toWallet = (tab) => { goHome(); ui.tab = tab; render(); }; const spending = featureHook('spendingSat') || 0; const saving = wallet.spendable || 0; - const sel = accountSel(); - const txs = sel === 'spending' ? [] : wallet.history || []; - const entries = wallet.loaded ? [ - ...txs.map((tx) => ({ time: tx.confirmed ? (tx.blockTime || 0) * 1000 : Date.now(), render: () => txHistoryItem(tx) })), - ...featureAll('historyEntries', txs, sel), - ].sort((a, b) => b.time - a.time).slice(0, 6) : []; + const unified = unifiedOn(); + const sel = unified ? 'all' : accountSel(); + const entries = wallet.loaded ? historyEntriesFor(sel).slice(0, 6) : []; const rows = entries.map((e) => { const row = e.render(); // a row opens its detail on the wallet page: go there first @@ -5284,8 +5332,8 @@ function walletSide() { h('button', { type: 'button', class: 'wallet-side-total', onClick: () => toWallet('history') }, h('span', { class: 'small muted' }, t('balance')), h('span', { class: 'wallet-side-amount' }, wallet.loaded ? fmtAmount(spending + saving) + ' ' + unitLabel() : '…')), - spendingActive() ? line(t('spendingLabel'), spending) : null, - spendingActive() ? line(t('savingLabel'), saving) : null, + spendingActive() && (!unified || (spending > 0 && saving > 0)) ? line(unified ? t('balInstant') : t('spendingLabel'), spending) : null, + spendingActive() && (!unified || (spending > 0 && saving > 0)) ? line(unified ? t('balOnchain') : t('savingLabel'), saving) : null, h('div', { class: 'row gap6' }, h('button', { type: 'button', class: 'btn-primary grow', onClick: () => toWallet('receive') }, t('tabReceive')), h('button', { type: 'button', class: 'btn-primary grow', onClick: () => toWallet('send') }, t('tabSend')))), @@ -5396,7 +5444,7 @@ function balanceCard() { try { localStorage.setItem(ACCOUNT_KEY, 'spending'); } catch {} } ui.arkMoveDir = 'toSpending'; ui.arkMoveOpen = true; render(); - } }, t('topUpFromSavings')) + } }, unifiedOn() ? t('topUpInstant') : t('topUpFromSavings')) : null, !hasSpending && !kindLocked && featureHook('arkReady') && !wallet.watchOnly && acc0 && acc0.type === 'full' && featureHook('namesSettled') !== 'pending' // a restoring name may prove Spending any second — don't flash the setup ask @@ -5421,6 +5469,32 @@ function balanceCard() { return w; })(), ]; + // One account: one face with everything on it. Where it sits shows only + // when it's in both places (instant Ark coins, on-chain coins) — and every + // line under the figure (pending, moving, locked in gifts) belongs to it. + if (unifiedOn()) { + const split = spending > 0 && saving > 0 + ? [{ label: t('balInstant'), sat: spending }, { label: t('balOnchain'), sat: saving }] : []; + const lines = split + .concat(pending > 0 ? [{ label: t('pending'), sat: pending, cls: 'v pending' }] : []) + .concat(featLines); + _accDir = null; + return h('div', { class: 'card balance balance-one' }, + h('div', { class: 'balance-face' }, + h('div', { class: 'row between', style: 'align-items:center' }, + h('div', { class: 'small faint', style: 'text-transform:uppercase;letter-spacing:.06em' }, + (acc0.viewLabels && acc0.viewLabels.all) || ''), + manageBtn('all')), + h('div', { class: 'amt', style: firstLoad ? 'opacity:.3' : '' }, + firstLoad ? h('span', { class: 'spinner sm', style: 'margin-right:8px' }) : null, + // mid-board money is still this account's: it counts, and its Moving line says where it is + animatedAmount('bal:all', spending + (saving || 0) + (featureHook('spendingBoardingSat') || 0)), ' ', unitTag('unit')), + lines.length + ? h('div', { class: 'split' }, + ...lines.map((l) => h('div', {}, h('div', { class: 'k' }, l.label), h('div', { class: l.cls || 'v' }, fmtAmount(l.sat), ' ', unitTag())))) + : null), + ...cardExtras('spending')); + } const carouselMode = hasSpending && !kindLocked; if (carouselMode) { // Two SEPARATE cards side by side — the neighbor card peeks past the @@ -5714,6 +5788,7 @@ function tabsBar() { tabBtn(label, ui.tab === id, () => { ui.tab = ui.tab === id ? 'history' : id; ui.sendError = ''; // a stale send error never survives a tab change + ui.recvOnchain = false; // Receive opens on the payment address again ui.revealShown = false; // re-mask the recovery phrase whenever tabs change ui.nostrExportStep = false; // and the exported nostr key ui.txDetail = null; // back to the history list when leaving/returning @@ -5808,6 +5883,11 @@ function iconGlyph(ic) { : h('span', { class: 'sel-ico' }, ic); } +// One account's Receive: the door to an on-chain address under the payment one. +function receiveOnchainBtn() { + if (!unifiedOn() || wallet.watchOnly) return null; + return h('button', { class: 'btn-block', id: 'recv-onchain', onClick: () => { ui.recvOnchain = true; render(); } }, t('recvOnchain')); +} function receiveTab() { // Feature takeovers: boarding success, Ark receive celebration, etc. const takeover = featureHook('receiveTakeover'); @@ -5846,6 +5926,17 @@ function receiveTab() { // (receives Ark and Lightning), Savings shows a fresh on-chain address. const fresh = wallet.freshReceive(); const nameMode = featureAll('receiveModes').find((m) => m.id === 'name'); + // One account: the payment address leads, an on-chain address is a tap + // away (and is all there is offline). What arrives on-chain stays on-chain. + if (unifiedOn() && (ui.recvOnchain || wallet.offline)) { + return h('div', { class: 'card col', style: 'align-items:center;gap:14px' }, + wallet.offline ? h('div', { class: 'notice info', style: 'width:100%' }, t('receiveOfflineOnchain')) : null, + h('div', { html: qrSvg(fresh.address) }), + h('div', { class: 'addr-box', style: 'width:100%' }, fresh.address), + copyBtn(fresh.address, t('copyAddress')), + h('div', { class: 'small muted', style: 'text-align:center' }, t('recvOnchainNote')), + wallet.offline ? null : h('button', { class: 'btn-block', id: 'recv-payaddr', onClick: () => { ui.recvOnchain = false; render(); } }, t('recvPaymentAddress'))); + } if (accountSel() === 'spending') { // Spending needs the network (registrar + ark); offline, offer the // on-chain path right here instead of an endless spinner. @@ -5869,7 +5960,8 @@ function receiveTab() { h('div', { html: qrSvg(ui.arkRecvAddr) }), h('div', { class: 'addr-box break', style: 'width:100%' }, ui.arkRecvAddr), copyBtn(ui.arkRecvAddr, t('copyAddress')), - featureHook('posAvailable') ? h('button', { class: 'btn-block', id: 'recv-amount', onClick: () => featureHook('openAmountRequest') }, t('recvAmount')) : null + featureHook('posAvailable') ? h('button', { class: 'btn-block', id: 'recv-amount', onClick: () => featureHook('openAmountRequest') }, t('recvAmount')) : null, + receiveOnchainBtn() ); } } @@ -6795,7 +6887,7 @@ function historyTab() { // ledger (BIP84 txs, silent-payment receipts, gift reservations), Spending // shows the ark side (receives, sends, boards, LN) — each card of the // carousel owns its own timeline. - const histSel = accountSel(); + const histSel = unifiedOn() ? 'all' : accountSel(); const txs = histSel === 'spending' ? [] : wallet.history; // newest first const featDetail = featureHook('historyDetail'); if (featDetail) return featDetail; @@ -6813,16 +6905,11 @@ function historyTab() { h('span', { class: 'spinner' }), wallet.historyLoading ? h('p', { class: 'small muted', style: 'margin:0' }, t('loadingHistory')) : null ); - const featEntries = featureAll('historyEntries', txs, histSel); + // Transactions and feature entries merge into one timeline. + const entries = historyEntriesFor(histSel); // nothing yet: no card at all, it appears with the first payment // (Adam, 2026-11-15: "let's not show an empty history section") - if (!txs.length && !featEntries.length) return null; - - // Transactions and feature entries merge into one timeline. - const entries = [ - ...txs.map((tx) => ({ time: tx.confirmed ? (tx.blockTime || 0) * 1000 : Date.now(), render: () => txHistoryItem(tx) })), - ...featEntries, - ].sort((a, b) => b.time - a.time); + if (!entries.length) return null; const txPages = Math.ceil(entries.length / PAGE_SIZE); const txPage = Math.min(ui.txPage, Math.max(0, txPages - 1)); const txSlice = entries.slice(txPage * PAGE_SIZE, txPage * PAGE_SIZE + PAGE_SIZE); @@ -7050,6 +7137,8 @@ const ctx = { shownPubkey: () => (featureHook('nostrLoginIdentity') || {}).pubkey || (wallet.nostrPubkey && wallet.nostrPubkey()) || (activeAccount() || {}).nostrPk || null, getAccount: () => accountSel(), + unifiedBalance: () => unifiedOn(), + receiveOnchainBtn: () => receiveOnchainBtn(), setAccount: (a, dir) => setAccountSel(a, dir), offerProfileSetup, pickConfirm, // the ways back in (Settings → Wallet): what's set up, and adding one diff --git a/src/features/ark.js b/src/features/ark.js index 0456628..2c1a581 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -1516,13 +1516,27 @@ export function arkFeature(ctx) { : m.type === 'ln-send' && m.invoice ? zapNotes()['inv:' + m.invoice] : null; - function arkHistoryItem(m) { + // A move inside one account (on-chain ⇄ Ark): no money in or out, only + // what moving it cost. + function arkInternalMoveItem(m, feeSat, pending) { + const label = m.type === 'board' ? (pending ? t('movingInstant') : t('movedInstant')) : t('movedOnchain'); + return h('div', { class: 'item internal-move', style: m.id ? 'cursor:pointer' : '', onClick: m.id ? () => { ui.arkMoveDetail = m.id; render(); } : undefined }, + h('div', { class: 'ico' }, '\u21c4'), + h('div', { class: 'grow' }, + h('div', {}, label), + h('div', { class: 'small faint' }, (pending ? t('pending') + ' · ' : '') + fmtAmount(m.amountSat || 0) + ' ' + unitLabel() + ' · ' + timeAgo((m.ts || Date.now()) / 1000))), + h('div', { style: 'text-align:right' }, + feeSat > 0 ? h('div', { class: 'amount-neg' }, fmtAmount(feeSat)) : h('div', { class: 'small faint' }, t('arkDepthFree')))); + } + + function arkHistoryItem(m, labelAs) { const failed = m.status === 'failed'; const incoming = !['send', 'offboard', 'exit', 'ln-send', 'refresh'].includes(m.type); - const label = failed ? t('arkLnPayFailed') : m.type === 'receive' ? t('received') : m.type === 'board' ? t('arkBoarded') + let label = failed ? t('arkLnPayFailed') : m.type === 'receive' ? t('received') : m.type === 'board' ? t('arkBoarded') : m.type === 'ln-send' ? t('arkLnPaidHistory') : m.type === 'ln-receive' ? t('arkLnReceivedHistory') : m.type === 'offboard' ? t('arkOffboarded') : m.type === 'exit' ? t('arkExited') : m.type === 'refresh' ? t('arkRenewedHistory') : t('sent'); + if (labelAs) label = labelAs; // A spent input proves neither a payment amount nor its date: it can // contain change, an offboard, or a renewal this device has not synced. // Show the missing history explicitly until its records arrive. @@ -4270,7 +4284,11 @@ export function arkFeature(ctx) { } // In a Spending wallet an on-chain address means "exit ark to there": // the offboard happens right in the send flow, no Move money ceremony. - if (ctx.getAccount() === 'spending' && wallet.isOnchainAddress(inv) && arkAvailable()) { + // One balance: an on-chain address is paid from the on-chain coins + // when there are any — one ordinary transaction, nothing to move out + // of Ark first. Only without them does the payment leave Ark. + const onchainFirst = ctx.unifiedBalance && ctx.unifiedBalance() && (wallet.spendable || 0) > 0; + if (ctx.getAccount() === 'spending' && !onchainFirst && wallet.isOnchainAddress(inv) && arkAvailable()) { const b = arkBalance() || {}; if ((b.spendableSat || 0) > 0) { ui.arkOffboardSend = { address: inv, amount: '' }; @@ -4333,10 +4351,11 @@ export function arkFeature(ctx) { render(); } }, t('arkExitInFlightLink', { n: fmtAmount(acts.reduce((s2, a) => s2 + a.amountSat, 0)) })); }, - historyEntries(_txs, sel) { - if (sel && sel !== 'spending') return []; // ark movements are the Spending timeline + historyEntries(txs, sel) { + if (sel && sel !== 'spending' && sel !== 'all') return []; // ark movements are the Spending timeline const s = arkStateNow(); if (!s) return []; + if (sel === 'all') return this._histOne(s, txs || []); // Memoized on the state's REVISION, not a timer. This rebuild sorts and // dedupes every movement, resolves gifts, and touches secp256k1 — ~60ms // cold. A 1.5s TTL used to re-cool it between unhurried flicks, so every @@ -4349,6 +4368,35 @@ export function arkFeature(ctx) { this._histMemo = { key, val }; return val; }, + // One balance's timeline: a board, or an offboard to our own on-chain + // address, moves money between two halves of the same account. Its + // on-chain transaction and its Ark movement were two rows (Sent, then + // Boarded); here they're one, worth what the move cost. + _histOne(s, txs) { + const key = `${s._rev || 0}:${(s.movements || []).length}:${(s.actions || []).length}`; + if (!(this._histMemo && this._histMemo.key === key)) this._histMemo = { key, val: this._histBuild(s) }; + const own = new Map(txs.map((tx) => [tx.txid, tx])); + const rows = this._histMemo.val.map((e) => { + const m = e.m; + // with no Savings to move to, an offboard elsewhere is a payment + if (m && m.type === 'offboard' && !(m.txid && own.has(m.txid))) return { ...e, render: () => arkHistoryItem(m, t('sent')) }; + if (!m || !m.txid || !own.has(m.txid) || (m.type !== 'board' && m.type !== 'offboard')) return e; + const tx = own.get(m.txid); + const feeSat = m.type === 'board' ? Math.max(0, -(tx.net || 0) - (m.amountSat || 0)) : (m.feeSat || 0); + return { ...e, replacesTxid: m.txid, render: () => arkInternalMoveItem(m, feeSat, false) }; + }); + // a board still waiting on its funding transaction's confirmations + const told = new Set(rows.map((e) => e.replacesTxid).filter(Boolean)); + for (const a of s.actions || []) { + if (a.type !== 'board' || !a.fundingTxid || ['done', 'failed'].includes(a.step) || told.has(a.fundingTxid)) continue; + const tx = own.get(a.fundingTxid); + if (!tx) continue; + const m = { id: null, type: 'board', amountSat: (a.amountSat || 0) - (a.feeSat || 0), ts: exitStartedTs(a), txid: a.fundingTxid }; + const feeSat = Math.max(0, -(tx.net || 0) - m.amountSat); + rows.push({ time: m.ts, replacesTxid: a.fundingTxid, render: () => arkInternalMoveItem(m, feeSat, true) }); + } + return rows; + }, _histBuild(s) { // In-flight exits are payments the user made — they belong in history // as pending records, not on a monitoring page nobody thinks to visit. @@ -4432,7 +4480,7 @@ export function arkFeature(ctx) { } } this._histFolded = folded; // a folded row's detail shows the whole payment - return exits.concat(renewals, lnPending, out.map((m) => ({ time: m.ts, render: () => arkHistoryItem(m), csv: arkCsvRow(m) }))); + return exits.concat(renewals, lnPending, out.map((m) => ({ time: m.ts, m, render: () => arkHistoryItem(m), csv: arkCsvRow(m) }))); }, historyDetail() { if (ui.arkExitDetail) { diff --git a/src/features/names.js b/src/features/names.js index 81b64e6..e1f23ce 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -685,6 +685,8 @@ export function namesFeature(ctx) { }))), // ask for a sum: the point of sale's amount pad and invoice, simplified hook('posAvailable') ? h('button', { class: 'btn-block', id: 'recv-amount', onClick: () => hook('openAmountRequest') }, t('recvAmount')) : null, + // one balance: an on-chain address for the payers who need one + ctx.receiveOnchainBtn ? ctx.receiveOnchainBtn() : null, moreSection()); } diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js index 6f700b1..5ef6fb8 100644 --- a/src/features/nostrlogin.js +++ b/src/features/nostrlogin.js @@ -16,7 +16,7 @@ import { qrSvg } from '../qr.js'; import { extensionSigner, bunkerSigner, keySigner, parseNostrSecret, walletForSigner, publishWalletBackup, fetchWalletBackup, nostrConnect, nostrConnectPending, resumeBunker, - amberAvailable, amberSigner, amberPending, amberDeliver, amberCancel, amberOpen, onAmberChange } from '../nostr-login.js'; + amberSigner, amberPending, amberDeliver, amberCancel, amberOpen, onAmberChange } from '../nostr-login.js'; // The nostr ostrich, in the brand's monochrome. const OSTRICH = '<svg width="23" height="23" style="display:block" viewBox="0 0 2000 2000" fill="none" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="ng" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#B84FE8"/><stop offset="100%" stop-color="#6D28D9"/></linearGradient></defs><circle cx="1000" cy="1000" r="1000" fill="url(#ng)"/><g transform="translate(1000 1000) scale(0.82) translate(-1000 -1000)"><path d="M1574.29 770.408C1532.04 840.612 1445.92 888.367 1437.96 892.449C1421.84 901.02 1415.92 913.469 1416.94 932.041C1417.96 950.612 1413.47 1042.65 1357.35 1083.27C1328.57 1104.08 1212.45 1131.02 1159.18 1140C1131.84 1144.69 1125.51 1153.06 1110.41 1162.04C1090 1174.69 1017.55 1275.1 1005.31 1297.35C1006.94 1297.14 1233.67 1226.73 1243.88 1225.1C1270.82 1221.02 1291.22 1228.78 1304.49 1248.37C1317.14 1267.14 1329.59 1286.12 1342.04 1305.1C1346.53 1311.84 1350.82 1318.78 1355.1 1325.71L1359.59 1332.86C1361.22 1335.51 1363.47 1338.57 1364.49 1342.65C1365.31 1345.51 1367.14 1355.1 1361.63 1360.82C1356.53 1366.12 1347.76 1366.12 1343.06 1364.9C1338.57 1363.67 1331.84 1361.02 1326.33 1356.53L1318.78 1350.2C1312.86 1345.1 1301.63 1342.65 1292.86 1343.06C1282.65 1343.47 1269.18 1340.2 1262.65 1336.12C1250 1327.96 1246.73 1307.55 1246.73 1307.35C1245.1 1300.61 1240.2 1298.78 1235.71 1298.78C1227.55 1298.57 1221.22 1301.02 1214.69 1302.86C1184.9 1311.84 1155.31 1321.02 1125.51 1330.41L1082.86 1343.67C1061.84 1350.2 1040.82 1356.73 1020 1363.67C1014.29 1365.51 1008.78 1368.37 1002.86 1371.43C1000.41 1372.65 997.959 1373.88 995.51 1375.1C993.061 1376.33 990.408 1377.76 987.959 1379.18C982.449 1382.24 976.531 1385.51 970 1387.35C948.776 1393.67 930.204 1384.49 921.429 1363.27C915.714 1349.59 920.816 1322.45 923.878 1314.49C943.061 1264.69 1005.51 1170.82 1005.51 1170.2C1004.49 1169.8 936.327 1197.14 925.102 1205.71C894.286 1229.18 822.041 1284.69 821.02 1290C816.327 1314.69 801.02 1333.27 777.551 1342.45C760.612 1348.98 750.408 1362.45 740.408 1375.51C740.408 1375.51 559.388 1624.9 547.143 1638.37C543.469 1642.45 509.592 1677.96 500.612 1694.49C498.571 1698.57 490.816 1714.9 488.776 1718.98C487.143 1722.24 483.469 1731.02 469.592 1730.41C455.714 1729.8 455.306 1710.41 454.694 1702.04C453.265 1681.43 457.755 1661.22 468.571 1640C469.592 1637.96 481.837 1619.39 477.347 1604.49C473.265 1591.43 469.388 1571.22 475.51 1561.02C485.102 1544.9 502.041 1544.29 524.694 1540.61C540.408 1537.96 551.837 1530.2 562.857 1514.08C586.122 1480.2 673.674 1355.92 693.469 1327.14C698.776 1319.59 702.857 1309.8 704.694 1300.2C710.408 1271.22 727.959 1251.02 758.571 1238.57C765.102 1235.92 886.939 1134.08 886.939 1121.02C886.939 1111.63 873.674 1106.53 863.469 1103.67C862.041 1103.27 785.51 1083.47 750.612 1067.55C731.633 1058.98 717.347 1051.43 700.408 1039.18C677.347 1022.24 631.225 1030.41 624.49 1031.43C591.837 1036.12 567.551 1050.82 540 1069.39C535.102 1072.86 510 1081.84 497.347 1074.69C472.653 1060.61 418.367 1035.31 398.367 1004.9C389.184 990.816 390.408 967.959 396.939 942.653C417.959 883.878 448.98 857.551 506.327 841.633C547.143 827.551 629.388 824.49 668.98 821.429C671.633 820.612 759.388 818.571 821.02 786.939C862.041 765.918 983.878 684.898 1159.18 690.408C1230 692.653 1363.88 761.837 1415.51 763.878C1468.16 766.122 1494.49 760.204 1524.9 728.776C1533.47 719.796 1570 641.02 1535.51 597.959C1522.65 582.041 1509.39 567.755 1494.08 554.694C1473.47 537.143 1452.04 520.408 1433.47 500.612C1392.45 457.143 1379.8 397.755 1399.18 351.429C1411.63 318.98 1437.76 304.898 1475.51 312.245C1502.04 317.347 1521.43 341.225 1540.41 353.878C1551.02 361.02 1568.78 365.102 1580.41 367.959C1595.1 371.429 1606.12 382.653 1605.51 390.204C1604.9 397.755 1585.51 404.286 1566.94 402.857C1544.9 401.429 1507.14 401.225 1484.49 408.776C1469.39 414.286 1462.65 431.02 1467.14 447.551C1470.82 461.02 1499.59 485.102 1510.41 494.082C1532.04 511.837 1555.1 527.959 1573.06 550.204C1593.27 575.51 1603.88 604.286 1607.14 636.122C1612.04 684.898 1599.18 728.776 1574.29 770.408Z" fill="#fff"/></g></svg>'; @@ -483,12 +483,11 @@ export function nostrLoginFeature(ctx) { onClick: () => run(() => extensionSigner()) }, t('nlExtension')) : null, nostrConnectSection(run), - // On Android, the signer app straight through an intent (NIP-55): works - // with Amber offline, no bunker, no relay — one trip through the app - // per signature. - amberAvailable() - ? h('button', { class: 'btn-block', disabled: ui.nostrLoginBusy, onClick: () => run(() => amberSigner()) }, t('nlAmber')) - : null, + // No separate Android-intent (NIP-55) door any more (Adam, 2026-11-15): + // it opened the same Amber as Connect a signer app, but a login made + // that way couldn't read messages. Accounts that already came in by + // intent keep working (resumeLogin), and their pending requests still + // show here. amberWaitCard(), // These are alternatives, not steps: without the divider the field under // the button reads as something you also have to fill in. diff --git a/src/i18n.js b/src/i18n.js index bb82ed2..9dfc172 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1679,6 +1679,18 @@ const STR = { settingsAdvancedDesc: 'Network, rarities, rescues', aboutTitle: 'About', recvAmount: 'Amount', + recvOnchain: 'Bitcoin address', + recvPaymentAddress: 'Payment address', + recvOnchainNote: 'For a payment on-chain, from an exchange or another wallet. It stays on-chain until you spend it.', + receiveOfflineOnchain: "You're offline. This on-chain address still takes payments.", + balInstant: 'Instant', + balOnchain: 'On-chain', + topUpInstant: 'Make on-chain bitcoin instant', + allSettingsDesc: 'Coins, renewals, lock, recovery phrase, public key', + separateBalances: 'Show Spending and Savings separately', + movedInstant: 'Made instant', + movingInstant: 'Making instant', + movedOnchain: 'Moved on-chain', recvAmountTitle: 'Request an amount', recvAmountNote: 'What it’s for (optional)', recvAmountGo: 'Create invoice', |
