mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
ui: Use coin tickers as wallet keys in json/wallets
This commit is contained in:
@@ -5361,11 +5361,12 @@ class BasicSwap(BaseApp):
|
||||
if c not in chainparams:
|
||||
continue
|
||||
if self.coin_clients[c]['connection_type'] == 'rpc':
|
||||
key = chainparams[c]['ticker'] if opts.get('ticker_key', False) else c
|
||||
try:
|
||||
rv[c] = self.getWalletInfo(c)
|
||||
rv[c].update(self.getBlockchainInfo(c))
|
||||
rv[key] = self.getWalletInfo(c)
|
||||
rv[key].update(self.getBlockchainInfo(c))
|
||||
except Exception as ex:
|
||||
rv[c] = {'name': chainparams[c]['name'].capitalize(), 'error': str(ex)}
|
||||
rv[key] = {'name': chainparams[c]['name'].capitalize(), 'error': str(ex)}
|
||||
return rv
|
||||
|
||||
def getCachedWalletsInfo(self, opts=None):
|
||||
|
||||
@@ -93,12 +93,14 @@ def js_wallets(self, url_split, post_string, is_json):
|
||||
cmd = url_split[4]
|
||||
if cmd == 'withdraw':
|
||||
return bytes(json.dumps(withdraw_coin(swap_client, coin_type, post_string, is_json)), 'UTF-8')
|
||||
if cmd == 'nextdepositaddr':
|
||||
return bytes(json.dumps(swap_client.cacheNewAddressForCoin(coin_type)), 'UTF-8')
|
||||
raise ValueError('Unknown command')
|
||||
|
||||
rv = swap_client.getWalletInfo(coin_type)
|
||||
rv.update(swap_client.getBlockchainInfo(coin_type))
|
||||
return bytes(json.dumps(rv), 'UTF-8')
|
||||
return bytes(json.dumps(self.server.swap_client.getWalletsInfo()), 'UTF-8')
|
||||
return bytes(json.dumps(self.server.swap_client.getWalletsInfo({'ticker_key': True})), 'UTF-8')
|
||||
|
||||
|
||||
def js_offers(self, url_split, post_string, is_json, sent=False):
|
||||
|
||||
Reference in New Issue
Block a user