lnsocket

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

lnsocket_example.js (611B)


      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", "24.84.152.187:8324")
      9 
     10 	const rune = "CVFjq11ZtQ-V14SOeQyV4V2AicYZnHfbBNY8lqYvf8c9NjcmbWV0aG9kPWdldGluZm8mdGltZTwxNjQ2ODc2MTU2"
     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()