ui: Improved wallets page.

This commit is contained in:
tecnovert
2021-10-14 22:17:37 +02:00
parent 4475e5b643
commit 062283c31a
6 changed files with 130 additions and 4 deletions

View File

@@ -279,11 +279,16 @@ class HttpHandler(BaseHTTPRequestHandler):
messages.append('Withdrew {} {} to address {}<br/>In txid: {}'.format(value, ticker, address, txid))
except Exception as e:
messages.append('Error: {}'.format(str(e)))
swap_client.updateWalletsInfo(True, c)
wallets = swap_client.getWalletsInfo()
swap_client.updateWalletsInfo()
wallets = swap_client.getCachedWalletsInfo()
wallets_formatted = []
for k, w in wallets.items():
sk = sorted(wallets.keys())
for k in sk:
w = wallets[k]
if 'error' in w:
wallets_formatted.append({
'cid': str(int(k)),
@@ -291,6 +296,14 @@ class HttpHandler(BaseHTTPRequestHandler):
})
continue
if 'balance' not in w:
wallets_formatted.append({
'name': w['name'],
'havedata': False,
'updating': w['updating'],
})
continue
ci = swap_client.ci(k)
fee_rate, fee_src = swap_client.getFeeRateForCoin(k)
est_fee = swap_client.estimateWithdrawFee(k, fee_rate)
@@ -308,11 +321,16 @@ class HttpHandler(BaseHTTPRequestHandler):
'deposit_address': w['deposit_address'],
'expected_seed': w['expected_seed'],
'balance_all': float(w['balance']) + float(w['unconfirmed']),
'updating': w['updating'],
'lastupdated': format_timestamp(w['lastupdated']),
'havedata': True,
}
if float(w['unconfirmed']) > 0.0:
wf['unconfirmed'] = w['unconfirmed']
if k == Coins.PART:
wf['stealth_address'] = w['stealth_address']
wf['blind_balance'] = w['blind_balance']
if float(w['blind_unconfirmed']) > 0.0:
wf['blind_unconfirmed'] = w['blind_unconfirmed']