aboutsummaryrefslogtreecommitdiffstats
path: root/src/wallet.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-16 00:30:52 -0700
committerAdam Soltys <[email protected]>2026-06-16 00:30:52 -0700
commitf42f5c3697497e777fa613519ac3b7d13dc9b410 (patch)
tree0fc0be7cb3b8466b31e94abcedb6fb72a87e205b /src/wallet.js
parented396fd93afdb6abec956175b00a871153e8e6da (diff)
downloadcoinosv3-f42f5c3697497e777fa613519ac3b7d13dc9b410.tar.gz
coinosv3-f42f5c3697497e777fa613519ac3b7d13dc9b410.zip
Show pending txs in history with a clear unconfirmed indicator
WS-detected deposits now get added to history (previously the ingest advanced past the address so the tx never entered history — balance showed but History was empty). Pending txs render with a "⏳ pending" badge, an orange-tinted row, and "awaiting confirmation" so they're clearly distinct from confirmed ones. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/wallet.js')
-rw-r--r--src/wallet.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet.js b/src/wallet.js
index f47d2f1..ba22af2 100644
--- a/src/wallet.js
+++ b/src/wallet.js
@@ -686,11 +686,14 @@ export class Wallet {
let changed = false;
const have = new Set(this.utxos.map(utxoId));
+ const mine = new Set(this.addrMap.keys());
for (const tx of txs) {
if (!tx || !Array.isArray(tx.vout)) continue;
+ let relevant = false;
tx.vout.forEach((vo, i) => {
const a = vo && vo.scriptpubkey_address;
if (!a || !this.addrMap.has(a)) return;
+ relevant = true;
const id = `${tx.txid}:${i}`;
if (have.has(id)) return;
const p = this.addrMap.get(a);
@@ -710,11 +713,21 @@ export class Wallet {
else entry.pending = (entry.pending || 0) + vo.value;
changed = true;
});
+ for (const vin of tx.vin || []) {
+ const a = vin.prevout && vin.prevout.scriptpubkey_address;
+ if (a && mine.has(a)) relevant = true;
+ }
+ // Record it in history (so a pending deposit shows up there too).
+ if (relevant && !this.txs.some((t) => t.txid === tx.txid)) {
+ this.txs.push(this._txSummary(tx));
+ changed = true;
+ }
}
if (changed) {
this.nextReceiveIndex = firstUnused(this.receive);
this.nextChangeIndex = firstUnused(this.change);
this._recomputeBalanceFromChains();
+ this._sortTxs();
this.retrack(); // start watching the new fresh address
this.emit();
}