Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-27 10:07:06 +03:00
commit 0cc3e8e4e4
13 changed files with 74 additions and 48 deletions

View file

@ -9,6 +9,7 @@ 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.core.ui.format.bigdecimal.shorted
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning
import java.math.BigDecimal
@ -399,11 +400,16 @@ sealed class NotificationUM(val config: NotificationConfig) {
data class RentExemptionDestination(
private val rentExemptionAmount: BigDecimal,
private val cryptoCurrency: CryptoCurrency,
) : Error(
title = TextReference.Res(R.string.send_notification_invalid_amount_title),
subtitle = TextReference.Res(
id = R.string.send_notification_invalid_amount_rent_destination,
formatArgs = wrappedList(rentExemptionAmount),
formatArgs = wrappedList(
rentExemptionAmount.format {
crypto(cryptoCurrency)
},
),
),
)
}

View file

@ -368,6 +368,7 @@ object NotificationsFactory {
is BlockchainSdkError.DestinationTagRequired -> addRequireDestinationTagErrorNotification()
is BlockchainSdkError.Solana.DestinationRentExemption -> addRentExemptionDestinationNotification(
rentExemptionAmount = validationError.rentAmount,
cryptoCurrency = cryptoCurrency,
)
is BlockchainSdkError.TransactionDustChangeError -> add(
NotificationUM.Error.MinimumAmountError(
@ -462,10 +463,14 @@ object NotificationsFactory {
add(NotificationUM.Solana.RentInfo(rentWarning))
}
fun MutableList<NotificationUM>.addRentExemptionDestinationNotification(rentExemptionAmount: BigDecimal) {
private fun MutableList<NotificationUM>.addRentExemptionDestinationNotification(
rentExemptionAmount: BigDecimal,
cryptoCurrency: CryptoCurrency,
) {
add(
NotificationUM.Solana.RentExemptionDestination(
rentExemptionAmount = rentExemptionAmount,
cryptoCurrency = cryptoCurrency,
),
)
}

View file

@ -22,6 +22,7 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.currency.yieldSupplyKey
import com.tangem.domain.models.staking.YieldBalance
import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance
import com.tangem.lib.crypto.BlockchainUtils
import com.tangem.utils.StringsSigns.DASH_SIGN
import com.tangem.utils.converter.Converter
import com.tangem.utils.extensions.orZero
@ -185,6 +186,7 @@ class TokenItemStateConverter(
}
}
// polygon-pos_0xc2132d05d31c914a87c6611c10748aeb04b58e8f
private fun resolveEarnApy(
cryptoCurrencyStatus: CryptoCurrencyStatus,
yieldModuleApyMap: Map<String, String>,
@ -192,7 +194,12 @@ class TokenItemStateConverter(
): Pair<TextReference?, Boolean> {
val token = cryptoCurrencyStatus.currency as? CryptoCurrency.Token
if (token != null && yieldModuleApyMap.isNotEmpty()) {
val yieldSupplyApy = yieldModuleApyMap[token.yieldSupplyKey()]
val yieldSupplyApy = yieldModuleApyMap.entries.firstOrNull {
it.key.equals(
other = token.yieldSupplyKey(),
ignoreCase = BlockchainUtils.isCaseInsensitiveContractAddress(token.network.rawId),
)
}?.value
if (yieldSupplyApy != null) {
val isActive = cryptoCurrencyStatus.value.yieldSupplyStatus?.isActive ?: false
return resourceReference(