fix: change address and Select All coins

This commit is contained in:
Vlad Stan 2022-07-26 12:03:12 +03:00
parent dc95143998
commit 86d3ebd5dc
3 changed files with 9 additions and 11 deletions

View file

@ -14,11 +14,9 @@ async function payment(path) {
watch: { watch: {
immediate: true, immediate: true,
accounts() { accounts() {
console.log('### watch accounts', newVal)
this.updateChangeAddress() this.updateChangeAddress()
}, },
addresses(newVal) { addresses() {
console.log('### watch addresses', newVal)
this.updateChangeAddress() this.updateChangeAddress()
} }
}, },
@ -144,12 +142,11 @@ async function payment(path) {
// change account deleted // change account deleted
if (!changeAccount) { if (!changeAccount) {
this.changeWallet = this.accounts[0] this.changeWallet = this.accounts[0]
this.selectChangeAddress(this.changeWallet)
} }
} else { } else {
this.changeWallet = this.accounts[0] this.changeWallet = this.accounts[0]
this.selectChangeAddress(this.changeWallet)
} }
this.selectChangeAddress(this.changeWallet)
}, },
getTotalPaymentAmount: function () { getTotalPaymentAmount: function () {
return this.sendToList.reduce((t, a) => t + (a.amount || 0), 0) return this.sendToList.reduce((t, a) => t + (a.amount || 0), 0)

View file

@ -102,17 +102,18 @@ async function utxoList(path) {
return total return total
}, },
applyUtxoSelectionMode: function () { applyUtxoSelectionMode: function () {
const isSelectAll = mode === 'Select All'
if (isSelectAll) {
this.utxos.data.forEach(u => (u.selected = true))
return
}
const payedAmount = this['payed-amount'] const payedAmount = this['payed-amount']
const mode = this.payment.utxoSelectionMode const mode = this.payment.utxoSelectionMode
this.utxos.data.forEach(u => (u.selected = false)) this.utxos.data.forEach(u => (u.selected = false))
const isManual = mode === 'Manual' const isManual = mode === 'Manual'
if (isManual || !payedAmount) return if (isManual || !payedAmount) return
const isSelectAll = mode === 'Select All'
if (isSelectAll || payedAmount >= this.utxos.total) {
this.utxos.data.forEach(u => (u.selected = true))
return
}
const isSmallerFirst = mode === 'Smaller Inputs First' const isSmallerFirst = mode === 'Smaller Inputs First'
const isLargerFirst = mode === 'Larger Inputs First' const isLargerFirst = mode === 'Larger Inputs First'

View file

@ -27,7 +27,7 @@
class="btn-full" class="btn-full"
color="secondary" color="secondary"
@click="scanAllAddresses" @click="scanAllAddresses"
:disabled="scan.scanning == true" :disabled="scan.scanning == true || showPayment"
>Scan Blockchain</q-btn >Scan Blockchain</q-btn
> >
</div> </div>