CWA-163 | added integrated address for xmr to validation
Oleksandr Sobol committed
Jan 21, 2020 at 21:29 UTC
2a4d9a8fa6d5cc54404bac4dab1dea7f28791b53
4 files changed
+12
-12
lib/src/stores/address_book/address_book_store.dart
+3
-3
@@ -45,15 +45,15 @@ abstract class AddressBookStoreBase with Store {
45
}
46
47
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
48
- // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
48
+ // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
49
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
50
- const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$';
50
+ const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$';
51
final regExp = RegExp(pattern);
52
isValid = regExp.hasMatch(value);
53
if (isValid && cryptoCurrency != null) {
54
switch (cryptoCurrency) {
55
case CryptoCurrency.xmr:
56
- isValid = (value.length == 95);
56
+ isValid = (value.length == 95)||(value.length == 106);
57
break;
58
case CryptoCurrency.ada:
59
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
lib/src/stores/exchange/exchange_store.dart
+3
-3
@@ -226,15 +226,15 @@ abstract class ExchangeStoreBase with Store {
226
}
227
228
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
229
- // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
229
+ // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
230
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
231
- const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$';
231
+ const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$';
232
final regExp = RegExp(pattern);
233
isValid = regExp.hasMatch(value);
234
if (isValid && cryptoCurrency != null) {
235
switch (cryptoCurrency) {
236
case CryptoCurrency.xmr:
237
- isValid = (value.length == 95);
237
+ isValid = (value.length == 95)||(value.length == 106);
238
break;
239
case CryptoCurrency.ada:
240
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
lib/src/stores/send/send_store.dart
+3
-3
@@ -155,15 +155,15 @@ abstract class SendStoreBase with Store {
155
}
156
157
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
158
- // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
158
+ // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
159
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
160
- const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$';
160
+ const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$';
161
final regExp = RegExp(pattern);
162
isValid = regExp.hasMatch(value);
163
if (isValid && cryptoCurrency != null) {
164
switch (cryptoCurrency) {
165
case CryptoCurrency.xmr:
166
- isValid = (value.length == 95);
166
+ isValid = (value.length == 95)||(value.length == 106);
167
break;
168
case CryptoCurrency.ada:
169
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
lib/src/stores/wallet_restoration/wallet_restoration_store.dart
+3
-3
@@ -116,15 +116,15 @@ abstract class WalleRestorationStoreBase with Store {
116
}
117
118
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
119
- // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
119
+ // XMR (95, 106), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
120
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
121
- const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$';
121
+ const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$|^[0-9a-zA-Z]{56}\$|^[0-9a-zA-Z]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[0-9a-zA-Z]{105}\$|^[0-9a-zA-Z]{106}\$';
122
final regExp = RegExp(pattern);
123
isValid = regExp.hasMatch(value);
124
if (isValid && cryptoCurrency != null) {
125
switch (cryptoCurrency) {
126
case CryptoCurrency.xmr:
127
- isValid = (value.length == 95);
127
+ isValid = (value.length == 95)||(value.length == 106);
128
break;
129
case CryptoCurrency.ada:
130
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);