From 1de8399f0d1bdb840270ee08ccc2962239ebbd38 Mon Sep 17 00:00:00 2001 From: junderw Date: Sat, 16 Dec 2017 21:29:34 +0900 Subject: [PATCH] Include explanation of browser use in README --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d877ac..8c7bce5 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,6 @@ exact order of the original signed request. already signed request, as decoders will recover the pubkey, any incorrect data would cause an incorrect pubkey to be generated and will cause an error on the decoding end when trying to send. -* Note: `satoshis` can be defined up to 3 decimal points (ie. `0.001` is the smallest valid - value for satoshis, as lightning network can deal with satoshis) * Note: tag order matters. The message is signed, so to maintain tag order it is an array type. @@ -101,6 +99,28 @@ lnbc20u1pvjluezhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqc */ ``` +## Browser Use +You can use this in the browser. First install browserify and uglify-es (uglifyjs for ES6+) globally. + +``` bash +npm install -g browserify uglify-es +``` + +Then run the command. + +``` bash +browserify -r bolt11 --standalone lightningPayReq | uglifyjs -c -m -o bolt11.min.js +``` + +Now load bolt11.min.js into an HTML page like so: + +``` HTML + +``` + +And now you can do all the examples above in a browser using the global +`lightningPayReq` object. + ## Contributing We are always accepting of pull requests, but we do adhere to specific standards in regards to coding style, test driven development and commit messages.