Commit f47657db authored by lianahus's avatar lianahus Committed by Liana Husikyan

refactored

parent 101feb4e
...@@ -394,28 +394,29 @@ class SettingsUI { ...@@ -394,28 +394,29 @@ class SettingsUI {
this.accountListCallId++ this.accountListCallId++
const callid = this.accountListCallId const callid = this.accountListCallId
const txOrigin = this.el.querySelector('#txorigin') const txOrigin = this.el.querySelector('#txorigin')
let accounts = []
try { try {
let accounts = await this.blockchain.getAccounts() accounts = await this.blockchain.getAccounts()
if (this.accountListCallId > callid) return
this.accountListCallId++
if (!accounts) accounts = []
for (var loadedaddress in this.loadedAccounts) {
if (accounts.indexOf(loadedaddress) === -1) {
txOrigin.removeChild(txOrigin.querySelector('option[value="' + loadedaddress + '"]'))
delete this.loadedAccounts[loadedaddress]
}
}
for (var i in accounts) {
const address = accounts[i]
if (!this.loadedAccounts[address]) {
txOrigin.appendChild(yo`<option value="${address}" >${address}</option>`)
this.loadedAccounts[address] = 1
}
}
txOrigin.setAttribute('value', accounts[0])
} catch (e) { } catch (e) {
addTooltip(`Cannot get account list: ${e}`) addTooltip(`Cannot get account list: ${e}`)
} }
if (!accounts) accounts = []
if (this.accountListCallId > callid) return
this.accountListCallId++
for (var loadedaddress in this.loadedAccounts) {
if (accounts.indexOf(loadedaddress) === -1) {
txOrigin.removeChild(txOrigin.querySelector('option[value="' + loadedaddress + '"]'))
delete this.loadedAccounts[loadedaddress]
}
}
for (var i in accounts) {
const address = accounts[i]
if (!this.loadedAccounts[address]) {
txOrigin.appendChild(yo`<option value="${address}" >${address}</option>`)
this.loadedAccounts[address] = 1
}
}
txOrigin.setAttribute('value', accounts[0])
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment