Merge pull request #13 from cake-tech/CWA-155-BTC-validation

CWA-155 | added btc validation, that include Bech32 address format
This commit is contained in:
M 2020-01-10 20:00:49 +02:00
commit 28be299edb
4 changed files with 8 additions and 8 deletions

View file

@ -45,7 +45,7 @@ abstract class AddressBookStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), BTC (34), ETH (42), LTC (34), BCH (42), DASH (34)
// XMR (95), BTC (34, 42), ETH (42), LTC (34), BCH (42), DASH (34)
const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
@ -56,7 +56,7 @@ abstract class AddressBookStoreBase with Store {
isValid = (value.length == 95);
break;
case 'BTC':
isValid = (value.length == 34);
isValid = (value.length == 34)||(value.length == 42);
break;
case 'ETH':
isValid = (value.length == 42);

View file

@ -226,7 +226,7 @@ abstract class ExchangeStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), BTC (34), ETH (42), LTC (34), BCH (42), DASH (34)
// XMR (95), BTC (34, 42), ETH (42), LTC (34), BCH (42), DASH (34)
const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
@ -237,7 +237,7 @@ abstract class ExchangeStoreBase with Store {
isValid = (value.length == 95);
break;
case 'BTC':
isValid = (value.length == 34);
isValid = (value.length == 34)||(value.length == 42);
break;
case 'ETH':
isValid = (value.length == 42);

View file

@ -159,7 +159,7 @@ abstract class SendStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), BTC (34), ETH (42), LTC (34), BCH (42), DASH (34)
// XMR (95), BTC (34, 42), ETH (42), LTC (34), BCH (42), DASH (34)
const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$';
final regExp = RegExp(pattern);
isValid = value == null ? false : regExp.hasMatch(value);
@ -170,7 +170,7 @@ abstract class SendStoreBase with Store {
isValid = (value.length == 95);
break;
case 'BTC':
isValid = (value.length == 34);
isValid = (value.length == 34)||(value.length == 42);
break;
case 'ETH':
isValid = (value.length == 42);

View file

@ -116,7 +116,7 @@ abstract class WalleRestorationStoreBase with Store {
}
void validateAddress(String value, {CryptoCurrency cryptoCurrency}) {
// XMR (95), BTC (34), ETH (42), LTC (34), BCH (42), DASH (34)
// XMR (95), BTC (34, 42), ETH (42), LTC (34), BCH (42), DASH (34)
const pattern = '^[0-9a-zA-Z]{95}\$|^[0-9a-zA-Z]{34}\$|^[0-9a-zA-Z]{42}\$';
final regExp = RegExp(pattern);
isValid = regExp.hasMatch(value);
@ -127,7 +127,7 @@ abstract class WalleRestorationStoreBase with Store {
isValid = (value.length == 95);
break;
case 'BTC':
isValid = (value.length == 34);
isValid = (value.length == 34)||(value.length == 42);
break;
case 'ETH':
isValid = (value.length == 42);