refactor: method renamings

This commit is contained in:
Vlad Stan
2022-07-07 11:48:37 +03:00
parent 615520bcb3
commit d74b48b0b6

View File

@ -70,7 +70,7 @@
<q-btn <q-btn
flat flat
v-else v-else
@click="payLN" @click="payInvoice"
style="color: primary; width: 100%" style="color: primary; width: 100%"
label="lightning⚡" label="lightning⚡"
> >
@ -92,7 +92,7 @@
<q-btn <q-btn
flat flat
v-else v-else
@click="payON" @click="payOnchain"
style="color: primary; width: 100%" style="color: primary; width: 100%"
label="onchain⛓" label="onchain⛓"
> >
@ -270,7 +270,7 @@
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
}, },
checkOnchainAddressBalance: async function () { checkAddressBalance: async function () {
const { const {
bitcoin: {addresses: addressesAPI} bitcoin: {addresses: addressesAPI}
} = mempoolJS() } = mempoolJS()
@ -282,13 +282,12 @@
const utxos = await retryWithDelay(fn) const utxos = await retryWithDelay(fn)
charge.balance = utxos.reduce((t, u) => t + u.value, 0) charge.balance = utxos.reduce((t, u) => t + u.value, 0)
}, },
payLN: function () { payInvoice: function () {
this.lnbtc = true this.lnbtc = true
this.onbtc = false this.onbtc = false
}, },
payON: function () { payOnchain: function () {
this.lnbtc = false this.lnbtc = false
this.onbtc = true this.onbtc = true
}, },
@ -307,7 +306,8 @@
this.newProgress = this.newProgress =
1 - this.timeToComplete / (parseInt('{{ charge.time }}') * 60) 1 - this.timeToComplete / (parseInt('{{ charge.time }}') * 60)
}, },
loopRefresh: function () { // invoice only loopRefresh: function () {
// invoice only
const refreshIntervalId = setInterval(() => { const refreshIntervalId = setInterval(() => {
console.log('### 1111') console.log('### 1111')
if (this.charge.paid || this.timetoComplete < 1) { if (this.charge.paid || this.timetoComplete < 1) {
@ -316,16 +316,15 @@
this.refreshProgres() this.refreshProgres()
this.counter++ this.counter++
if (this.counter % 10 === 0) { if (this.counter % 10 === 0) {
this.checkInvoiceBalance() if (this.charge.lnbitswallet) this.checkInvoiceBalance()
if (this.charge.onchainaddress) this.checkAddressBalance()
} }
}, 1000) }, 1000)
}, }
}, },
created: function () { created: function () {
console.log('### charge ', this.charge) if (this.charge.lnbitswallet) this.payInvoice()
this.lnbtc = !!this.charge.lnbitswallet else this.payOnchain()
this.onbtc = !!this.charge.onchainwallet
// empty for onchain // empty for onchain
this.wallet.inkey = '{{ wallet_inkey }}' this.wallet.inkey = '{{ wallet_inkey }}'