@@ -27,21 +27,23 @@ yarn add webln
2727
2828If you don't have a build system, you can add the following script tag to your
2929project which will add all functionality under the global ` WebLN ` namespace:
30+
3031``` html
3132<script
32- src =" https://unpkg.com/webln@0.3.0 /dist/webln.min.js"
33- integrity =" sha384-g4CABMESGmsa44I6J+t/4fY3DYGpbl8EjqX4L8g6rmD0RLjVinenmzEDqSH3f1QV "
33+ src =" https://unpkg.com/webln@0.3.1 /dist/webln.min.js"
34+ integrity =" sha384-TddsmDgTQUTU/yuktBl5LSb8Y+QQqknQ19Lx2E0FraOK451Wv63kQ6iZFPrkmeEB "
3435 crossorigin =" anonymous"
3536></script >
3637```
38+
3739<sup >Make sure you leave the integrity hash in to prevent possibly malicious JS</sup >
3840
3941### Client Library
4042
4143Apps that want to enable WebLN interactions can use the ` requestProvider ` function to grab a WebLN provider:
4244
4345``` ts
44- import { requestProvider } from ' webln' ;
46+ import { requestProvider } from " webln" ;
4547
4648let webln;
4749try {
@@ -56,7 +58,6 @@ if (webln) {
5658}
5759```
5860
59-
6061### WebLN Provider
6162
6263Providers are classes that implement the interface provided in ` webln/lib/provider ` .
@@ -77,7 +78,9 @@ export interface WebLNProvider {
7778 keysend(args : KeysendArgs ): Promise <SendPaymentResponse >;
7879
7980 /* Prompts the user to provide the page with an invoice */
80- makeInvoice(amount : string | number | RequestInvoiceArgs ): Promise <RequestInvoiceResponse >;
81+ makeInvoice(
82+ amount : string | number | RequestInvoiceArgs
83+ ): Promise <RequestInvoiceResponse >;
8184
8285 /* Prompts the user to sign a message with their private key */
8386 signMessage(message : string ): Promise <SignMessageResponse >;
@@ -92,7 +95,6 @@ for more detail about request objects and response shapes. The spec
9295is far from complete, and will need more functions to be fully-fledged,
9396but these methods should cover most use-cases.
9497
95-
9698### Errors
9799
98100Both apps and providers will want to make use of WebLN's pre-defined errors.
@@ -123,12 +125,14 @@ And the provider should throw the correct error when possible:
123125
124126` ` ` ts
125127// And a provider should correctly throw this error
126- import { WebLNProvider } from ' webln' ;
127- import { UnsupportedMethodError } from ' webln/lib/errors' ;
128+ import { WebLNProvider } from " webln" ;
129+ import { UnsupportedMethodError } from " webln/lib/errors" ;
128130
129131class MyProvider extends WebLNProvider {
130132 signMessage() {
131- throw new UnsupportedMethodError (' MyProvider doesn’t support message signatures!' );
133+ throw new UnsupportedMethodError (
134+ " MyProvider doesn’t support message signatures!"
135+ );
132136 }
133137}
134138` ` `
0 commit comments