Updated on 2026-08-14
This commit is contained in:
parent
16e32259c6
commit
27ae1ee2a0
6 changed files with 72 additions and 69 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package com.tangem.data.managetokens.utils
|
||||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.compatibility.applyL2Compatibility
|
||||
import com.tangem.blockchainsdk.compatibility.getL2CompatibilityTokenComparison
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.blockchainsdk.utils.isSupportedInApp
|
||||
import com.tangem.blockchainsdk.utils.toCoinId
|
||||
|
|
@ -90,12 +92,13 @@ internal class ManagedCryptoCurrencyFactory {
|
|||
): ManagedCryptoCurrency? {
|
||||
if (coinResponse.networks.isEmpty() || !coinResponse.active) return null
|
||||
|
||||
val updatedNetworks = coinResponse.networks.applyL2Compatibility(coinResponse.id)
|
||||
return ManagedCryptoCurrency.Token(
|
||||
id = ManagedCryptoCurrency.ID(coinResponse.id),
|
||||
name = coinResponse.name,
|
||||
symbol = coinResponse.symbol,
|
||||
iconUrl = getIconUrl(coinResponse.id, imageHost),
|
||||
availableNetworks = coinResponse.networks.mapNotNull { network ->
|
||||
availableNetworks = updatedNetworks.mapNotNull { network ->
|
||||
createSource(network, derivationStyleProvider)
|
||||
},
|
||||
addedIn = findAddedInNetworks(coinResponse.id, tokensResponse, derivationStyleProvider),
|
||||
|
|
@ -136,7 +139,7 @@ internal class ManagedCryptoCurrencyFactory {
|
|||
if (tokensResponse == null) return emptySet()
|
||||
|
||||
return tokensResponse.tokens
|
||||
.filter { it.id == currencyId }
|
||||
.filter { getL2CompatibilityTokenComparison(it, currencyId) }
|
||||
.mapNotNullTo(mutableSetOf()) { token ->
|
||||
val blockchain = Blockchain.fromNetworkId(token.networkId)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.data.markets
|
||||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.compatibility.applyL2Compatibility
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.data.common.currency.CryptoCurrencyFactory
|
||||
import com.tangem.data.common.currency.getNetwork
|
||||
|
|
@ -144,7 +145,8 @@ internal class DefaultMarketsTokenRepository(
|
|||
language = languageCode,
|
||||
)
|
||||
|
||||
return TokenMarketInfoConverter.convert(response.getOrThrow())
|
||||
val resultResponse = response.getOrThrow().applyL2Compatibility(tokenId)
|
||||
return TokenMarketInfoConverter.convert(resultResponse)
|
||||
}
|
||||
|
||||
override suspend fun getTokenQuotes(fiatCurrencyCode: String, tokenId: String): TokenQuotes {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.data.tokens.repository
|
|||
|
||||
import arrow.core.raise.catch
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.compatibility.getL2CompatibilityTokenComparison
|
||||
import com.tangem.blockchainsdk.utils.toCoinId
|
||||
import com.tangem.blockchainsdk.utils.toNetworkId
|
||||
import com.tangem.data.common.api.safeApiCall
|
||||
|
|
@ -488,7 +489,9 @@ internal class DefaultCurrenciesRepository(
|
|||
.map { userWallet ->
|
||||
if (userWallet.isMultiCurrency) {
|
||||
getSavedUserTokensResponse(userWallet.walletId).map { storedTokens ->
|
||||
val filterResponse = storedTokens.tokens.filter { it.id == currencyRawId }
|
||||
val filterResponse = storedTokens.tokens.filter {
|
||||
getL2CompatibilityTokenComparison(it, currencyRawId)
|
||||
}
|
||||
|
||||
responseCurrenciesFactory.createCurrencies(
|
||||
response = storedTokens.copy(tokens = filterResponse),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue