mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
CWA-153 | fixed validation for ada and nano
This commit is contained in:
parent
aba0aede28
commit
89354b083b
5 changed files with 13 additions and 15 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -87,6 +87,4 @@ cw_monero/cw_monero/android/.cxx/
|
||||||
android/key.properties
|
android/key.properties
|
||||||
|
|
||||||
**/tool/.secrets-prod.json
|
**/tool/.secrets-prod.json
|
||||||
**/lib/.secrets.g.dart
|
**/lib/.secrets.g.dart
|
||||||
|
|
||||||
**/lib/generated/i18n.dart
|
|
|
@ -45,9 +45,9 @@ abstract class AddressBookStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
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)
|
// 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);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
|
@ -56,7 +56,7 @@ abstract class AddressBookStoreBase with Store {
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.bch:
|
case CryptoCurrency.bch:
|
||||||
isValid = (value.length == 42);
|
isValid = (value.length == 42);
|
||||||
|
|
|
@ -226,9 +226,9 @@ abstract class ExchangeStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
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)
|
// 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);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
|
@ -237,7 +237,7 @@ abstract class ExchangeStoreBase with Store {
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.bch:
|
case CryptoCurrency.bch:
|
||||||
isValid = (value.length == 42);
|
isValid = (value.length == 42);
|
||||||
|
|
|
@ -159,9 +159,9 @@ abstract class SendStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
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)
|
// 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);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
|
@ -170,7 +170,7 @@ abstract class SendStoreBase with Store {
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.bch:
|
case CryptoCurrency.bch:
|
||||||
isValid = (value.length == 42);
|
isValid = (value.length == 42);
|
||||||
|
|
|
@ -116,9 +116,9 @@ abstract class WalleRestorationStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
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)
|
// 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);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
|
@ -127,7 +127,7 @@ abstract class WalleRestorationStoreBase with Store {
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.bch:
|
case CryptoCurrency.bch:
|
||||||
isValid = (value.length == 42);
|
isValid = (value.length == 42);
|
||||||
|
|
Loading…
Reference in a new issue