aboutsummaryrefslogtreecommitdiffstats
path: root/src/nwc-respond.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-14 01:13:47 -0700
committerAdam Soltys <[email protected]>2026-08-14 01:13:47 -0700
commit5b23470f5d9ec7ee7cc33c2b4b936ddd24fa17cc (patch)
treed1a34086526be29d123922ff45af40878ba4c25d /src/nwc-respond.js
parentc6404bae2ddbc402baa01349c5196d9fcebcf78a (diff)
downloadcoinosv3-5b23470f5d9ec7ee7cc33c2b4b936ddd24fa17cc.tar.gz
coinosv3-5b23470f5d9ec7ee7cc33c2b4b936ddd24fa17cc.zip
Money leaving while you're not looking gets a notification: NWC pays from the worker or a hidden tab announce themselves — amount, fee, and which app asked
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014tE4U5nEjGTQy8PwYqamfv
Diffstat (limited to 'src/nwc-respond.js')
-rw-r--r--src/nwc-respond.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nwc-respond.js b/src/nwc-respond.js
index 258b7e7..bd75360 100644
--- a/src/nwc-respond.js
+++ b/src/nwc-respond.js
@@ -280,5 +280,14 @@ export async function respondFromBg(data, {
result: { preimage: a.preimage, fees_paid: (a.feeSat || 0) * 1000 },
});
log(`paid ${a.amountSat || dec.amountSat} sat via the ASP from the background mirror`);
- return true;
+ // Money left while the app was closed — that always deserves a heads-up,
+ // whether it was a zap from a nostr app or any other connected spender.
+ const paidSat = a.amountSat || dec.amountSat;
+ const feeNote = a.feeSat ? ` (+${a.feeSat} fee)` : '';
+ return {
+ notify: {
+ title: 'Payment sent', tag: 'nwc-sent',
+ body: `-${paidSat.toLocaleString()} sats${feeNote} via ${conn.name || 'a connected app'}`,
+ },
+ };
}