Updated on 2026-08-14

This commit is contained in:
Tangem 2024-08-08 18:53:25 +03:00
parent 700731a408
commit c500f45307
59 changed files with 1338 additions and 278 deletions

View file

@ -18,4 +18,5 @@ dependencies {
implementation(deps.kotlin.serialization)
implementation(projects.domain.tokens.models)
implementation(projects.core.utils)
}

View file

@ -11,29 +11,29 @@ data class TokenMarketInfo(
val networks: List<Network>?,
val shortDescription: String?,
val fullDescription: String?,
val insights: List<Insight>?,
val insights: Insights?,
val metrics: Metrics?,
val links: Links?,
val pricePerformance: PricePerformance?,
) {
data class PriceChangePercentage(
val day: Int?,
val week: Int?,
val month: Int?,
val threeMonths: Int?,
val sixMonths: Int?,
val year: Int?,
val allTime: Int?,
val day: BigDecimal?,
val week: BigDecimal?,
val month: BigDecimal?,
val threeMonths: BigDecimal?,
val sixMonths: BigDecimal?,
val year: BigDecimal?,
val allTime: BigDecimal?,
)
data class Network(
val networkId: String,
val exchangeable: Boolean,
val contractAddress: String,
val decimalCount: Int,
val contractAddress: String?,
val decimalCount: Int?,
)
data class Insight(
data class Insights(
val holdersChange: Change?,
val liquidityChange: Change?,
val buyPressureChange: Change?,
@ -41,9 +41,9 @@ data class TokenMarketInfo(
)
data class Change(
val day: Int?,
val week: Int?,
val month: Int?,
val day: BigDecimal?,
val week: BigDecimal?,
val month: BigDecimal?,
)
data class Metrics(
@ -75,7 +75,7 @@ data class TokenMarketInfo(
)
data class Range(
val low: Int?,
val high: Int?,
val low: BigDecimal?,
val high: BigDecimal?,
)
}

View file

@ -3,6 +3,7 @@ package com.tangem.domain.markets
import arrow.core.Either
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.markets.repositories.MarketsTokenRepository
import com.tangem.utils.SupportedLanguages
class GetTokenMarketInfoUseCase(
private val marketsTokenRepository: MarketsTokenRepository,
@ -13,6 +14,7 @@ class GetTokenMarketInfoUseCase(
marketsTokenRepository.getTokenInfo(
fiatCurrencyCode = appCurrency.code,
tokenId = tokenId,
languageCode = SupportedLanguages.getCurrentSupportedLanguageCode(),
)
}.mapLeft {}
}

View file

@ -12,5 +12,5 @@ interface MarketsTokenRepository {
suspend fun getChart(fiatCurrencyCode: String, interval: PriceChangeInterval, tokenId: String): TokenChart
suspend fun getTokenInfo(fiatCurrencyCode: String, tokenId: String): TokenMarketInfo
suspend fun getTokenInfo(fiatCurrencyCode: String, tokenId: String, languageCode: String): TokenMarketInfo
}