CWA-153 | fixed validation for ada and nano

This commit is contained in:
Oleksandr Sobol 2020-01-10 21:54:59 +02:00
parent aba0aede28
commit 89354b083b
5 changed files with 13 additions and 15 deletions

4
.gitignore vendored
View file

@ -87,6 +87,4 @@ cw_monero/cw_monero/android/.cxx/
android/key.properties
**/tool/.secrets-prod.json
**/lib/.secrets.g.dart
**/lib/generated/i18n.dart
**/lib/.secrets.g.dart

View file

@ -45,9 +45,9 @@ abstract class AddressBookStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
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}\$';
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}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
if (isValid && cryptoCurrency != null) {
@ -56,7 +56,7 @@ abstract class AddressBookStoreBase with Store {
isValid = (value.length == 95);
break;
case CryptoCurrency.ada:
isValid = (value.length == 105);
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
break;
case CryptoCurrency.bch:
isValid = (value.length == 42);

View file

@ -226,9 +226,9 @@ abstract class ExchangeStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
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}\$';
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}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
if (isValid && cryptoCurrency != null) {
@ -237,7 +237,7 @@ abstract class ExchangeStoreBase with Store {
isValid = (value.length == 95);
break;
case CryptoCurrency.ada:
isValid = (value.length == 105);
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
break;
case CryptoCurrency.bch:
isValid = (value.length == 42);

View file

@ -159,9 +159,9 @@ abstract class SendStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
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}\$';
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}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
if (isValid && cryptoCurrency != null) {
@ -170,7 +170,7 @@ abstract class SendStoreBase with Store {
isValid = (value.length == 95);
break;
case CryptoCurrency.ada:
isValid = (value.length == 105);
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
break;
case CryptoCurrency.bch:
isValid = (value.length == 42);

View file

@ -116,9 +116,9 @@ abstract class WalleRestorationStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), ADA (105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
// ETH (42), LTC (34), NANO (64, 65), TRX (34), USDT (42), XLM (56), XRP (34)
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}\$';
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}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
if (isValid && cryptoCurrency != null) {
@ -127,7 +127,7 @@ abstract class WalleRestorationStoreBase with Store {
isValid = (value.length == 95);
break;
case CryptoCurrency.ada:
isValid = (value.length == 105);
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
break;
case CryptoCurrency.bch:
isValid = (value.length == 42);