From 5aadb8e2a8e6317b5f00ac5a91156c9885ebfa7e Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 4 Dec 2025 10:20:17 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../model/YieldSupplyStartEarningModel.kt | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt index f9d09e6fac..a41f836310 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt @@ -142,8 +142,13 @@ internal class YieldSupplyStartEarningModel @Inject constructor( it.copy(yieldSupplyFeeUM = YieldSupplyFeeUM.Loading) } - val maxFee = yieldSupplyGetMaxFeeUseCase(userWalletId, cryptoCurrencyStatus).getOrNull() ?: return - val estimatedFee = yieldSupplyGetCurrentFeeUseCase(userWalletId, cryptoCurrencyStatus).getOrNull() ?: return + val maxFee = yieldSupplyGetMaxFeeUseCase(userWalletId, cryptoCurrencyStatus).getOrNull() + val estimatedFee = yieldSupplyGetCurrentFeeUseCase(userWalletId, cryptoCurrencyStatus).getOrNull() + + if (estimatedFee == null || maxFee == null) { + showFeeUnknownError() + return + } val transactionListData = yieldSupplyStartEarningUseCase( userWalletId = userWalletId, @@ -152,15 +157,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor( ).getOrNull() if (transactionListData == null) { - uiState.update { - it.copy(yieldSupplyFeeUM = YieldSupplyFeeUM.Error) - } - yieldSupplyNotificationsUpdateTrigger.triggerUpdate( - data = YieldSupplyNotificationData( - feeValue = null, - feeError = GetFeeError.UnknownError, - ), - ) + showFeeUnknownError() return } @@ -372,4 +369,16 @@ internal class YieldSupplyStartEarningModel @Inject constructor( popBack = params.callback::onBackClick, ) } + + private suspend fun showFeeUnknownError() { + uiState.update { + it.copy(yieldSupplyFeeUM = YieldSupplyFeeUM.Error) + } + yieldSupplyNotificationsUpdateTrigger.triggerUpdate( + data = YieldSupplyNotificationData( + feeValue = null, + feeError = GetFeeError.UnknownError, + ), + ) + } } \ No newline at end of file