actually paying and withdrawing with lnurl.

This commit is contained in:
fiatjaf
2020-10-12 23:21:45 -03:00
parent 3cd15c40fc
commit bc2207ba27
5 changed files with 207 additions and 35 deletions
+17 -2
View File
@@ -16,11 +16,12 @@ var LNbits = {
data: data
})
},
createInvoice: function (wallet, amount, memo) {
createInvoice: function (wallet, amount, memo, lnurlCallback = null) {
return this.request('post', '/api/v1/payments', wallet.inkey, {
out: false,
amount: amount,
memo: memo
memo: memo,
lnurl_callback: lnurlCallback
})
},
payInvoice: function (wallet, bolt11) {
@@ -29,6 +30,20 @@ var LNbits = {
bolt11: bolt11
})
},
payLnurl: function (
wallet,
callback,
description_hash,
amount,
description = ''
) {
return this.request('post', '/api/v1/payments/lnurl', wallet.adminkey, {
callback,
description_hash,
amount,
description
})
},
getWallet: function (wallet) {
return this.request('get', '/api/v1/wallet', wallet.inkey)
},