Updated on 2026-08-14
This commit is contained in:
parent
d5d9c7bd2d
commit
f69235c0d7
85 changed files with 564 additions and 762 deletions
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>BooleanPropertyNaming:DefaultMarketsTokenRepository.kt$DefaultMarketsTokenRepository.<no name provided>$val last = res.tokens.size < request.limit</ID>
|
||||
<ID>MultilineLambdaItParameter:DefaultMarketsTokenRepository.kt$DefaultMarketsTokenRepository${ val error = it as QuotesFetcher.Error.ApiOperationError val errorEvent = createDetailsErrorEvent( error = error.apiError, request = MarketsDataAnalyticsEvent.Details.Error.Request.Info, tokenSymbol = tokenSymbol, ) analyticsEventHandler.send(errorEvent.toEvent()) throw error.apiError }</ID>
|
||||
<ID>MultilineLambdaItParameter:MarketsBatchUpdateFetcher.kt$MarketsBatchUpdateFetcher${ it.copy( tokenCharts = TokenMarketChartsConverter.convert( chartsToCopy = it.tokenCharts, tokenId = it.id, interval = updateRequest.interval, value = update, ), ) }</ID>
|
||||
<ID>MultilineLambdaItParameter:MarketsBatchUpdateFetcher.kt$MarketsBatchUpdateFetcher${ val exception = if (it is QuotesFetcher.Error.ApiOperationError) { onApiResponseError(it.apiError) it.apiError } else { error("Cause: $it") } throw exception }</ID>
|
||||
<ID>MultilineLambdaItParameter:TokenMarketInfoConverter.kt$TokenMarketInfoConverter${ TokenMarketInfo.Link( title = it.title, id = it.id, link = it.link, ) }</ID>
|
||||
<ID>NullableBooleanCheck:TokenMarketListConverter.kt$TokenMarketListConverter$token.isUnderMarketCapLimit ?: false</ID>
|
||||
<ID>SuspendFunWithFlowReturnType:DefaultMarketsTokenRepository.kt$DefaultMarketsTokenRepository$suspend</ID>
|
||||
<ID>UnsafeCallOnNullableType:DefaultMarketsTokenRepository.kt$DefaultMarketsTokenRepository$network.contractAddress!!</ID>
|
||||
<ID>UseEmptyCounterpart:MarketsDataAnalyticsEvent.kt$MarketsDataAnalyticsEvent.Details$mapOf()</ID>
|
||||
<ID>UseEmptyCounterpart:MarketsDataAnalyticsEvent.kt$MarketsDataAnalyticsEvent.List$mapOf()</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
@ -90,13 +90,13 @@ internal class DefaultMarketsTokenRepository(
|
|||
requestTimeStamp.set(res.timestamp ?: 0)
|
||||
}
|
||||
|
||||
val last = res.tokens.size < request.limit
|
||||
val isLast = res.tokens.size < request.limit
|
||||
|
||||
val tokenMarketListWithMaxApy = TokenMarketListConverter.convert(res)
|
||||
|
||||
return BatchFetchResult.Success(
|
||||
data = tokenMarketListWithMaxApy.tokens,
|
||||
last = last,
|
||||
last = isLast,
|
||||
empty = res.tokens.isEmpty(),
|
||||
)
|
||||
}
|
||||
|
|
@ -227,8 +227,8 @@ internal class DefaultMarketsTokenRepository(
|
|||
currencyId = tokenId.value,
|
||||
field = QuotesFetcher.Field.ALL_PRICES,
|
||||
)
|
||||
.getOrElse {
|
||||
val error = it as QuotesFetcher.Error.ApiOperationError
|
||||
.getOrElse { fetchError ->
|
||||
val error = fetchError as QuotesFetcher.Error.ApiOperationError
|
||||
|
||||
val errorEvent = createDetailsErrorEvent(
|
||||
error = error.apiError,
|
||||
|
|
@ -274,7 +274,7 @@ internal class DefaultMarketsTokenRepository(
|
|||
name = token.name,
|
||||
symbol = token.symbol,
|
||||
decimals = network.decimalCount ?: error("Unknown decimal"),
|
||||
contractAddress = network.contractAddress!!,
|
||||
contractAddress = requireNotNull(network.contractAddress) { "Contract address is required for token" },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,13 +79,13 @@ internal class MarketsBatchUpdateFetcher(
|
|||
currenciesIds = currenciesIds,
|
||||
fields = setOf(QuotesFetcher.Field.ALL_PRICES),
|
||||
)
|
||||
.getOrElse {
|
||||
val exception = if (it is QuotesFetcher.Error.ApiOperationError) {
|
||||
onApiResponseError(it.apiError)
|
||||
.getOrElse { error ->
|
||||
val exception = if (error is QuotesFetcher.Error.ApiOperationError) {
|
||||
onApiResponseError(error.apiError)
|
||||
|
||||
it.apiError
|
||||
error.apiError
|
||||
} else {
|
||||
error("Cause: $it")
|
||||
error("Cause: $error")
|
||||
}
|
||||
|
||||
throw exception
|
||||
|
|
@ -116,11 +116,11 @@ internal class MarketsBatchUpdateFetcher(
|
|||
|
||||
Batch(
|
||||
key = batchToUpdate.key,
|
||||
data = batchToUpdate.data.map {
|
||||
it.copy(
|
||||
data = batchToUpdate.data.map { tokenMarket ->
|
||||
tokenMarket.copy(
|
||||
tokenCharts = TokenMarketChartsConverter.convert(
|
||||
chartsToCopy = it.tokenCharts,
|
||||
tokenId = it.id,
|
||||
chartsToCopy = tokenMarket.tokenCharts,
|
||||
tokenId = tokenMarket.id,
|
||||
interval = updateRequest.interval,
|
||||
value = update,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ sealed interface MarketsDataAnalyticsEvent {
|
|||
|
||||
sealed class List(
|
||||
event: String,
|
||||
params: Map<String, String> = mapOf(),
|
||||
params: Map<String, String> = emptyMap(),
|
||||
) : AnalyticsEvent(category = "Markets", event = event, params = params), MarketsDataAnalyticsEvent {
|
||||
|
||||
data class Error(
|
||||
|
|
@ -26,7 +26,7 @@ sealed interface MarketsDataAnalyticsEvent {
|
|||
|
||||
sealed class Details(
|
||||
event: String,
|
||||
params: Map<String, String> = mapOf(),
|
||||
params: Map<String, String> = emptyMap(),
|
||||
) : AnalyticsEvent(category = "Markets / Chart", event = event, params = params), MarketsDataAnalyticsEvent {
|
||||
|
||||
data class Error(
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ internal class TokenMarketInfoConverter(
|
|||
network.contractAddress.isNullOrEmpty() -> {
|
||||
TokenMarketInfo.Network(
|
||||
networkId = network.networkId,
|
||||
exchangeable = network.exchangeable,
|
||||
isExchangeable = network.exchangeable,
|
||||
contractAddress = network.contractAddress,
|
||||
decimalCount = network.decimalCount,
|
||||
)
|
||||
|
|
@ -71,7 +71,7 @@ internal class TokenMarketInfoConverter(
|
|||
blockchain.canHandleTokens() -> {
|
||||
TokenMarketInfo.Network(
|
||||
networkId = network.networkId,
|
||||
exchangeable = network.exchangeable,
|
||||
isExchangeable = network.exchangeable,
|
||||
contractAddress = blockchain.reformatContractAddress(network.contractAddress),
|
||||
decimalCount = network.decimalCount,
|
||||
)
|
||||
|
|
@ -147,11 +147,11 @@ internal class TokenMarketInfoConverter(
|
|||
|
||||
@JvmName("convertLink")
|
||||
private fun List<TokenMarketInfoResponse.Link>.convert(): List<TokenMarketInfo.Link> {
|
||||
return map {
|
||||
return map { link ->
|
||||
TokenMarketInfo.Link(
|
||||
title = it.title,
|
||||
id = it.id,
|
||||
link = it.link,
|
||||
title = link.title,
|
||||
id = link.id,
|
||||
link = link.link,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ internal object TokenMarketListConverter : Converter<TokenMarketListResponse, To
|
|||
symbol = token.symbol,
|
||||
marketRating = token.marketRating,
|
||||
marketCap = token.marketCap,
|
||||
isUnderMarketCapLimit = token.isUnderMarketCapLimit ?: false,
|
||||
isUnderMarketCapLimit = token.isUnderMarketCapLimit == true,
|
||||
imageHost = imageHost,
|
||||
tokenQuotesShort = TokenQuotesShort(
|
||||
currentPrice = token.currentPrice,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue