diff --git a/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt b/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt index 76b16b1409..3fe078eaad 100644 --- a/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt +++ b/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt @@ -71,7 +71,10 @@ internal class DefaultTransactionRepository( } Blockchain.Binance -> BinanceTransactionExtras(memo) Blockchain.XRP -> memo.toLongOrNull()?.let { XrpTransactionBuilder.XrpTransactionExtras(it) } - Blockchain.Cosmos -> CosmosTransactionExtras(memo) + Blockchain.Cosmos, + Blockchain.TerraV1, + Blockchain.TerraV2, + -> CosmosTransactionExtras(memo) Blockchain.TON -> TonTransactionExtras(memo) Blockchain.Hedera -> HederaTransactionBuilder.HederaTransactionExtras(memo) Blockchain.Algorand -> AlgorandTransactionExtras(memo) diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesOperations.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesOperations.kt index fac9f7fc95..d12ca4c9ad 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesOperations.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesOperations.kt @@ -264,10 +264,18 @@ internal class CurrenciesStatusesOperations( var quotesRetrievingFailed = false val networksStatuses = maybeNetworkStatuses?.bind()?.toNonEmptySetOrNull() - val quotes = recover({ maybeQuotes?.bind()?.toNonEmptySetOrNull() }) { - quotesRetrievingFailed = true - null - } + val quotes: Set? = maybeQuotes?.fold( + ifLeft = { + quotesRetrievingFailed = true + null + }, + ifRight = { + it.ifEmpty { + quotesRetrievingFailed = true + null + } + }, + ) currencies.map { currency -> val quote = quotes?.firstOrNull { it.rawCurrencyId == currency.id.rawCurrencyId } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/StateRouter.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/StateRouter.kt index 5f2201052b..e09467fa9c 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/StateRouter.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/StateRouter.kt @@ -34,7 +34,7 @@ internal class StateRouter( when { isSuccess -> popBackStack() isEditingDisabled -> when (type) { - SendUiStateType.Send -> showFee() + SendUiStateType.EditFee -> showSend() else -> popBackStack() } else -> when (type) { diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt index 1de2ea58fb..74abacad98 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt @@ -71,7 +71,7 @@ internal class SendNotificationFactory( buildList { // errors addFeeUnreachableNotification(feeState.feeSelectorState) - addExceedBalanceNotification(feeValue, sendingAmount) + addExceedBalanceNotification(feeValue, sendingAmount, isFeeCoverage) addExceedsBalanceNotification(feeState.fee) addDustWarningNotification(feeValue, sendingAmount) addTransactionLimitErrorNotification(feeValue, sendingAmount) @@ -107,11 +107,12 @@ internal class SendNotificationFactory( private fun MutableList.addExceedBalanceNotification( feeAmount: BigDecimal, receivedAmount: BigDecimal, + isFeeCoverage: Boolean, ) { val cryptoCurrencyStatus = cryptoCurrencyStatusProvider() val balance = cryptoCurrencyStatus.value.amount ?: BigDecimal.ZERO - if (!isSubtractAvailableProvider()) return + if (isFeeCoverage) return val showNotification = receivedAmount + feeAmount > balance if (showNotification) { diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeCalculation.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeCalculation.kt index 5376e57084..c7f5a024df 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeCalculation.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/FeeCalculation.kt @@ -45,7 +45,7 @@ internal fun checkFeeCoverage( feeValue: BigDecimal, ): Boolean { if (!isSubtractAvailable) return false - return balance < amountValue + feeValue && balance > feeValue + return balance < amountValue + feeValue && balance > feeValue && balance >= amountValue } /** diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt index 50f368670f..eca7088154 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/viewmodel/SendViewModel.kt @@ -667,7 +667,7 @@ internal class SendViewModel @Inject constructor( private fun autoNextFromRecipient(type: EnterAddressSource?, isValidAddress: Boolean) { val isRecent = type == EnterAddressSource.RecentAddress - if (isRecent && isValidAddress) onNextClick() + if (isRecent && isValidAddress) onNextClick(stateRouter.isEditState) } // endregion @@ -702,6 +702,7 @@ internal class SendViewModel @Inject constructor( val isShowStatus = uiState.feeState?.fee == null if (isShowStatus) { uiState = feeStateFactory.onFeeOnLoadingState() + updateNotifications() } val result = callFeeUseCase()?.fold( ifRight = {