fix: stop scanning when network changed
This commit is contained in:
parent
6150b767e4
commit
5697bd3b31
3 changed files with 26 additions and 25 deletions
|
|
@ -50,7 +50,6 @@ async function walletList(path) {
|
|||
watch: {
|
||||
immediate: true,
|
||||
async network(newNet, oldNet) {
|
||||
console.log('### newNet, oldNet', newNet, oldNet)
|
||||
if (newNet !== oldNet) {
|
||||
await this.refreshWalletAccounts()
|
||||
}
|
||||
|
|
@ -131,6 +130,7 @@ async function walletList(path) {
|
|||
return []
|
||||
},
|
||||
refreshWalletAccounts: async function () {
|
||||
this.walletAccounts = []
|
||||
const wallets = await this.getWatchOnlyWallets()
|
||||
this.walletAccounts = wallets.map(w => mapWalletAccount(w))
|
||||
this.$emit('accounts-update', this.walletAccounts)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ const watchOnly = async () => {
|
|||
//################### PSBT ###################
|
||||
|
||||
updateSignedPsbt: async function (psbtBase64) {
|
||||
console.log('### updateSignedPsbt psbtBase64', psbtBase64)
|
||||
this.$refs.paymentRef.updateSignedPsbt(psbtBase64)
|
||||
},
|
||||
|
||||
|
|
@ -237,7 +236,6 @@ const watchOnly = async () => {
|
|||
})
|
||||
this.addresses.push(...uniqueAddresses)
|
||||
}
|
||||
console.log('### refreshAddresses', this.addresses)
|
||||
this.$emit('update:addresses', this.addresses)
|
||||
},
|
||||
getAddressesForWallet: async function (walletId) {
|
||||
|
|
@ -324,12 +322,14 @@ const watchOnly = async () => {
|
|||
|
||||
//################### MEMPOOL API ###################
|
||||
getAddressTxsDelayed: async function (addrData) {
|
||||
const fn = async () => {
|
||||
const accounts = this.walletAccounts
|
||||
const {
|
||||
bitcoin: {addresses: addressesAPI}
|
||||
} = mempoolJS({
|
||||
hostname: this.mempoolHostname
|
||||
})
|
||||
const fn = async () => {
|
||||
if (!accounts.find(w => (w.id === addrData.wallet))) return []
|
||||
return addressesAPI.getAddressTxs({
|
||||
address: addrData.address
|
||||
})
|
||||
|
|
@ -339,13 +339,15 @@ const watchOnly = async () => {
|
|||
},
|
||||
|
||||
getAddressTxsUtxoDelayed: async function (address) {
|
||||
const fn = async () => {
|
||||
const endpoint = this.mempoolHostname
|
||||
const {
|
||||
bitcoin: {addresses: addressesAPI}
|
||||
} = mempoolJS({
|
||||
hostname: this.mempoolHostname
|
||||
hostname: endpoint
|
||||
})
|
||||
|
||||
const fn = async () => {
|
||||
if (endpoint !== this.mempoolHostname) return []
|
||||
return addressesAPI.getAddressTxsUtxo({
|
||||
address
|
||||
})
|
||||
|
|
|
|||
|
|
@ -66,15 +66,14 @@ const mapAddressDataToUtxo = (wallet, addressData, utxo) => ({
|
|||
selected: false
|
||||
})
|
||||
|
||||
const mapWalletAccount = function (obj) {
|
||||
obj._data = _.clone(obj)
|
||||
obj.date = obj.time
|
||||
const mapWalletAccount = function (o) {
|
||||
return Object.assign({}, o, {
|
||||
date: o.time
|
||||
? Quasar.utils.date.formatDate(
|
||||
new Date(obj.time * 1000),
|
||||
new Date(o.time * 1000),
|
||||
'YYYY-MM-DD HH:mm'
|
||||
)
|
||||
: ''
|
||||
obj.label = obj.title // for drop-downs
|
||||
obj.expanded = false
|
||||
return obj
|
||||
: '',
|
||||
expanded: false
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue