commit fcb77a520908b5b1dae25280bfcf7c51ed871716
parent 7ca92cddc443f7a2caac6d343050da4014b2c20c
Author: William Casarin <jb55@jb55.com>
Date: Wed, 23 Mar 2022 11:40:03 -0700
readme update for new web npm module
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -37,6 +37,22 @@ This will build `lnsocket.a`, `libsodium.a` and `libsecp256k1.a` under
There are packaged versions of the js build under [dist/js](dist/js)
+If you are in a web environment that supports npm modules, you can import
+lnsocket using npm:
+
+```js
+const LNSocket = require('lnsocket')
+
+async function makeRequest(method, params, rune) {
+ const ln = await LNSocket()
+ ln.genkey()
+ await ln.connect_and_init(node_id, host)
+ // ... etc
+}
+```
+
+Building manually:
+
$ make js
This will build `lnsocket.js` and `lnsocket.wasm` in `target/js` so that you