aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/sync.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-07-06 05:37:42 -0700
committerAdam Soltys <[email protected]>2026-07-06 05:37:42 -0700
commit1139c6beafb1199c149bd1f51a46d817e1d46173 (patch)
tree19dc40ddeb826677f35b20ad8adfc27d5c627793 /src/features/sync.js
parent8e2ff4976db3d7586d7b9c993a94cf9bea071a12 (diff)
downloadcoinosv3-1139c6beafb1199c149bd1f51a46d817e1d46173.tar.gz
coinosv3-1139c6beafb1199c149bd1f51a46d817e1d46173.zip
NWC bridge funding (PoC): ark wallets behind a lightning facade
The compatibility play for ark zaps: an NWC wallet service (coinos, eventually) receives pay_invoice from any nostr client, asks the hal wallet to cover the amount over ark (kind 23196 funding request), hal auto-pays within a user-set allowance and acks (23197), the bridge receives the vtxo in its mailbox and settles the bolt11 over lightning. Custody window is the seconds the sats are in flight. hal side: a live nostr subscription primitive (nostrSubscribe through the sync seam) and an allowance-gated funding handler that arms when ark connects. PoC config via localStorage 'btc-wallet-arknwc' ({bridgePk, budgetSat}); proper UI when the protocol settles. Proven end-to-end on regtest (tools/.arknwc-e2e.tmp.js): mini relay + bridge process (ArkManager in bun + CLN) + NIP-47 client — invoice on clb paid via cl, preimage returned over NWC, hal debited 1,000 sats over ark, zero page errors. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/features/sync.js')
-rw-r--r--src/features/sync.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/features/sync.js b/src/features/sync.js
index 8349b5d..9e77664 100644
--- a/src/features/sync.js
+++ b/src/features/sync.js
@@ -37,6 +37,12 @@ export function installSyncWallet(wallet) {
this.nostr.setRelays(sync.relays);
return this.nostr.fetchEvents(filter, maxWait);
},
+ nostrSubscribe(filter, onEvent) {
+ const sync = getSyncConfig();
+ if (this.offline || !sync.enabled) return () => {};
+ this.nostr.setRelays(sync.relays);
+ return this.nostr.subscribeEvents(filter, onEvent);
+ },
// Pull the latest state from Nostr; apply it if it's newer than what we have.
// Returns true if state was applied (so the caller can skip a full scan).