diff options
| author | Adam Soltys <[email protected]> | 2026-06-25 17:05:02 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-25 17:05:02 -0700 |
| commit | 3d57ac2a6f70a7b881d9f1fd2d9d304c2f0ba2a3 (patch) | |
| tree | 571e7ae17f616098f61cd5b08b8ca8b7e7b0e50d /src | |
| parent | 6a94730d92b069344ded846acd8caad6689c2eb5 (diff) | |
| download | coinosv3-3d57ac2a6f70a7b881d9f1fd2d9d304c2f0ba2a3.tar.gz coinosv3-3d57ac2a6f70a7b881d9f1fd2d9d304c2f0ba2a3.zip | |
Lazily fetch a receive's fee when opening its detail
A watcher-credited receive arrives with no fee (the push can't compute it from
the raw tx, and the reduced reconcile doesn't revisit the now-used address). On
opening the tx detail, fetch the full tx from the explorer to fill in the fee
(and confirmations) — works for pending mempool txs too.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.js | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -2458,7 +2458,7 @@ function txHistoryItem(tx) { const stuck = !tx.confirmed && wallet.isStuck(tx); return h( 'div', - { class: 'item', style: 'cursor:pointer', onClick: () => { ui.txDetail = tx.txid; render(); } }, + { class: 'item', style: 'cursor:pointer', onClick: () => openTx(tx.txid) }, h('div', { class: `ico ${incoming ? 'in' : 'out'}` }, incoming ? '↓' : '↑'), h('div', { class: 'grow' }, h('div', { class: 'row gap6' }, @@ -2557,6 +2557,30 @@ function historyTab() { ); } +// Open a tx's detail view, lazily fetching its fee/details if we don't have them +// yet. A watcher-credited receive arrives with no fee (the push can't compute it +// from the raw tx), so fill it in from the explorer on demand — works for pending +// mempool txs too. +async function openTx(txid) { + ui.txDetail = txid; + render(); + const tx = wallet.txs.find((t) => t.txid === txid); + if (!tx || tx.fee || wallet.offline) return; + try { + const full = await wallet.api.getTx(txid); + if (!full || ui.txDetail !== txid) return; + if (full.fee != null) tx.fee = full.fee; + if (full.weight) tx.vsize = Math.ceil(full.weight / 4); + if (full.status && full.status.confirmed) { + tx.confirmed = true; + tx.blockHeight = full.status.block_height || tx.blockHeight; + tx.blockTime = full.status.block_time || tx.blockTime; + } + wallet.saveCache(); + render(); + } catch {} +} + function txDetailView(tx) { const incoming = tx.net >= 0; const line = (k, v) => h('div', { class: 'line' }, h('span', { class: 'k' }, k), h('span', { class: 'v' }, v)); |
