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 = "tokenSymbol") val tokenSymbol: String? = null,
|
||||||
@Json(name = "tokenName") val tokenName: String? = null,
|
@Json(name = "tokenName") val tokenName: String? = null,
|
||||||
@Json(name = "apy") val apy: BigDecimal? = null,
|
@Json(name = "apy") val apy: BigDecimal? = null,
|
||||||
|
@Json(name = "decimals") val decimals: Int? = null,
|
||||||
@Json(name = "isActive") val isActive: Boolean? = null,
|
@Json(name = "isActive") val isActive: Boolean? = null,
|
||||||
@Json(name = "chainId") val chainId: Int? = null,
|
@Json(name = "chainId") val chainId: Int? = null,
|
||||||
@Json(name = "maxFeeNative") val maxFeeNative: String? = null,
|
@Json(name = "maxFeeNative") val maxFeeNative: BigDecimal? = null,
|
||||||
@Json(name = "maxFeeUSD") val maxFeeUSD: String? = null,
|
@Json(name = "maxFeeUSD") val maxFeeUSD: BigDecimal? = null,
|
||||||
)
|
)
|
||||||
|
|
@ -12,8 +12,8 @@ internal object YieldMarketTokenConverter : Converter<YieldSupplyMarketTokenDto,
|
||||||
apy = value.apy.orZero(),
|
apy = value.apy.orZero(),
|
||||||
isActive = value.isActive ?: false,
|
isActive = value.isActive ?: false,
|
||||||
chainId = value.chainId ?: -1,
|
chainId = value.chainId ?: -1,
|
||||||
maxFeeUSD = value.maxFeeUSD.orEmpty(),
|
maxFeeUSD = value.maxFeeUSD.orZero(),
|
||||||
maxFeeNative = value.maxFeeNative.orEmpty(),
|
maxFeeNative = value.maxFeeNative.orZero(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,8 +12,8 @@ data class YieldMarketToken(
|
||||||
val chainId: Int,
|
val chainId: Int,
|
||||||
val apy: SerializedBigDecimal,
|
val apy: SerializedBigDecimal,
|
||||||
val isActive: Boolean,
|
val isActive: Boolean,
|
||||||
val maxFeeNative: String,
|
val maxFeeNative: SerializedBigDecimal,
|
||||||
val maxFeeUSD: String,
|
val maxFeeUSD: SerializedBigDecimal,
|
||||||
val backendId: String? = null,
|
val backendId: String? = null,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class YieldSupplyGetMaxFeeUseCase(
|
||||||
val cachedMarketToken = yieldSupplyRepository.getCachedMarkets().orEmpty()
|
val cachedMarketToken = yieldSupplyRepository.getCachedMarkets().orEmpty()
|
||||||
.firstOrNull { it.yieldSupplyKey == token.yieldSupplyKey() }
|
.firstOrNull { it.yieldSupplyKey == token.yieldSupplyKey() }
|
||||||
val marketToken = cachedMarketToken ?: yieldSupplyRepository.getTokenStatus(token)
|
val marketToken = cachedMarketToken ?: yieldSupplyRepository.getTokenStatus(token)
|
||||||
val maxFeeNative = marketToken.maxFeeNative.toBigDecimal()
|
val maxFeeNative = marketToken.maxFeeNative
|
||||||
|
|
||||||
val rateRatio = nativeFiatRate.divide(
|
val rateRatio = nativeFiatRate.divide(
|
||||||
fiatRate,
|
fiatRate,
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ import com.tangem.utils.StringsSigns
|
||||||
internal fun YieldSupplyBlockContent(yieldSupplyUM: YieldSupplyUM, modifier: Modifier = Modifier) {
|
internal fun YieldSupplyBlockContent(yieldSupplyUM: YieldSupplyUM, modifier: Modifier = Modifier) {
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
targetState = yieldSupplyUM,
|
targetState = yieldSupplyUM,
|
||||||
|
contentKey = { it::class },
|
||||||
) { supplyUM ->
|
) { supplyUM ->
|
||||||
when (supplyUM) {
|
when (supplyUM) {
|
||||||
is YieldSupplyUM.Available -> SupplyAvailable(supplyUM, modifier)
|
is YieldSupplyUM.Available -> SupplyAvailable(supplyUM, modifier)
|
||||||
|
|
@ -118,17 +119,23 @@ private fun SupplyContent(supplyUM: YieldSupplyUM.Content, modifier: Modifier =
|
||||||
style = TangemTheme.typography.subtitle1,
|
style = TangemTheme.typography.subtitle1,
|
||||||
color = TangemTheme.colors.text.primary1,
|
color = TangemTheme.colors.text.primary1,
|
||||||
)
|
)
|
||||||
Text(
|
AnimatedVisibility(supplyUM.rewardsApy != TextReference.EMPTY) {
|
||||||
text = StringsSigns.DOT,
|
Row(
|
||||||
style = TangemTheme.typography.subtitle1,
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
color = TangemTheme.colors.text.tertiary,
|
) {
|
||||||
)
|
Text(
|
||||||
Text(
|
text = StringsSigns.DOT,
|
||||||
text = supplyUM.rewardsApy.resolveReference(),
|
style = TangemTheme.typography.subtitle1,
|
||||||
style = TangemTheme.typography.subtitle1,
|
color = TangemTheme.colors.text.tertiary,
|
||||||
maxLines = 1,
|
)
|
||||||
color = TangemTheme.colors.text.accent,
|
Text(
|
||||||
)
|
text = supplyUM.rewardsApy.resolveReference(),
|
||||||
|
style = TangemTheme.typography.subtitle1,
|
||||||
|
maxLines = 1,
|
||||||
|
color = TangemTheme.colors.text.accent,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = supplyUM.subtitle.resolveReference(),
|
text = supplyUM.subtitle.resolveReference(),
|
||||||
|
|
|
||||||
|
|
@ -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.components.currency.icon.converter.CryptoCurrencyToIconStateConverter
|
||||||
import com.tangem.core.ui.extensions.resourceReference
|
import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.extensions.wrappedList
|
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.GetSelectedAppCurrencyUseCase
|
||||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||||
import com.tangem.domain.models.currency.CryptoCurrency
|
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
|
if (uiState.value.maxFee != BigDecimal.ZERO) return uiState.value.maxFee
|
||||||
val yieldTokenStatus = yieldSupplyGetTokenStatusUseCase(cryptoCurrency as CryptoCurrency.Token)
|
val yieldTokenStatus = yieldSupplyGetTokenStatusUseCase(cryptoCurrency as CryptoCurrency.Token)
|
||||||
.getOrNull()
|
.getOrNull()
|
||||||
return yieldTokenStatus?.maxFeeNative?.parseToBigDecimal(cryptoCurrency.decimals)
|
return yieldTokenStatus?.maxFeeNative
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun onLoadFee() {
|
private suspend fun onLoadFee() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue