mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-21 06:38:49 +00:00
CWA-163 | added integrated address for xmr to validation
This commit is contained in:
parent
59492a6634
commit
2a4d9a8fa6
4 changed files with 12 additions and 12 deletions
|
@ -45,15 +45,15 @@ abstract class AddressBookStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
||||||
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
|
// XMR (95, 106), 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]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[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}\$|^[0-9a-zA-Z]{106}\$';
|
||||||
final regExp = RegExp(pattern);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
switch (cryptoCurrency) {
|
switch (cryptoCurrency) {
|
||||||
case CryptoCurrency.xmr:
|
case CryptoCurrency.xmr:
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95)||(value.length == 106);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
|
|
|
@ -226,15 +226,15 @@ abstract class ExchangeStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
||||||
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
|
// XMR (95, 106), 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]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[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}\$|^[0-9a-zA-Z]{106}\$';
|
||||||
final regExp = RegExp(pattern);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
switch (cryptoCurrency) {
|
switch (cryptoCurrency) {
|
||||||
case CryptoCurrency.xmr:
|
case CryptoCurrency.xmr:
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95)||(value.length == 106);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
|
|
|
@ -155,15 +155,15 @@ abstract class SendStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
||||||
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
|
// XMR (95, 106), 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]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[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}\$|^[0-9a-zA-Z]{106}\$';
|
||||||
final regExp = RegExp(pattern);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
switch (cryptoCurrency) {
|
switch (cryptoCurrency) {
|
||||||
case CryptoCurrency.xmr:
|
case CryptoCurrency.xmr:
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95)||(value.length == 106);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
|
|
|
@ -116,15 +116,15 @@ abstract class WalleRestorationStoreBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
|
||||||
// XMR (95), ADA (59, 92, 105), BCH (42), BNB (42), BTC (34, 42), DASH (34), EOS (42),
|
// XMR (95, 106), 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]{59}\$|^[0-9a-zA-Z_]{64}\$|^[0-9a-zA-Z_]{65}\$|^[0-9a-zA-Z]{92}\$|^[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}\$|^[0-9a-zA-Z]{106}\$';
|
||||||
final regExp = RegExp(pattern);
|
final regExp = RegExp(pattern);
|
||||||
isValid = regExp.hasMatch(value);
|
isValid = regExp.hasMatch(value);
|
||||||
if (isValid && cryptoCurrency != null) {
|
if (isValid && cryptoCurrency != null) {
|
||||||
switch (cryptoCurrency) {
|
switch (cryptoCurrency) {
|
||||||
case CryptoCurrency.xmr:
|
case CryptoCurrency.xmr:
|
||||||
isValid = (value.length == 95);
|
isValid = (value.length == 95)||(value.length == 106);
|
||||||
break;
|
break;
|
||||||
case CryptoCurrency.ada:
|
case CryptoCurrency.ada:
|
||||||
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);
|
||||||
|
|
Loading…
Reference in a new issue