diff --git a/src/components/LnurlWithdraw.vue b/src/components/LnurlWithdraw.vue
new file mode 100644
index 0000000..256fcf5
--- /dev/null
+++ b/src/components/LnurlWithdraw.vue
@@ -0,0 +1,181 @@
+
+
+ {{ receive.lnurl.domain }} is requesting an invoice:
+
- {{ receive.lnurl.domain }} is requesting an invoice: -
-@@ -320,68 +261,6 @@ export default { return cleanInvoice }, - - createInvoice: async function () { - try { - this.showPaymentInProgressCard() - const response = await lnbitsApi(this.serverUrl).createInvoice( - this.activeWallet, - this.receive.data.amount, - this.receive.data.memo, - this.receive.lnurl && this.receive.lnurl.callback - ) - - this.receive.status = 'success' - this.receive.paymentReq = response.data.payment_request - this.receive.paymentHash = response.data.payment_hash - - if (response.data.lnurl_response !== null) { - if (response.data.lnurl_response === false) { - response.data.lnurl_response = `Unable to connect` - } - - if (typeof response.data.lnurl_response === 'string') { - this.showErrorCard( - response.data.lnurl_response, - `${this.receive.lnurl.domain} lnurl-withdraw call failed.` - ) - return - } - if (response.data.lnurl_response === true) { - this.showPaymentInProgressCard(`Invoice sent to ${this.receive.lnurl.domain}!`) - } - } - - clearInterval(this.receive.paymentChecker) - setTimeout(() => { - clearInterval(this.receive.paymentChecker) - this.showErrorCard( - 'Timed Out! Invoice was not payed!', - `Please also check the LNbits transactions list for this wallet: ${this.activeWallet.name}` - ) - }, 40000) - this.receive.paymentChecker = setInterval(async () => { - try { - const hash = response.data.payment_hash - const paymentResponse = await lnbitsApi(this.serverUrl).getPayment( - this.activeWallet, - hash - ) - - if (paymentResponse.data.paid) { - clearInterval(this.receive.paymentChecker) - const preimageHtml = `
Preimage: ${paymentResponse.data.preimage}
` - this.showPaymentCompentedCard(preimageHtml) - } - } catch (err) { - this.showErrorCard(err, 'Invoice was not payed!') - clearInterval(this.receive.paymentChecker) - } - }, 5000) - } catch (err) { - this.showErrorCard(err, 'Cannot create invoice!') - } - }, authLnurl: async function () { try { this.showPaymentInProgressCard('Performing authentication...') diff --git a/src/views/content-inject/content.js b/src/views/content-inject/content.js index 5e78098..a949514 100644 --- a/src/views/content-inject/content.js +++ b/src/views/content-inject/content.js @@ -7,6 +7,7 @@ import Options from '../../components/Options.vue' import InvoiceDetails from '../../components/InvoiceDetails.vue' import PaymentStatus from '../../components/PaymentStatus.vue' import LnurlPay from '../../components/LnurlPay.vue' +import LnurlWithdraw from '../../components/LnurlWithdraw.vue' import ErrorCard from '../../components/ErrorCard.vue' import routes from './routes' @@ -22,6 +23,7 @@ try { Vue.component('invoice-details', InvoiceDetails) Vue.component('payment-status', PaymentStatus) Vue.component('lnurl-pay', LnurlPay) + Vue.component('lnurl-withdraw', LnurlWithdraw) Vue.component('error-card', ErrorCard)