Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-20 17:24:44 +05:00
parent af7f6547db
commit 305e86960f
4 changed files with 30 additions and 10 deletions

View file

@ -381,7 +381,11 @@ sealed class NotificationUM(val config: NotificationConfig) {
title = TextReference.Res(R.string.send_notification_invalid_amount_title),
subtitle = TextReference.Res(
id = R.string.send_notification_invalid_amount_rent_fee,
formatArgs = wrappedList(rentInfo.exemptionAmount),
formatArgs = wrappedList(
rentInfo.exemptionAmount.format {
crypto(rentInfo.cryptoCurrency)
},
),
),
)

View file

@ -1,11 +1,7 @@
package com.tangem.data.tokens.repository
import com.tangem.blockchain.blockchains.polkadot.ExistentialDepositProvider
import com.tangem.blockchain.common.FeeResourceAmountProvider
import com.tangem.blockchain.common.MinimumSendAmountProvider
import com.tangem.blockchain.common.ReserveAmountProvider
import com.tangem.blockchain.common.Token
import com.tangem.blockchain.common.UtxoAmountLimitProvider
import com.tangem.blockchain.common.*
import com.tangem.blockchainsdk.utils.toBlockchain
import com.tangem.data.tokens.converters.UtxoConverter
import com.tangem.domain.models.currency.CryptoCurrency
@ -144,7 +140,11 @@ internal class DefaultCurrencyChecksRepository(
return when {
balanceValue.amount.isZero() && stakingTotalBalance.isZero() -> null
balanceValue.amount < rentData.exemptionAmount && stakingTotalBalance.isZero() -> {
CryptoCurrencyWarning.Rent(rentData.rent, rentData.exemptionAmount)
CryptoCurrencyWarning.Rent(
rent = rentData.rent,
exemptionAmount = rentData.exemptionAmount,
cryptoCurrency = currencyStatus.currency,
)
}
else -> null
}
@ -159,7 +159,11 @@ internal class DefaultCurrencyChecksRepository(
return when {
balanceAfterTransaction.isZero() -> null
balanceAfterTransaction < rentData.exemptionAmount -> {
CryptoCurrencyWarning.Rent(rentData.rent, rentData.exemptionAmount)
CryptoCurrencyWarning.Rent(
rent = rentData.rent,
exemptionAmount = rentData.exemptionAmount,
cryptoCurrency = currencyStatus.currency,
)
}
else -> null
}

View file

@ -39,8 +39,13 @@ sealed class CryptoCurrencyWarning {
* @param rent Amount that will be charged in overtime if the blockchain does not have an amount greater than
* the [exemptionAmount]
* @param exemptionAmount Amount that should be on the blockchain balance not to pay rent
* @param cryptoCurrency Currency in which the rent is charged
*/
data class Rent(val rent: BigDecimal, val exemptionAmount: BigDecimal) : CryptoCurrencyWarning()
data class Rent(
val rent: BigDecimal,
val exemptionAmount: BigDecimal,
val cryptoCurrency: CryptoCurrency,
) : CryptoCurrencyWarning()
data class SwapPromo(
val promoId: PromoId,

View file

@ -7,6 +7,8 @@ import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.networkIconResId
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.core.ui.format.bigdecimal.crypto
import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning
@ -136,7 +138,12 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) {
title = TextReference.Res(R.string.warning_rent_fee_title),
subtitle = TextReference.Res(
id = R.string.warning_solana_rent_fee_message,
formatArgs = wrappedList(rentInfo.rent, rentInfo.exemptionAmount),
formatArgs = wrappedList(
rentInfo.rent,
rentInfo.exemptionAmount.format {
crypto(rentInfo.cryptoCurrency)
},
),
),
onCloseClick = onCloseClick,
)