mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into secure_storage_fresh_install
This commit is contained in:
commit
1a9f843c0e
6 changed files with 32 additions and 18 deletions
|
@ -106,8 +106,7 @@ class AddressValidator extends TextValidator {
|
|||
case CryptoCurrency.wow:
|
||||
pattern = '[0-9a-zA-Z]+';
|
||||
case CryptoCurrency.bch:
|
||||
pattern =
|
||||
'(?!bitcoincash:)[0-9a-zA-Z]*|(?!bitcoincash:)q|p[0-9a-zA-Z]{41}|(?!bitcoincash:)q|p[0-9a-zA-Z]{42}|bitcoincash:q|p[0-9a-zA-Z]{41}|bitcoincash:q|p[0-9a-zA-Z]{42}';
|
||||
pattern = '^(bitcoincash:)?(q|p)[0-9a-zA-Z]{41,42}';
|
||||
case CryptoCurrency.bnb:
|
||||
pattern = '[0-9a-zA-Z]+';
|
||||
case CryptoCurrency.hbar:
|
||||
|
|
|
@ -141,8 +141,8 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
|||
'coinTo': _normalizeCurrency(request.toCurrency),
|
||||
'networkFrom': _networkFor(request.fromCurrency),
|
||||
'networkTo': _networkFor(request.toCurrency),
|
||||
'withdrawalAddress': request.toAddress,
|
||||
'refundAddress': request.refundAddress,
|
||||
'withdrawalAddress': _normalizeAddress(request.toAddress),
|
||||
'refundAddress': _normalizeAddress(request.refundAddress),
|
||||
'rateType': _getRateType(isFixedRateMode),
|
||||
'apiToken': apiKey,
|
||||
};
|
||||
|
@ -275,4 +275,7 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
|||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -129,8 +129,8 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
"currency_to": _normalizeCurrency(request.toCurrency),
|
||||
"amount": request.fromAmount,
|
||||
"fixed": isFixedRateMode,
|
||||
"user_refund_address": request.refundAddress,
|
||||
"address_to": request.toAddress
|
||||
"user_refund_address": _normalizeAddress(request.refundAddress),
|
||||
"address_to": _normalizeAddress(request.toAddress)
|
||||
};
|
||||
final uri = Uri.https(apiAuthority, createExchangePath, params);
|
||||
|
||||
|
@ -243,4 +243,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
return currency.title.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -129,8 +129,8 @@ class StealthExExchangeProvider extends ExchangeProvider {
|
|||
if (isFixedRateMode) 'rate_id': rateId,
|
||||
'amount':
|
||||
isFixedRateMode ? double.parse(request.toAmount) : double.parse(request.fromAmount),
|
||||
'address': request.toAddress,
|
||||
'refund_address': request.refundAddress,
|
||||
'address': _normalizeAddress(request.toAddress),
|
||||
'refund_address': _normalizeAddress(request.refundAddress),
|
||||
'additional_fee_percent': _additionalFeePercent,
|
||||
};
|
||||
|
||||
|
@ -296,4 +296,7 @@ class StealthExExchangeProvider extends ExchangeProvider {
|
|||
|
||||
return currency.tag!.toLowerCase();
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -116,9 +116,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
|
|||
required bool isFixedRateMode,
|
||||
required bool isSendAll,
|
||||
}) async {
|
||||
String formattedToAddress = request.toAddress.startsWith('bitcoincash:')
|
||||
? request.toAddress.replaceFirst('bitcoincash:', '')
|
||||
: request.toAddress;
|
||||
|
||||
|
||||
final formattedFromAmount = double.parse(request.fromAmount);
|
||||
|
||||
|
@ -126,11 +124,11 @@ class ThorChainExchangeProvider extends ExchangeProvider {
|
|||
'from_asset': _normalizeCurrency(request.fromCurrency),
|
||||
'to_asset': _normalizeCurrency(request.toCurrency),
|
||||
'amount': _doubleToThorChainString(formattedFromAmount),
|
||||
'destination': formattedToAddress,
|
||||
'destination': _normalizeAddress(request.toAddress),
|
||||
'affiliate': _affiliateName,
|
||||
'affiliate_bps': _affiliateBps,
|
||||
'refund_address':
|
||||
isRefundAddressSupported.contains(request.fromCurrency) ? request.refundAddress : '',
|
||||
isRefundAddressSupported.contains(request.fromCurrency) ? _normalizeAddress(request.refundAddress) : '',
|
||||
};
|
||||
|
||||
final responseJSON = await _getSwapQuote(params);
|
||||
|
@ -288,4 +286,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
|
|||
|
||||
return currentState;
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -99,18 +99,23 @@ abstract class ContactListViewModelBase with Store {
|
|||
|
||||
Future<void> delete(ContactRecord contact) async => contact.original.delete();
|
||||
|
||||
@computed
|
||||
List<ContactRecord> get contactsToShow =>
|
||||
contacts.where((element) => _isValidForCurrency(element)).toList();
|
||||
ObservableList<ContactRecord> get contactsToShow =>
|
||||
ObservableList.of(contacts.where((element) => _isValidForCurrency(element)));
|
||||
|
||||
@computed
|
||||
List<WalletContact> get walletContactsToShow =>
|
||||
walletContacts.where((element) => _isValidForCurrency(element)).toList();
|
||||
|
||||
bool _isValidForCurrency(ContactBase element) {
|
||||
if (element.name.contains('Silent Payments')) return false;
|
||||
if (element.name.contains('MWEB')) return false;
|
||||
|
||||
return _currency == null ||
|
||||
element.type == _currency ||
|
||||
element.type.title == _currency!.tag ||
|
||||
element.type.tag == _currency!.tag;
|
||||
(element.type.tag != null &&
|
||||
_currency?.tag != null &&
|
||||
element.type.tag == _currency?.tag) ||
|
||||
_currency?.toString() == element.type.tag ||
|
||||
_currency?.tag == element.type.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue