From 7263b782f1176913b9e106516d01f2f0a1315f49 Mon Sep 17 00:00:00 2001 From: supertestnet <58400631+supertestnet@users.noreply.github.com> Date: Mon, 27 May 2024 11:15:46 -0500 Subject: [PATCH] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0eaccff..4d11510 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ var invoice_info = await didPaymentSucceed( nwc_obj, invoice, delay_tolerance ); ## Pay an invoice -Originally this library had a method called nwcjs.payInvoice() instead of nwcjs.tryToPayInvoice(). After paying the invoice, it would return the invoice's preimage. I modified its name because (1) lightning payments do not reliably succeed, so I wanted to indicate that through the method name (2) lightning payments sometimes get stuck for several minutes or hours, and I prefer to avoid using the "await" command if it might get stuck for a long time. So I renamed payInvoice() to tryToPayInvoice() and made it so it never gets stuck, it just immediately sends the "pay" command to the server. But that doesn't mean the invoice will actually get paid, so I recommend following that up by callilng the nwcjs.didPaymentSucceed() method to find out if the payment went through or not. In the meantime you can show your user a pending status indicator or similar. +Originally this library had a method called nwcjs.payInvoice() instead of nwcjs.tryToPayInvoice(). After paying the invoice, it would return the invoice's preimage. I modified its name because (1) lightning payments do not reliably succeed, so I wanted to indicate that through the method name (2) lightning payments sometimes get stuck for several minutes or hours, and I prefer to avoid using the "await" command if it might get stuck for a long time. So I renamed payInvoice() to tryToPayInvoice() and made it so it never gets stuck, it just immediately sends the "pay" command to the server. But that doesn't mean the invoice will actually get paid, so I recommend following that up by calling the nwcjs.didPaymentSucceed() method to find out if the payment went through or not. In the meantime you can show your user a pending status indicator or similar. If the invoice you're paying is amountless, add an amount to your payment by modifying the variable `var amnt`.