Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-03 18:32:27 +03:00
parent 3d9b107be6
commit 13a96189b0
3 changed files with 19 additions and 4 deletions

View file

@ -1648,7 +1648,14 @@ internal class SwapInteractorImpl @AssistedInject constructor(
}
}
} else {
IncludeFeeInAmount.Excluded
val fee = txFeeSealedState.txFee.fee.amount.value ?: BigDecimal.ZERO
getIncludeFeeInAmountForNative(
networkId = networkId,
amount = amount,
reduceBalanceBy = reduceBalanceBy,
fromToken = fromToken.currency,
feeValue = fee,
)
}
}
is TxFeeSealedState.Legacy -> {

View file

@ -2194,9 +2194,14 @@ internal class SwapModel @Inject constructor(
state.value = newState
// If fee currency is same as from currency, we need to reload quotes to update fee info
if (newState is FeeSelectorUM.Content &&
val isFeeCurrencySameAsFromCurrency = newState is FeeSelectorUM.Content &&
dataState.fromCryptoCurrency?.currency?.id == newState.feeExtraInfo.feeCryptoCurrencyStatus.currency.id
) {
// If fee currency is coin, we need to reload quotes to update fee related warnings (e.g. insufficient funds)
val isCoinFeeSelected = newState is FeeSelectorUM.Content &&
newState.feeExtraInfo.feeCryptoCurrencyStatus.currency is CryptoCurrency.Coin
if (isFeeCurrencySameAsFromCurrency || isCoinFeeSelected) {
// block swap button until fee is loaded
uiState = uiState.copy(
swapButton = uiState.swapButton.copy(

View file

@ -298,9 +298,12 @@ internal class SwapNotificationsFactory(
quoteModel.permissionState !is PermissionDataState.PermissionLoading &&
feeEnoughState.feeCurrency != fromToken
val isNotEnoughFee =
quoteModel.preparedSwapConfigState.includeFeeInAmount is IncludeFeeInAmount.BalanceNotEnough
val isGaslessAvailable = iGaslessFeeSupportedForNetwork(fromToken.network) &&
quoteModel.swapProvider.type == ExchangeProviderType.CEX
if (shouldShowCoverWarning && !isGaslessAvailable) {
if (shouldShowCoverWarning && !isGaslessAvailable || isNotEnoughFee) {
add(
SwapNotificationUM.Error.UnableToCoverFeeWarning(
fromToken = fromToken,