diff options
Diffstat (limited to 'tools/nwc-test.js')
| -rw-r--r-- | tools/nwc-test.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/nwc-test.js b/tools/nwc-test.js index e22c5d2..3df0f28 100644 --- a/tools/nwc-test.js +++ b/tools/nwc-test.js @@ -14,6 +14,11 @@ globalThis.localStorage = { getItem:k=>k in store?store[k]:null, setItem:(k,v)=> let subHandler = null; const published = []; +// fake relay transport: capture the subscription handler and any replies +const nwcTransport = { + subscribe: (relays, filter, on) => { subHandler = on; return () => { subHandler = null; }; }, + publish: async (relays, evt) => { published.push(evt); return true; }, +}; let paid = []; const wallet = { watchOnly: false, @@ -31,7 +36,7 @@ const hooks = { arkMovements: () => ([{ type:'ln-send', status:'complete', amountSat: 25, ts: Date.now(), invoice:'lnbc250n1', preimage:'ef'.repeat(32) }]), }; const ctx = { h:()=>null, ui:{}, render:()=>{}, wallet, hook:(n,...a)=>hooks[n]?hooks[n](...a):null, - fmtAmount:(n)=>String(n), unitLabel:()=>'sats', copyBtn:()=>null, toast:()=>{} }; + fmtAmount:(n)=>String(n), unitLabel:()=>'sats', copyBtn:()=>null, toast:()=>{}, nwcTransport }; const f = nwcFeature(ctx); f.init(); |
