mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
Merge branch 'refs/heads/main' into MrCyjaneK-cyjan-monerodart
# Conflicts: # cw_monero/ios/Classes/monero_api.cpp # cw_monero/lib/api/signatures.dart # cw_monero/lib/api/types.dart # cw_monero/lib/api/wallet.dart
This commit is contained in:
commit
dc424b58fc
4 changed files with 36 additions and 14 deletions
|
@ -253,7 +253,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
|
|||
static CryptoCurrency fromString(String name, {CryptoCurrency? walletCurrency}) {
|
||||
try {
|
||||
return CryptoCurrency.all.firstWhere((element) =>
|
||||
element.title.toLowerCase() == name &&
|
||||
element.title.toLowerCase() == name.toLowerCase() &&
|
||||
(element.tag == null ||
|
||||
element.tag == walletCurrency?.title ||
|
||||
element.tag == walletCurrency?.tag));
|
||||
|
|
|
@ -15,8 +15,8 @@ class SolanaBalance extends Balance {
|
|||
|
||||
String _balanceFormatted() {
|
||||
String stringBalance = balance.toString();
|
||||
if (stringBalance.toString().length >= 6) {
|
||||
stringBalance = stringBalance.substring(0, 6);
|
||||
if (stringBalance.toString().length >= 12) {
|
||||
stringBalance = stringBalance.substring(0, 12);
|
||||
}
|
||||
return stringBalance;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ class ContactPage extends BasePage {
|
|||
final TextEditingController _nameController;
|
||||
final TextEditingController _currencyTypeController;
|
||||
final TextEditingController _addressController;
|
||||
bool _isEffectsApplied = false;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
|
@ -53,15 +54,7 @@ class ContactPage extends BasePage {
|
|||
color: Theme.of(context).extension<TransactionTradeTheme>()!.detailsTitlesColor,
|
||||
height: 8);
|
||||
|
||||
reaction((_) => contactViewModel.state, (ExecutionState state) {
|
||||
if (state is FailureState) {
|
||||
_onContactSavingFailure(context, state.error);
|
||||
}
|
||||
|
||||
if (state is ExecutedSuccessfullyState) {
|
||||
_onContactSavedSuccessfully(context);
|
||||
}
|
||||
});
|
||||
_setEffects(context);
|
||||
|
||||
return Observer(
|
||||
builder: (_) => ScrollableWithBottomSection(
|
||||
|
@ -177,4 +170,22 @@ class ContactPage extends BasePage {
|
|||
|
||||
void _onContactSavedSuccessfully(BuildContext context) =>
|
||||
Navigator.of(context).pop();
|
||||
|
||||
void _setEffects(BuildContext context) {
|
||||
if (_isEffectsApplied) {
|
||||
return;
|
||||
}
|
||||
|
||||
_isEffectsApplied = true;
|
||||
|
||||
reaction((_) => contactViewModel.state, (ExecutionState state) {
|
||||
if (state is FailureState) {
|
||||
_onContactSavingFailure(context, state.error);
|
||||
}
|
||||
|
||||
if (state is ExecutedSuccessfullyState) {
|
||||
_onContactSavedSuccessfully(context);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,8 +139,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
String get pendingTransactionFeeFiatAmount {
|
||||
try {
|
||||
if (pendingTransaction != null) {
|
||||
final currency =
|
||||
isEVMCompatibleChain(walletType) ? wallet.currency : selectedCryptoCurrency;
|
||||
final currency = pendingTransactionFeeCurrency(walletType);
|
||||
final fiat = calculateFiatAmount(
|
||||
price: _fiatConversationStore.prices[currency]!,
|
||||
cryptoAmount: pendingTransaction!.feeFormatted);
|
||||
|
@ -153,6 +152,18 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
}
|
||||
}
|
||||
|
||||
CryptoCurrency pendingTransactionFeeCurrency(WalletType type) {
|
||||
switch (type) {
|
||||
case WalletType.ethereum:
|
||||
case WalletType.polygon:
|
||||
case WalletType.tron:
|
||||
case WalletType.solana:
|
||||
return wallet.currency;
|
||||
default:
|
||||
return selectedCryptoCurrency;
|
||||
}
|
||||
}
|
||||
|
||||
FiatCurrency get fiat => _settingsStore.fiatCurrency;
|
||||
|
||||
TransactionPriority get transactionPriority {
|
||||
|
|
Loading…
Reference in a new issue