From 1139c6beafb1199c149bd1f51a46d817e1d46173 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 6 Jul 2026 05:37:42 -0700 Subject: NWC bridge funding (PoC): ark wallets behind a lightning facade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/features/sync.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/features/sync.js') 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). -- cgit v1.2.3