Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTC -> BTC-segwit #92

Merged
merged 3 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions .github/workflows/validate_coins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

31 changes: 29 additions & 2 deletions lib/app_config/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class AppConfig {
String get appCompanyLong => 'Komodo Platform';
String get appCompanyShort => 'Komodo';

List<String> get defaultCoins => ['KMD', 'BTC'];
List<String> get coinsFiat => ['BTC', 'KMD'];
List<String> get defaultCoins => ['KMD', 'BTC-segwit'];
List<String> get coinsFiat => ['BTC-segwit', 'KMD'];
List<String> get walletOnlyCoins => [
'ARRR-BEP20',
'ATOM',
Expand Down Expand Up @@ -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<String> get protocolSuffixes => [
Expand Down
4 changes: 2 additions & 2 deletions lib/model/order_book_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class SyncOrderbook {
/// [ChangeNotifier] proxies linked to this singleton.
final Set<OrderBookProvider> _providers = {};

Map<String, Orderbook> _orderBooks = {}; // {'BTC/KMD': Orderbook(),}
Map<String, String> _orderBookErrors = {}; // {'BTC/KMD': 'error1',}
Map<String, Orderbook> _orderBooks = {}; // {'BTC-segwit/KMD': Orderbook(),}
Map<String, String> _orderBookErrors = {}; // {'BTC-segwit/KMD': 'error1',}
Map<String, OrderbookDepth> _orderbooksDepth = {};
CoinsPair _activePair;
bool _updatingDepth = false;
Expand Down
30 changes: 30 additions & 0 deletions utils/check_urls.py
Original file line number Diff line number Diff line change
@@ -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)")
18 changes: 18 additions & 0 deletions utils/check_wallet_only.py
Original file line number Diff line number Diff line change
@@ -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}"
Loading