CWA-153 | fixed validation for ada and nano

Oleksandr Sobol committed Jan 10, 2020 at 21:54 UTC 89354b083bdcd6936fa95c80b032e150a5726c42
5 files changed +13 -15
.gitignore
+1 -3
@@ -87,6 +87,4 @@ cw_monero/cw_monero/android/.cxx/
87 android/key.properties
88
89 **/tool/.secrets-prod.json
90 -**/lib/.secrets.g.dart
91 -
92 -**/lib/generated/i18n.dart
\ No newline at end of file
90 +**/lib/.secrets.g.dart
\ No newline at end of file
lib/src/stores/address_book/address_book_store.dart
+3 -3
@@ -45,9 +45,9 @@ abstract class AddressBookStoreBase with Store {
45 }
46
47 void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
48 - // XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
48 + // XMR (95), 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]{64}\$|^[0-9a-zA-Z]{65}\$|^[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}\$';
51 final regExp = RegExp(pattern);
52 isValid = regExp.hasMatch(value);
53 if (isValid && cryptoCurrency != null) {
@@ -56,7 +56,7 @@ abstract class AddressBookStoreBase with Store {
56 isValid = (value.length == 95);
57 break;
58 case CryptoCurrency.ada:
59 - isValid = (value.length == 105);
59 + isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
60 break;
61 case CryptoCurrency.bch:
62 isValid = (value.length == 42);
lib/src/stores/exchange/exchange_store.dart
+3 -3
@@ -226,9 +226,9 @@ abstract class ExchangeStoreBase with Store {
226 }
227
228 void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
229 - // XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
229 + // XMR (95), 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]{64}\$|^[0-9a-zA-Z]{65}\$|^[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}\$';
232 final regExp = RegExp(pattern);
233 isValid = regExp.hasMatch(value);
234 if (isValid && cryptoCurrency != null) {
@@ -237,7 +237,7 @@ abstract class ExchangeStoreBase with Store {
237 isValid = (value.length == 95);
238 break;
239 case CryptoCurrency.ada:
240 - isValid = (value.length == 105);
240 + isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
241 break;
242 case CryptoCurrency.bch:
243 isValid = (value.length == 42);
lib/src/stores/send/send_store.dart
+3 -3
@@ -159,9 +159,9 @@ abstract class SendStoreBase with Store {
159 }
160
161 void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
162 - // XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
162 + // XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
163 // ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
164 - 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]{64}\$|^[0-9a-zA-Z]{65}\$|^[0-9a-zA-Z]{105}\$';
164 + 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}\$';
165 final regExp = RegExp(pattern);
166 isValid = regExp.hasMatch(value);
167 if (isValid && cryptoCurrency != null) {
@@ -170,7 +170,7 @@ abstract class SendStoreBase with Store {
170 isValid = (value.length == 95);
171 break;
172 case CryptoCurrency.ada:
173 - isValid = (value.length == 105);
173 + isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
174 break;
175 case CryptoCurrency.bch:
176 isValid = (value.length == 42);
lib/src/stores/wallet_restoration/wallet_restoration_store.dart
+3 -3
@@ -116,9 +116,9 @@ abstract class WalleRestorationStoreBase with Store {
116 }
117
118 void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
119 - // XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
119 + // XMR (95), 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]{64}\$|^[0-9a-zA-Z]{65}\$|^[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}\$';
122 final regExp = RegExp(pattern);
123 isValid = regExp.hasMatch(value);
124 if (isValid && cryptoCurrency != null) {
@@ -127,7 +127,7 @@ abstract class WalleRestorationStoreBase with Store {
127 isValid = (value.length == 95);
128 break;
129 case CryptoCurrency.ada:
130 - isValid = (value.length == 105);
130 + isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
131 break;
132 case CryptoCurrency.bch:
133 isValid = (value.length == 42);