Updated on 2026-08-14
This commit is contained in:
parent
035a094201
commit
24d163b5e7
5 changed files with 37 additions and 4 deletions
|
|
@ -13,6 +13,8 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
/** Libs */
|
||||
implementation(projects.libs.crypto)
|
||||
|
||||
/** Project - Domain */
|
||||
implementation(projects.domain.account)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.tangem.domain.models.network.Network
|
|||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.wallets.derivations.DerivationStyleProvider
|
||||
import com.tangem.domain.wallets.derivations.derivationStyleProvider
|
||||
import com.tangem.lib.crypto.BlockchainUtils
|
||||
import timber.log.Timber
|
||||
|
||||
internal class ManagedCryptoCurrencyFactory(
|
||||
|
|
@ -183,6 +184,7 @@ internal class ManagedCryptoCurrencyFactory(
|
|||
|
||||
val availableNetworks = coinResponse.networks
|
||||
.applyL2Compatibility(coinResponse.id)
|
||||
.filterTerraTokens(coinResponse.id)
|
||||
.mapNotNull { network ->
|
||||
createSource(
|
||||
networkId = network.networkId,
|
||||
|
|
@ -300,6 +302,14 @@ internal class ManagedCryptoCurrencyFactory(
|
|||
derivationStyleProvider: DerivationStyleProvider,
|
||||
): Boolean = derivationPath != blockchain.derivationPath(derivationStyleProvider.getDerivationStyle())?.rawPath
|
||||
|
||||
/**
|
||||
* Filter tokens for TerraV1 (Terra Classic) network.
|
||||
* Only native coin (LUNC) and TerraClassicUSD (USTC) are allowed.
|
||||
*/
|
||||
private fun List<CoinsResponse.Coin.Network>.filterTerraTokens(coinId: String): List<CoinsResponse.Coin.Network> {
|
||||
return filter { network -> BlockchainUtils.isNotBlockedByTerraV1Filter(network.networkId, coinId) }
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val DEFAULT_IMAGE_HOST = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins/"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
/** Libs */
|
||||
implementation(projects.libs.crypto)
|
||||
|
||||
implementation(projects.core.datasource)
|
||||
implementation(projects.core.utils)
|
||||
implementation(projects.core.pagination)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.tangem.datasource.api.markets.models.response.TokenMarketInfoResponse
|
|||
import com.tangem.domain.markets.BuildConfig
|
||||
import com.tangem.domain.markets.TokenMarketInfo
|
||||
import com.tangem.domain.markets.TokenQuotes
|
||||
import com.tangem.lib.crypto.BlockchainUtils
|
||||
import com.tangem.utils.converter.Converter
|
||||
import java.math.BigDecimal
|
||||
|
||||
|
|
@ -22,7 +23,7 @@ internal class TokenMarketInfoConverter(
|
|||
name = name,
|
||||
symbol = symbol,
|
||||
quotes = getQuotes(),
|
||||
networks = networks?.convert(),
|
||||
networks = networks?.convert(coinId = id),
|
||||
shortDescription = shortDescription,
|
||||
fullDescription = fullDescription,
|
||||
insights = insights?.convert(),
|
||||
|
|
@ -55,7 +56,7 @@ internal class TokenMarketInfoConverter(
|
|||
}
|
||||
|
||||
@JvmName("convertNetwork")
|
||||
private fun List<TokenMarketInfoResponse.Network>.convert(): List<TokenMarketInfo.Network> {
|
||||
private fun List<TokenMarketInfoResponse.Network>.convert(coinId: String): List<TokenMarketInfo.Network> {
|
||||
return mapNotNull { network ->
|
||||
val blockchain = Blockchain.fromNetworkId(network.networkId)
|
||||
when {
|
||||
|
|
@ -68,7 +69,8 @@ internal class TokenMarketInfoConverter(
|
|||
)
|
||||
}
|
||||
blockchain != null && blockchain !in excludedBlockchains &&
|
||||
blockchain.canHandleTokens() -> {
|
||||
blockchain.canHandleTokens() &&
|
||||
BlockchainUtils.isNotBlockedByTerraV1Filter(network.networkId, coinId) -> {
|
||||
TokenMarketInfo.Network(
|
||||
networkId = network.networkId,
|
||||
isExchangeable = network.exchangeable,
|
||||
|
|
@ -195,7 +197,6 @@ internal class TokenMarketInfoConverter(
|
|||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
const val PROD_IMAGE_HOST = "https://s3.eu-central-1.amazonaws.com/tangem.api/security_provider/"
|
||||
const val DEV_IMAGE_HOST = "https://s3.eu-central-1.amazonaws.com/tangem.api.dev/security_provider/"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue