mirror of
https://github.com/basicswap/basicswap.git
synced 2026-04-09 02:47:22 +02:00
ui: Add indication when XMR node is bootstrapping
This commit is contained in:
@@ -22,6 +22,43 @@ from basicswap.chainparams import (
|
||||
)
|
||||
|
||||
|
||||
def format_wallet_data(ci, w):
|
||||
wf = {
|
||||
'name': ci.coin_name(),
|
||||
'version': w.get('version', '?'),
|
||||
'ticker': ci.ticker_mainnet(),
|
||||
'cid': str(int(ci.coin_type())),
|
||||
'balance': w.get('balance', '?'),
|
||||
'blocks': w.get('blocks', '?'),
|
||||
'synced': w.get('synced', '?'),
|
||||
'expected_seed': w.get('expected_seed', '?'),
|
||||
'updating': w.get('updating', '?'),
|
||||
'havedata': True,
|
||||
}
|
||||
|
||||
if w.get('bootstrapping', False) is True:
|
||||
wf['bootstrapping'] = True
|
||||
if 'known_block_count' in w:
|
||||
wf['known_block_count'] = w['known_block_count']
|
||||
|
||||
if 'balance' in w and 'unconfirmed' in w:
|
||||
wf['balance_all'] = float(w['balance']) + float(w['unconfirmed'])
|
||||
if 'lastupdated' in w:
|
||||
wf['lastupdated'] = format_timestamp(w['lastupdated'])
|
||||
if 'unconfirmed' in w and float(w['unconfirmed']) > 0.0:
|
||||
wf['unconfirmed'] = w['unconfirmed']
|
||||
|
||||
if ci.coin_type() == Coins.PART:
|
||||
wf['stealth_address'] = w.get('stealth_address', '?')
|
||||
wf['blind_balance'] = w.get('blind_balance', '?')
|
||||
if 'blind_unconfirmed' in w and float(w['blind_unconfirmed']) > 0.0:
|
||||
wf['blind_unconfirmed'] = w['blind_unconfirmed']
|
||||
wf['anon_balance'] = w.get('anon_balance', '?')
|
||||
if 'anon_pending' in w and float(w['anon_pending']) > 0.0:
|
||||
wf['anon_pending'] = w['anon_pending']
|
||||
return wf
|
||||
|
||||
|
||||
def page_wallets(self, url_split, post_string):
|
||||
server = self.server
|
||||
swap_client = server.swap_client
|
||||
@@ -109,36 +146,7 @@ def page_wallets(self, url_split, post_string):
|
||||
continue
|
||||
|
||||
ci = swap_client.ci(k)
|
||||
cid = str(int(k))
|
||||
wf = {
|
||||
'name': ci.coin_name(),
|
||||
'version': w.get('version', '?'),
|
||||
'ticker': ci.ticker_mainnet(),
|
||||
'cid': cid,
|
||||
'balance': w.get('balance', '?'),
|
||||
'blocks': w.get('blocks', '?'),
|
||||
'synced': w.get('synced', '?'),
|
||||
'deposit_address': w.get('deposit_address', '?'),
|
||||
'expected_seed': w.get('expected_seed', '?'),
|
||||
'updating': w.get('updating', '?'),
|
||||
'havedata': True,
|
||||
}
|
||||
|
||||
if 'balance' in w and 'unconfirmed' in w:
|
||||
wf['balance_all'] = float(w['balance']) + float(w['unconfirmed'])
|
||||
if 'lastupdated' in w:
|
||||
wf['lastupdated'] = format_timestamp(w['lastupdated'])
|
||||
if 'unconfirmed' in w and float(w['unconfirmed']) > 0.0:
|
||||
wf['unconfirmed'] = w['unconfirmed']
|
||||
|
||||
if k == Coins.PART:
|
||||
wf['stealth_address'] = w.get('stealth_address', '?')
|
||||
wf['blind_balance'] = w.get('blind_balance', '?')
|
||||
if 'blind_unconfirmed' in w and float(w['blind_unconfirmed']) > 0.0:
|
||||
wf['blind_unconfirmed'] = w['blind_unconfirmed']
|
||||
wf['anon_balance'] = w.get('anon_balance', '?')
|
||||
if 'anon_pending' in w and float(w['anon_pending']) > 0.0:
|
||||
wf['anon_pending'] = w['anon_pending']
|
||||
wf = format_wallet_data(ci, w)
|
||||
|
||||
wallets_formatted.append(wf)
|
||||
|
||||
@@ -246,7 +254,7 @@ def page_wallet(self, url_split, post_string):
|
||||
}
|
||||
continue
|
||||
|
||||
if 'balance' not in w:
|
||||
if 'no_data' in w:
|
||||
wallet_data = {
|
||||
'name': w['name'],
|
||||
'havedata': False,
|
||||
@@ -255,40 +263,18 @@ def page_wallet(self, url_split, post_string):
|
||||
continue
|
||||
|
||||
ci = swap_client.ci(k)
|
||||
cid = str(int(coin_id))
|
||||
|
||||
wallet_data = format_wallet_data(ci, w)
|
||||
|
||||
fee_rate, fee_src = swap_client.getFeeRateForCoin(k)
|
||||
est_fee = swap_client.estimateWithdrawFee(k, fee_rate)
|
||||
cid = str(int(k))
|
||||
wallet_data = {
|
||||
'name': w['name'],
|
||||
'version': w['version'],
|
||||
'ticker': ci.ticker_mainnet(),
|
||||
'cid': cid,
|
||||
'fee_rate': ci.format_amount(int(fee_rate * ci.COIN())),
|
||||
'fee_rate_src': fee_src,
|
||||
'est_fee': 'Unknown' if est_fee is None else ci.format_amount(int(est_fee * ci.COIN())),
|
||||
'balance': w['balance'],
|
||||
'blocks': w['blocks'],
|
||||
'synced': w['synced'],
|
||||
'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:
|
||||
wallet_data['unconfirmed'] = w['unconfirmed']
|
||||
wallet_data['fee_rate'] = ci.format_amount(int(fee_rate * ci.COIN()))
|
||||
wallet_data['fee_rate_src'] = fee_src
|
||||
wallet_data['est_fee'] = 'Unknown' if est_fee is None else ci.format_amount(int(est_fee * ci.COIN()))
|
||||
wallet_data['deposit_address'] = w.get('deposit_address', 'Refresh necessary')
|
||||
|
||||
if k == Coins.PART:
|
||||
wallet_data['stealth_address'] = w['stealth_address']
|
||||
wallet_data['blind_balance'] = w['blind_balance']
|
||||
if float(w['blind_unconfirmed']) > 0.0:
|
||||
wallet_data['blind_unconfirmed'] = w['blind_unconfirmed']
|
||||
wallet_data['anon_balance'] = w['anon_balance']
|
||||
if float(w['anon_pending']) > 0.0:
|
||||
wallet_data['anon_pending'] = w['anon_pending']
|
||||
|
||||
elif k == Coins.XMR:
|
||||
if k == Coins.XMR:
|
||||
wallet_data['main_address'] = w.get('main_address', 'Refresh necessary')
|
||||
|
||||
if 'wd_type_from_' + cid in page_data:
|
||||
|
||||
Reference in New Issue
Block a user