ui: Added wownero (chart/price/images), WIP on coingecko fallback system for chart/coin prices.
- Added wownero .png coin logos. - (WIP) Added coingecko api / key as fallback system for the chart/coin prices. - Change the api / keys for coingecko at settings. - Added special function for getting wownero chart/coin data/price from CoinGecko and not CryptocCmpare.
This commit is contained in:
1 parent
d83555c25f
commit
e90292fb2f
7 files changed
+203
-37
No files matched your search
@@ -41,6 +41,7 @@ from basicswap.chainparams import (
|
||||
)
|
||||
|
||||
default_chart_api_key = '95dd900af910656e0e17c41f2ddc5dba77d01bf8b0e7d2787634a16bd976c553'
|
||||
default_coingecko_api_key = 'CG-8hm3r9iLfpEXv4ied8oLbeUj'
|
||||
|
||||
|
||||
def value_or_none(v):
|
||||
@@ -451,6 +452,11 @@ def page_newoffer(self, url_split, post_string):
|
||||
chart_api_key_enc = swap_client.settings.get('chart_api_key_enc', '')
|
||||
chart_api_key = default_chart_api_key if chart_api_key_enc == '' else bytes.fromhex(chart_api_key_enc).decode('utf-8')
|
||||
|
||||
coingecko_api_key = swap_client.settings.get('coingecko_api_key', '')
|
||||
if coingecko_api_key == '':
|
||||
coingecko_api_key_enc = swap_client.settings.get('coingecko_api_key_enc', '')
|
||||
coingecko_api_key = default_coingecko_api_key if coingecko_api_key_enc == '' else bytes.fromhex(coingecko_api_key_enc).decode('utf-8')
|
||||
|
||||
return self.render_template(template, {
|
||||
'messages': messages,
|
||||
'err_messages': err_messages,
|
||||
@@ -464,6 +470,7 @@ def page_newoffer(self, url_split, post_string):
|
||||
'swap_types': [(strSwapType(x), strSwapDesc(x)) for x in SwapTypes if strSwapType(x)],
|
||||
'show_chart': swap_client.settings.get('show_chart', True),
|
||||
'chart_api_key': chart_api_key,
|
||||
'coingecko_api_key': coingecko_api_key,
|
||||
})
|
||||
|
||||
|
||||
@@ -796,6 +803,11 @@ def page_offers(self, url_split, post_string, sent=False):
|
||||
chart_api_key_enc = swap_client.settings.get('chart_api_key_enc', '')
|
||||
chart_api_key = default_chart_api_key if chart_api_key_enc == '' else bytes.fromhex(chart_api_key_enc).decode('utf-8')
|
||||
|
||||
coingecko_api_key = swap_client.settings.get('coingecko_api_key', '')
|
||||
if coingecko_api_key == '':
|
||||
coingecko_api_key_enc = swap_client.settings.get('coingecko_api_key_enc', '')
|
||||
coingecko_api_key = default_coingecko_api_key if coingecko_api_key_enc == '' else bytes.fromhex(coingecko_api_key_enc).decode('utf-8')
|
||||
|
||||
offers_count = len(formatted_offers)
|
||||
|
||||
template = server.env.get_template('offers.html')
|
||||
@@ -806,6 +818,7 @@ def page_offers(self, url_split, post_string, sent=False):
|
||||
'messages': messages,
|
||||
'show_chart': False if sent else swap_client.settings.get('show_chart', True),
|
||||
'chart_api_key': chart_api_key,
|
||||
'coingecko_api_key': coingecko_api_key,
|
||||
'coins_from': coins_from,
|
||||
'coins': coins_to,
|
||||
'messages': messages,
|
||||
|
||||
@@ -45,6 +45,7 @@ def page_settings(self, url_split, post_string):
|
||||
data = {
|
||||
'show_chart': toBool(get_data_entry(form_data, 'showchart')),
|
||||
'chart_api_key': html.unescape(get_data_entry_or(form_data, 'chartapikey', '')),
|
||||
'coingecko_api_key': html.unescape(get_data_entry_or(form_data, 'coingeckoapikey', '')),
|
||||
}
|
||||
swap_client.editGeneralSettings(data)
|
||||
elif have_data_entry(form_data, 'apply_tor'):
|
||||
@@ -130,9 +131,16 @@ def page_settings(self, url_split, post_string):
|
||||
chart_api_key = html.escape(bytes.fromhex(swap_client.settings.get('chart_api_key_enc', '')).decode('utf-8'))
|
||||
else:
|
||||
chart_api_key = swap_client.settings.get('chart_api_key', '')
|
||||
|
||||
if 'coingecko_api_key_enc' in swap_client.settings:
|
||||
coingecko_api_key = html.escape(bytes.fromhex(swap_client.settings.get('coingecko_api_key_enc', '')).decode('utf-8'))
|
||||
else:
|
||||
coingecko_api_key = swap_client.settings.get('coingecko_api_key', '')
|
||||
|
||||
chart_settings = {
|
||||
'show_chart': swap_client.settings.get('show_chart', True),
|
||||
'chart_api_key': chart_api_key,
|
||||
'coingecko_api_key': coingecko_api_key,
|
||||
}
|
||||
|
||||
tor_control_password = '' if swap_client.tor_control_password is None else swap_client.tor_control_password
|
||||
|
||||
Reference in new issue
Block a user