Updated on 2026-08-14
This commit is contained in:
parent
737db57d0e
commit
c976a39980
6 changed files with 27 additions and 20 deletions
|
|
@ -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,
|
||||
)
|
||||
|
|
@ -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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
) {
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue