ui: rateslist returns js list of rates.

This commit is contained in:
tecnovert
2022-08-03 23:59:57 +02:00
parent 1ee2db137b
commit 412770d399
5 changed files with 141 additions and 87 deletions

View File

@@ -17,6 +17,7 @@ from .basicswap_util import (
from .chainparams import (
Coins,
chainparams,
getCoinIdFromTicker,
)
from .ui.util import (
PAGE_LIMIT,
@@ -339,6 +340,15 @@ def js_rates(self, url_split, post_string, is_json):
return bytes(json.dumps(sc.lookupRates(coin_from, coin_to)), 'UTF-8')
def js_rates_list(self, url_split, query_string, is_json):
get_data = urllib.parse.parse_qs(query_string)
sc = self.server.swap_client
coin_from = getCoinIdFromTicker(get_data['from'][0])
coin_to = getCoinIdFromTicker(get_data['to'][0])
return bytes(json.dumps(sc.lookupRates(coin_from, coin_to, True)), 'UTF-8')
def js_rate(self, url_split, post_string, is_json):
if post_string == '':
raise ValueError('No post data')