Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-31 14:51:06 +04:00
parent 737db57d0e
commit c976a39980
6 changed files with 27 additions and 20 deletions

View file

@ -10,8 +10,9 @@ data class YieldSupplyMarketTokenDto(
@Json(name = "tokenSymbol") val tokenSymbol: String? = null,
@Json(name = "tokenName") val tokenName: String? = null,
@Json(name = "apy") val apy: BigDecimal? = null,
@Json(name = "decimals") val decimals: Int? = null,
@Json(name = "isActive") val isActive: Boolean? = null,
@Json(name = "chainId") val chainId: Int? = null,
@Json(name = "maxFeeNative") val maxFeeNative: String? = null,
@Json(name = "maxFeeUSD") val maxFeeUSD: String? = null,
@Json(name = "maxFeeNative") val maxFeeNative: BigDecimal? = null,
@Json(name = "maxFeeUSD") val maxFeeUSD: BigDecimal? = null,
)

View file

@ -12,8 +12,8 @@ internal object YieldMarketTokenConverter : Converter<YieldSupplyMarketTokenDto,
apy = value.apy.orZero(),
isActive = value.isActive ?: false,
chainId = value.chainId ?: -1,
maxFeeUSD = value.maxFeeUSD.orEmpty(),
maxFeeNative = value.maxFeeNative.orEmpty(),
maxFeeUSD = value.maxFeeUSD.orZero(),
maxFeeNative = value.maxFeeNative.orZero(),
)
}
}

View file

@ -12,8 +12,8 @@ data class YieldMarketToken(
val chainId: Int,
val apy: SerializedBigDecimal,
val isActive: Boolean,
val maxFeeNative: String,
val maxFeeUSD: String,
val maxFeeNative: SerializedBigDecimal,
val maxFeeUSD: SerializedBigDecimal,
val backendId: String? = null,
) {

View file

@ -55,7 +55,7 @@ class YieldSupplyGetMaxFeeUseCase(
val cachedMarketToken = yieldSupplyRepository.getCachedMarkets().orEmpty()
.firstOrNull { it.yieldSupplyKey == token.yieldSupplyKey() }
val marketToken = cachedMarketToken ?: yieldSupplyRepository.getTokenStatus(token)
val maxFeeNative = marketToken.maxFeeNative.toBigDecimal()
val maxFeeNative = marketToken.maxFeeNative
val rateRatio = nativeFiatRate.divide(
fiatRate,

View file

@ -40,6 +40,7 @@ import com.tangem.utils.StringsSigns
internal fun YieldSupplyBlockContent(yieldSupplyUM: YieldSupplyUM, modifier: Modifier = Modifier) {
AnimatedContent(
targetState = yieldSupplyUM,
contentKey = { it::class },
) { supplyUM ->
when (supplyUM) {
is YieldSupplyUM.Available -> SupplyAvailable(supplyUM, modifier)
@ -118,6 +119,10 @@ private fun SupplyContent(supplyUM: YieldSupplyUM.Content, modifier: Modifier =
style = TangemTheme.typography.subtitle1,
color = TangemTheme.colors.text.primary1,
)
AnimatedVisibility(supplyUM.rewardsApy != TextReference.EMPTY) {
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
Text(
text = StringsSigns.DOT,
style = TangemTheme.typography.subtitle1,
@ -130,6 +135,8 @@ private fun SupplyContent(supplyUM: YieldSupplyUM.Content, modifier: Modifier =
color = TangemTheme.colors.text.accent,
)
}
}
}
Text(
text = supplyUM.subtitle.resolveReference(),
style = TangemTheme.typography.caption2,

View file

@ -11,7 +11,6 @@ import com.tangem.core.decompose.model.ParamsContainer
import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.core.ui.utils.parseToBigDecimal
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.models.currency.CryptoCurrency
@ -136,7 +135,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor(
if (uiState.value.maxFee != BigDecimal.ZERO) return uiState.value.maxFee
val yieldTokenStatus = yieldSupplyGetTokenStatusUseCase(cryptoCurrency as CryptoCurrency.Token)
.getOrNull()
return yieldTokenStatus?.maxFeeNative?.parseToBigDecimal(cryptoCurrency.decimals)
return yieldTokenStatus?.maxFeeNative
}
private suspend fun onLoadFee() {