lnsocket

A minimal C library for connecting to the lightning network
git clone git://jb55.com/lnsocket
Log | Files | Refs | Submodules | README | LICENSE

websockets.js (596B)


      1 
      2 async function go() {
      3 	const LNSocket = await lnsocket_init()
      4 	const ln = LNSocket()
      5 
      6 	ln.genkey()
      7 	//const their_init = await ln.connect_and_init("03f3c108ccd536b8526841f0a5c58212bb9e6584a1eb493080e7c1cc34f82dad71", "cln.jb55.com:443")
      8 	await ln.connect_and_init("03f3c108ccd536b8526841f0a5c58212bb9e6584a1eb493080e7c1cc34f82dad71", "ws://24.84.152.187:8324")
      9 
     10 	const rune = "APaeUhcGPAMQwgV1Kn-hRRs5Bi4-D1nrfsHfCoTLl749MTAmbWV0aG9kPWdldGluZm8="
     11 	const res = await ln.rpc({ method: "getinfo", rune })
     12 
     13 	document.body.innerHTML = `<pre>${JSON.stringify(res.result, undefined, 2)}</pre>`
     14 }
     15 
     16 go()