use payments/sse on the core wallet UI.
still fallback to the invoice polling (now with a 5 seconds interval because less than that is too annoying). this fixes issues with /lnurlwallet invoices not getting paid in time, so we update the UI automatically when they do get paid. (see https://t.me/lnbits/7069)
This commit is contained in:
@@ -63,6 +63,19 @@ window.LNbits = {
|
||||
)
|
||||
}
|
||||
},
|
||||
events: {
|
||||
onInvoicePaid: function (wallet, cb) {
|
||||
if (!this.pis) {
|
||||
this.pis = new EventSource(
|
||||
'/api/v1/payments/sse?api-key=' + wallet.inkey
|
||||
)
|
||||
}
|
||||
|
||||
this.pis.addEventListener('payment-received', ev =>
|
||||
cb(JSON.parse(ev.data))
|
||||
)
|
||||
}
|
||||
},
|
||||
href: {
|
||||
createWallet: function (walletName, userId) {
|
||||
window.location.href =
|
||||
|
||||
Reference in New Issue
Block a user