aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-25 17:05:02 -0700
committerAdam Soltys <[email protected]>2026-06-25 17:05:02 -0700
commit3d57ac2a6f70a7b881d9f1fd2d9d304c2f0ba2a3 (patch)
tree571e7ae17f616098f61cd5b08b8ca8b7e7b0e50d
parent6a94730d92b069344ded846acd8caad6689c2eb5 (diff)
downloadcoinosv3-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]>
-rw-r--r--src/app.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/app.js b/src/app.js
index f016cac..88a77a1 100644
--- a/src/app.js
+++ b/src/app.js
@@ -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));