From 2a4d9a8fa6d5cc54404bac4dab1dea7f28791b53 Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Tue, 21 Jan 2020 21:29:02 +0200 Subject: [PATCH] CWA-163 | added integrated address for xmr to validation --- lib/src/stores/address_book/address_book_store.dart | 6 +++--- lib/src/stores/exchange/exchange_store.dart | 6 +++--- lib/src/stores/send/send_store.dart | 6 +++--- .../stores/wallet_restoration/wallet_restoration_store.dart | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/src/stores/address_book/address_book_store.dart b/lib/src/stores/address_book/address_book_store.dart index 13bd8f591..527809cbd 100644 --- a/lib/src/stores/address_book/address_book_store.dart +++ b/lib/src/stores/address_book/address_book_store.dart @@ -45,15 +45,15 @@ abstract class AddressBookStoreBase with Store { } 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) - 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); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); diff --git a/lib/src/stores/exchange/exchange_store.dart b/lib/src/stores/exchange/exchange_store.dart index 7d20fd6c8..a0cf932e4 100644 --- a/lib/src/stores/exchange/exchange_store.dart +++ b/lib/src/stores/exchange/exchange_store.dart @@ -226,15 +226,15 @@ abstract class ExchangeStoreBase with Store { } 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) - 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); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); diff --git a/lib/src/stores/send/send_store.dart b/lib/src/stores/send/send_store.dart index 494927857..dbad353c4 100644 --- a/lib/src/stores/send/send_store.dart +++ b/lib/src/stores/send/send_store.dart @@ -155,15 +155,15 @@ abstract class SendStoreBase with Store { } 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) - 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); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105); diff --git a/lib/src/stores/wallet_restoration/wallet_restoration_store.dart b/lib/src/stores/wallet_restoration/wallet_restoration_store.dart index 2565bfc24..fad8f20d8 100644 --- a/lib/src/stores/wallet_restoration/wallet_restoration_store.dart +++ b/lib/src/stores/wallet_restoration/wallet_restoration_store.dart @@ -116,15 +116,15 @@ abstract class WalleRestorationStoreBase with Store { } 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) - 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); isValid = regExp.hasMatch(value); if (isValid && cryptoCurrency != null) { switch (cryptoCurrency) { case CryptoCurrency.xmr: - isValid = (value.length == 95); + isValid = (value.length == 95)||(value.length == 106); break; case CryptoCurrency.ada: isValid = (value.length == 59)||(value.length == 92)||(value.length == 105);