Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-15 20:15:37 +03:00
parent 22a32ec8f1
commit 99cdc003c8
16 changed files with 156 additions and 121 deletions

View file

@ -628,14 +628,14 @@ internal class SendConfirmModel @Inject constructor(
private fun updateAmountSubtractAvailability() {
modelScope.launch {
val isGaslessEthTx =
feeUMV2?.feeExtraInfo?.transactionFeeExtended?.transactionFee?.normal is Fee.Ethereum.TokenCurrency
isAmountSubtractAvailable =
isAmountSubtractAvailableUseCase(
userWalletId = userWallet.walletId,
currency = cryptoCurrency,
isGaslessEthTx = isGaslessEthTx,
).getOrElse { false }
val fee = feeUMV2?.feeExtraInfo?.transactionFeeExtended?.transactionFee?.normal
// we assume if feeExtraInfo is empty then pay fee in the main currency
val feeTokenId = feeUMV2?.feeExtraInfo?.transactionFeeExtended?.feeTokenId ?: cryptoCurrency.id
isAmountSubtractAvailable = isAmountSubtractAvailableUseCase(
userWalletId = userWallet.walletId,
currency = cryptoCurrency,
maybeGaslessFee = fee?.let { feeTokenId to fee },
).getOrElse { false }
}
}

View file

@ -106,10 +106,12 @@ internal class NotificationsModel @Inject constructor(
}
private suspend fun checkIfSubtractAvailable() {
val feeCurrencyId = notificationData.feeCryptoCurrencyStatus.currency.id
val fee = notificationData.fee
isAmountSubtractAvailable = isAmountSubtractAvailableUseCase(
userWalletId = userWalletId,
currency = currency,
isGaslessEthTx = notificationData.fee is Fee.Ethereum.TokenCurrency,
maybeGaslessFee = fee?.let { feeCurrencyId to fee },
).getOrElse { false }
}

View file

@ -1439,8 +1439,10 @@ internal class StakingModel @Inject constructor(
}
private suspend fun checkIfSubtractAvailable() {
isAmountSubtractAvailable = isAmountSubtractAvailableUseCase(userWalletId, cryptoCurrencyStatus.currency)
.getOrElse { false }
isAmountSubtractAvailable = isAmountSubtractAvailableUseCase(
userWalletId = userWalletId,
currency = cryptoCurrencyStatus.currency,
).getOrElse { false }
}
private fun isTopHeatupCase(): Boolean {

View file

@ -3,7 +3,6 @@ package com.tangem.features.swap.v2.impl.sendviaswap.confirm.model
import arrow.core.Either
import arrow.core.getOrElse
import arrow.core.left
import com.tangem.blockchain.common.transaction.Fee
import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.common.routing.AppRouter
import com.tangem.common.ui.amountScreen.converters.AmountReduceByTransformer
@ -349,13 +348,14 @@ internal class SendWithSwapConfirmModel @Inject constructor(
private fun updateAmountSubtractAvailability() {
modelScope.launch {
val isGaslessEthTx =
feeUMV2?.feeExtraInfo?.transactionFeeExtended?.transactionFee?.normal is Fee.Ethereum.TokenCurrency
val fee = feeUMV2?.feeExtraInfo?.transactionFeeExtended?.transactionFee?.normal
val feeTokenId =
feeUMV2?.feeExtraInfo?.transactionFeeExtended?.feeTokenId ?: primaryCurrencyStatus.currency.id
isAmountSubtractAvailable =
isAmountSubtractAvailableUseCase(
userWalletId = params.userWallet.walletId,
currency = primaryCurrencyStatus.currency,
isGaslessEthTx = isGaslessEthTx,
maybeGaslessFee = fee?.let { feeTokenId to fee },
).getOrElse { false }
}
}