diff --git a/lnbits/extensions/deezy/templates/deezy/index.html b/lnbits/extensions/deezy/templates/deezy/index.html index 233fce34..95ebef96 100644 --- a/lnbits/extensions/deezy/templates/deezy/index.html +++ b/lnbits/extensions/deezy/templates/deezy/index.html @@ -154,6 +154,23 @@ + {% raw %} + + + +
Success Bitcoin is on its way
+
+ + + Onchain tx id {{ swapLnToBtc.onChainTxId }} + + + + + +
+
+ {% endraw %}
@@ -183,7 +200,9 @@ data: { onChainFees: 1 }, - response: null + response: null, + invoicePaid: false, + onchainTxId: null, }, swapBtcToLn: { show: false, @@ -194,6 +213,24 @@ } }, methods: { + checkIfInvoiceIsPaid() { + if (this.swapLnToBtc.response && !this.swapLnToBtc.invoicePaid ) { + var self = this + let interval = setInterval(() => { + axios.get(`https://api-testnet.deezy.io/v1/swap/lookup?bolt11_invoice=${self.swapLnToBtc.response}`) + .then(function (response){ + if (response.data.on_chain_txid || count > 4) { + self.swapLnToBtc = { + ...self.swapLnToBtc, + invoicePaid: true, + onchainTxId: response.data.on_chain_txid + } + clearInterval(interval) + } + }) + }, 4000) + } + }, copyLnInvoice() { Quasar.utils.copyToClipboard(this.swapLnToBtc.response) }, @@ -210,6 +247,7 @@ showInvoice: true, response: response.data.bolt11_invoice } + self.checkIfInvoiceIsPaid() }) .catch(function (error) { console.log(error);