aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-27 15:01:06 -0700
committerAdam Soltys <[email protected]>2026-06-27 15:01:06 -0700
commit68edd804f1696aa412da2357a469c013f0a3e92d (patch)
tree133289228e51d140b174f6e2f095d03b23d8a917 /tools
parenteeceebb09878a544b18926a3cd164e581b0c9869 (diff)
downloadcoinosv3-68edd804f1696aa412da2357a469c013f0a3e92d.tar.gz
coinosv3-68edd804f1696aa412da2357a469c013f0a3e92d.zip
Wire silent-payment receiving into the wallet (scan + balance + UI)
wallet.js: scanSilentPayments() pulls the indexer's /scan range, matches outputs on-device, and verifies each is unspent via the chain backend; spUtxos + balance are tracked in their own bucket (one-time taproot keys), persisted in the cache. silentPaymentsAvailable()/spBalance() expose state. app.js: the Receive tab shows the reusable sp address (QR + copy), a 'Scan for silent payments' button, and the found amount; Settings gains a per-network SP indexer picker (under Data source) with custom/self-host support. sp-indexer.js: added /scan/{from} so a client fetches a whole range in one request instead of one fetch per block. Receiving verified end-to-end on regtest (scan finds the output, 49,999,800 sat confirmed). Spending SP outputs is the remaining piece. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/sp-indexer.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/sp-indexer.js b/tools/sp-indexer.js
index 12f76f7..d573ab9 100644
--- a/tools/sp-indexer.js
+++ b/tools/sp-indexer.js
@@ -109,6 +109,18 @@ Bun.serve({
const b = blocks.get(Number(m[1]));
return json(b ? b.items.map((i) => i.tweak) : []);
}
+ // All SP-eligible tx items from height `from` to the tip, in one response —
+ // each tagged with its height. Lets a client scan a range without one fetch
+ // per block. (Regtest-scale; mainnet would page or use BIP-158 filters.)
+ if ((m = p.match(/^\/scan\/(\d+)$/))) {
+ const from = Number(m[1]);
+ const items = [];
+ for (let h = from; h <= indexed; h++) {
+ const b = blocks.get(h);
+ if (b) for (const it of b.items) items.push({ height: h, ...it });
+ }
+ return json({ tip: indexed, items });
+ }
return json({ error: 'not found' }, 404);
},
});