commit 19ebf64e2cc85cbe52d3f57ad2b777af84646914
parent 71edace76a72da7328d9036da41748f92237775a
Author: William Casarin <jb55@jb55.com>
Date: Tue, 8 Mar 2022 17:57:13 -0800
update readme for wasm, misc fixes
Diffstat:
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.envrc b/.envrc
@@ -1,4 +1,4 @@
-#use nix
+use nix
export PATH=$PWD:$PATH
export TODO_FILE=$PWD/TODO
diff --git a/README b/README
@@ -38,6 +38,16 @@ This will build lnsocket.a, libsodium.a and libsecp256k1.a under target/ios for
arm64 and ios-sim.
+WASM/JS/Web
+-----------
+
+$ make wasm
+
+This will build lnsocket.js and lnsocket.wasm so that you can connect to the
+lightning network from your browser via websockets. See lnsocket_example.js for
+a demo.
+
+
Examples
--------
diff --git a/lnsocket.c b/lnsocket.c
@@ -134,12 +134,14 @@ int EXPORT lnsocket_make_default_initmsg(unsigned char *msgbuf, int buflen)
return (int)len;
}
+/*
static void print_hex(u8 *bytes, int len) {
int i;
for (i = 0; i < len; ++i) {
printf("%02x", bytes[i]);
}
}
+*/
int lnsocket_perform_init(struct lnsocket *ln)
{
diff --git a/shell.nix b/shell.nix
@@ -1,5 +1,5 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [ ];
- nativeBuildInputs = with pkgs; [ gdb autoreconfHook ];
+ nativeBuildInputs = with pkgs; [ gdb autoreconfHook emscripten wabt ];
}