Add btcln; add 2 assets to SideShift (#890)

* Add btcln; add 2 assets to SideShift * fix regex line * change ordering

Justin Ehrenhofer committed Apr 20, 2023 at 13:55 UTC ab20312e61a0fca0335cbba6b9f82bc2bf8d0915
4 files changed +11 -2
cw_core/lib/crypto_currency.dart
+3
@@ -66,6 +66,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
66 CryptoCurrency.scrt,
67 CryptoCurrency.uni,
68 CryptoCurrency.stx,
69 + CryptoCurrency.btcln,
70 ];
71
72 static const havenCurrencies = [
@@ -150,6 +151,8 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
151 static const scrt = CryptoCurrency(title: 'SCRT', fullName: 'Secret Network', raw: 59, name: 'scrt', iconPath: 'assets/images/scrt_icon.png');
152 static const uni = CryptoCurrency(title: 'UNI', tag: 'ETH', fullName: 'Uniswap', raw: 60, name: 'uni', iconPath: 'assets/images/uni_icon.png');
153 static const stx = CryptoCurrency(title: 'STX', fullName: 'Stacks', raw: 61, name: 'stx', iconPath: 'assets/images/stx_icon.png');
154 + static const btcln = CryptoCurrency(title: 'BTC', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'btcln', iconPath: 'assets/images/btc.png');
155 +
156
157 static final Map<int, CryptoCurrency> _rawCurrencyMap =
158 [...all, ...havenCurrencies].fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
lib/core/address_validator.dart
+4
@@ -85,6 +85,8 @@ class AddressValidator extends TextValidator {
85 return 'R[0-9a-zA-Z]{33}';
86 case CryptoCurrency.pivx:
87 return 'D([1-9a-km-zA-HJ-NP-Z]){33}';
88 + case CryptoCurrency.btcln:
89 + return '^(lnbc|LNBC)([0-9]{1,}[a-zA-Z0-9]+)';
90 default:
91 return '[0-9a-zA-Z]';
92 }
@@ -194,6 +196,8 @@ class AddressValidator extends TextValidator {
196 return [45];
197 case CryptoCurrency.near:
198 return [64];
199 + case CryptoCurrency.btcln:
200 + return null;
201 default:
202 return [];
203 }
lib/exchange/sideshift/sideshift_exchange_provider.dart
+2 -2
@@ -29,9 +29,7 @@ class SideShiftExchangeProvider extends ExchangeProvider {
29 CryptoCurrency.dcr,
30 CryptoCurrency.kmd,
31 CryptoCurrency.mkr,
32 - CryptoCurrency.near,
32 CryptoCurrency.oxt,
34 - CryptoCurrency.paxg,
33 CryptoCurrency.pivx,
34 CryptoCurrency.rune,
35 CryptoCurrency.rvn,
@@ -300,6 +298,8 @@ class SideShiftExchangeProvider extends ExchangeProvider {
298 return 'usdcsol';
299 case CryptoCurrency.maticpoly:
300 return 'polygon';
301 + case CryptoCurrency.btcln:
302 + return 'ln';
303 default:
304 return currency.title.toLowerCase();
305 }
lib/exchange/trocador/trocador_exchange_provider.dart
+2
@@ -285,6 +285,8 @@ class TrocadorExchangeProvider extends ExchangeProvider {
285 return 'ERC20';
286 case 'TRX':
287 return 'TRC20';
288 + case 'LN':
289 + return 'Lightning';
290 default:
291 return tag.toLowerCase();
292 }