diff --git a/.github/workflows/validate_coins.yml b/.github/workflows/validate_coins.yml index 2f6021cd3..36a2ef972 100644 --- a/.github/workflows/validate_coins.yml +++ b/.github/workflows/validate_coins.yml @@ -46,36 +46,8 @@ jobs: run: json-diff assets/coins_config.json coins_config.json - name: Check wallet-only coins - run: | - python3 -c " - import json, re - with open('assets/coins_config.json', 'r') as f: - coins_json = json.load(f) - wallet_only_coins = [coin['coin'] for coin in coins_json.values() if coin['wallet_only']] - with open('lib/app_config/app_config.dart', 'r') as f: - dart_file = f.read() - coins_dart = re.findall(r'walletOnlyCoins => \[\s*([^]]+?)\s*\]', dart_file) - coins_dart = [coin.strip().strip('\'') for coin in coins_dart[0].split(',') if coin] - missing_coins = set(wallet_only_coins) - set(coins_dart) - assert len(missing_coins) == 0, f'Missing coins: {missing_coins}' - " + run: python3 utils/check_wallet_only.py - name: Check URLs in app_config.dart - run: | - python3 -c " - import re, requests - with open('lib/app_config/app_config.dart', 'r') as f: - dart_file = f.read() - urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|/|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', dart_file) - for url in urls: - try: - if 'discord' in url or 'github.com' in url or url.endswith('?') or '/api/' in url: - continue - cleaned_url = url.rstrip('.,;\'"') - response = requests.head(cleaned_url, allow_redirects = True) - if response.status_code >= 400 and response.status_code != 405: - raise AssertionError(f'{cleaned_url} is unreachable (HTTP {response.status_code})') - except requests.ConnectionError: - raise AssertionError(f'{cleaned_url} is unreachable (Connection Error)') - " + run: python3 utils/check_urls.py diff --git a/lib/app_config/app_config.dart b/lib/app_config/app_config.dart index 9a0edb0c5..b6f291fa9 100644 --- a/lib/app_config/app_config.dart +++ b/lib/app_config/app_config.dart @@ -48,8 +48,8 @@ class AppConfig { String get appCompanyLong => 'Komodo Platform'; String get appCompanyShort => 'Komodo'; - List get defaultCoins => ['KMD', 'BTC']; - List get coinsFiat => ['BTC', 'KMD']; + List get defaultCoins => ['KMD', 'BTC-segwit']; + List get coinsFiat => ['BTC-segwit', 'KMD']; List get walletOnlyCoins => [ 'ARRR-BEP20', 'ATOM', @@ -84,6 +84,33 @@ class AppConfig { 'UST-PLG20', 'XPM', 'XVC-OLD', + 'WHIVE', + 'SXP-BEP20', + 'PINK', + 'tBTC', + 'BBK', + 'BTX', + 'VOTE2023', + 'VTC', + 'CY', + 'LBC', + 'MONA', + 'BTE', + 'NMC', + 'LTC', + 'CDN', + 'RDD', + 'FJC', + 'SYS', + 'FTC', + 'WCN', + 'XMY', + 'BTC', + 'DGB', + 'POT', + 'GALA-BEP20', + 'LCC', + 'SXP-ERC20' ]; List get protocolSuffixes => [ diff --git a/lib/model/order_book_provider.dart b/lib/model/order_book_provider.dart index 95ebab149..942574370 100644 --- a/lib/model/order_book_provider.dart +++ b/lib/model/order_book_provider.dart @@ -130,8 +130,8 @@ class SyncOrderbook { /// [ChangeNotifier] proxies linked to this singleton. final Set _providers = {}; - Map _orderBooks = {}; // {'BTC/KMD': Orderbook(),} - Map _orderBookErrors = {}; // {'BTC/KMD': 'error1',} + Map _orderBooks = {}; // {'BTC-segwit/KMD': Orderbook(),} + Map _orderBookErrors = {}; // {'BTC-segwit/KMD': 'error1',} Map _orderbooksDepth = {}; CoinsPair _activePair; bool _updatingDepth = false; diff --git a/utils/check_urls.py b/utils/check_urls.py new file mode 100755 index 000000000..a9f131d66 --- /dev/null +++ b/utils/check_urls.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +from os.path import dirname, abspath +import re +import requests + +PROJECT_PATH = dirname(dirname(abspath(__file__))) + +with open(f"{PROJECT_PATH}/lib/app_config/app_config.dart", "r") as f: + dart_file = f.read() +urls = re.findall( + r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|/|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", + dart_file, +) +for url in urls: + try: + if ( + "discord" in url + or "github.com" in url + or url.endswith("?") + or "/api/" in url + ): + continue + cleaned_url = url.rstrip(".,;'\"") + response = requests.head(cleaned_url, allow_redirects=True) + if response.status_code >= 400 and response.status_code != 405: + raise AssertionError( + f"{cleaned_url} is unreachable (HTTP {response.status_code})" + ) + except requests.ConnectionError: + raise AssertionError(f"{cleaned_url} is unreachable (Connection Error)") diff --git a/utils/check_wallet_only.py b/utils/check_wallet_only.py new file mode 100755 index 000000000..a87405334 --- /dev/null +++ b/utils/check_wallet_only.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +from os.path import dirname, abspath +import re +import json + +PROJECT_PATH = dirname(dirname(abspath(__file__))) + +with open(f"{PROJECT_PATH}/assets/coins_config.json", "r") as f: + coins_json = json.load(f) +wallet_only_coins = [ + coin["coin"] for coin in coins_json.values() if coin["wallet_only"] +] +with open(f"{PROJECT_PATH}/lib/app_config/app_config.dart", "r") as f: + dart_file = f.read() +coins_dart = re.findall(r"walletOnlyCoins => \[\s*([^]]+?)\s*\]", dart_file) +coins_dart = [coin.strip().strip("'") for coin in coins_dart[0].split(",") if coin] +missing_coins = set(wallet_only_coins) - set(coins_dart) +assert len(missing_coins) == 0, f"Missing coins: {missing_coins}"