mirror of
https://github.com/basicswap/basicswap.git
synced 2026-04-09 02:47:22 +02:00
Removed CryptoCompare + Added background thread for price fetching.
This commit is contained in:
@@ -43,10 +43,7 @@ from basicswap.chainparams import (
|
||||
Coins,
|
||||
ticker_map,
|
||||
)
|
||||
from basicswap.explorers import (
|
||||
default_chart_api_key,
|
||||
default_coingecko_api_key,
|
||||
)
|
||||
from basicswap.explorers import default_coingecko_api_key
|
||||
|
||||
|
||||
def value_or_none(v):
|
||||
@@ -541,23 +538,9 @@ def page_newoffer(self, url_split, post_string):
|
||||
automation_filters = {"type_ind": Concepts.OFFER, "sort_by": "label"}
|
||||
automation_strategies = swap_client.listAutomationStrategies(automation_filters)
|
||||
|
||||
chart_api_key = swap_client.settings.get("chart_api_key", "")
|
||||
if chart_api_key == "":
|
||||
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")
|
||||
)
|
||||
coingecko_api_key = get_api_key_setting(
|
||||
swap_client.settings, "coingecko_api_key", default_coingecko_api_key
|
||||
)
|
||||
|
||||
return self.render_template(
|
||||
template,
|
||||
@@ -575,7 +558,6 @@ def page_newoffer(self, url_split, post_string):
|
||||
(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,
|
||||
},
|
||||
)
|
||||
@@ -990,9 +972,6 @@ def page_offers(self, url_split, post_string, sent=False):
|
||||
|
||||
coins_from, coins_to = listAvailableCoins(swap_client, split_from=True)
|
||||
|
||||
chart_api_key = get_api_key_setting(
|
||||
swap_client.settings, "chart_api_key", default_chart_api_key
|
||||
)
|
||||
coingecko_api_key = get_api_key_setting(
|
||||
swap_client.settings, "coingecko_api_key", default_coingecko_api_key
|
||||
)
|
||||
@@ -1041,7 +1020,6 @@ def page_offers(self, url_split, post_string, sent=False):
|
||||
"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,
|
||||
|
||||
@@ -49,9 +49,6 @@ def page_settings(self, url_split, post_string):
|
||||
active_tab = "general"
|
||||
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", "")
|
||||
),
|
||||
@@ -213,16 +210,12 @@ def page_settings(self, url_split, post_string):
|
||||
"check_updates": swap_client.settings.get("check_updates", True),
|
||||
}
|
||||
|
||||
chart_api_key = get_api_key_setting(
|
||||
swap_client.settings, "chart_api_key", escape=True
|
||||
)
|
||||
coingecko_api_key = get_api_key_setting(
|
||||
swap_client.settings, "coingecko_api_key", escape=True
|
||||
swap_client.settings, "coingecko_api_key", default_value="", escape=True
|
||||
)
|
||||
|
||||
chart_settings = {
|
||||
"show_chart": swap_client.settings.get("show_chart", True),
|
||||
"chart_api_key": chart_api_key,
|
||||
"coingecko_api_key": coingecko_api_key,
|
||||
"enabled_chart_coins": swap_client.settings.get("enabled_chart_coins", ""),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user