Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-20 00:35:49 +05:00
parent 596146f65d
commit 40ab999383
3 changed files with 51 additions and 2 deletions

View file

@ -1557,7 +1557,7 @@ internal class SwapInteractorImpl @Inject constructor(
transaction = transaction,
selectedToken = selectedFeeToken,
).fold(
ifLeft = { GetFeeError.UnknownError.left() },
ifLeft = { error -> GetFeeError.DataError(error).left() },
ifRight = { dexFeeResult ->
val feeToken = selectedFeeToken
?: resolveNativeFeeTokenStatus(fromStatus)

View file

@ -1685,7 +1685,7 @@ internal class SwapModel @Inject constructor(
val isNotNullCurrency = fromSwapCurrencyStatus != null && toSwapCurrencyStatus != null
if (provider != null && swapState != null && isNotNullCurrency) {
modelScope.launch {
feeSelectorRepository.state.value = FeeSelectorUM.Loading
feeSelectorReloadTrigger.triggerLoadingState()
feeSelectorReloadTrigger.triggerUpdate()
}
analyticsEventHandler.send(SwapEvents.ProviderChosen(provider))
@ -1710,6 +1710,15 @@ internal class SwapModel @Inject constructor(
appRouter.push(route)
},
openTokenDetailsScreen = { cryptoCurrency ->
val fromSwapCurrencyStatus = dataState.fromSwapCurrencyStatus ?: return@UiActions
val route = AppRoute.CurrencyDetails(
userWalletId = fromSwapCurrencyStatus.userWalletId,
currency = cryptoCurrency,
)
appRouter.push(route)
},
onRetryClick = {
startLoadingQuotesFromLastState()
},

View file

@ -379,6 +379,46 @@ internal class SwapNotificationsFactory(
}
}
private fun MutableList<NotificationUM>.maybeAddFeeErrorNotification(
feeCryptoCurrencyStatus: CryptoCurrencyStatus?,
quoteModel: SwapState.QuotesLoadedState,
feeError: GetFeeError?,
) {
if (feeError == null || feeCryptoCurrencyStatus == null) return
when (feeError) {
is GetFeeError.DataError -> {
val error = feeError.cause
if (error is ExpressDataError) {
addAll(
getQuotesErrorStateNotifications(
expressDataError = error,
fromToken = quoteModel.fromTokenInfo.swapCurrencyStatus.currency,
balanceStatus = quoteModel.preparedSwapConfigState.balanceStatus,
swapFee = null,
),
)
} else {
addFeeUnreachableNotification(
tokenStatus = quoteModel.fromTokenInfo.swapCurrencyStatus.status,
coinStatus = feeCryptoCurrencyStatus,
feeError = feeError,
dustValue = quoteModel.currencyCheck?.dustValue,
onReload = actions.onRetryClick,
onClick = actions.openTokenDetailsScreen,
)
}
}
else -> addFeeUnreachableNotification(
tokenStatus = quoteModel.fromTokenInfo.swapCurrencyStatus.status,
coinStatus = feeCryptoCurrencyStatus,
feeError = feeError,
dustValue = quoteModel.currencyCheck?.dustValue,
onReload = actions.onRetryClick,
onClick = actions.openTokenDetailsScreen,
)
}
}
private fun MutableList<NotificationUM>.addReduceAmountNotification(
cryptoCurrencyStatus: CryptoCurrencyStatus,
fromAmount: SwapAmount,