Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-26 13:20:41 +03:00
parent 73bf0b7617
commit 128faaec8d
4 changed files with 24 additions and 12 deletions

View file

@ -45,6 +45,14 @@ internal class MarketsPortfolioModel @Inject constructor(
private val params = paramsContainer.require<MarketsPortfolioComponent.Params>()
private val analyticsEventBuilder = PortfolioAnalyticsEvent.EventBuilder(
tokenSymbol = params.token.symbol,
source = params.analyticsParams?.source,
)
private val currentAppCurrency = createAppCurrencyFlow()
private val tokenActionsHandler = createTokenActionsHandler()
val addToPortfolioManager: AddToPortfolioManager = createAddToPortfolioManager()
private val marketsPortfolioDelegate: MarketsPortfolioDelegate = createMarketsPortfolioDelegate()
@ -54,15 +62,6 @@ internal class MarketsPortfolioModel @Inject constructor(
override fun onSuccess(addedToken: CryptoCurrency) = bottomSheetNavigation.dismiss()
}
private val analyticsEventBuilder = PortfolioAnalyticsEvent.EventBuilder(
tokenSymbol = params.token.symbol,
source = params.analyticsParams?.source,
)
private val currentAppCurrency = createAppCurrencyFlow()
private val tokenActionsHandler = createTokenActionsHandler()
init {
marketsPortfolioDelegate.combineData()
.onEach { state.value = it }

View file

@ -725,6 +725,8 @@ internal class AvailableSwapPairsModel @Inject constructor(
val networks = tokenMarket.networks?.filter { network ->
BlockchainUtils.isSupportedNetworkId(
blockchainId = network.networkId,
coinId = tokenMarket.id.value,
contractAddress = network.contractAddress,
excludedBlockchains = excludedBlockchains,
hotExcludedBlockchains = hotWalletExcludedBlockchains,
hasOnlyHotWallets = hasOnlyHotWallets,

View file

@ -2345,6 +2345,8 @@ internal class SwapModel @Inject constructor(
val networks = tokenMarket.networks?.filter { network ->
BlockchainUtils.isSupportedNetworkId(
blockchainId = network.networkId,
coinId = tokenMarket.id.value,
contractAddress = network.contractAddress,
excludedBlockchains = excludedBlockchains,
hotExcludedBlockchains = hotWalletExcludedBlockchains,
hasOnlyHotWallets = hasOnlyHotWallets,

View file

@ -85,11 +85,20 @@ object BlockchainUtils {
excludedBlockchains: ExcludedBlockchains,
hotExcludedBlockchains: Set<Blockchain>,
hasOnlyHotWallets: Boolean = false,
coinId: String? = null,
contractAddress: String? = null,
): Boolean {
val blockchain = Blockchain.fromNetworkId(blockchainId)
val blockchain = Blockchain.fromNetworkId(blockchainId) ?: return false
return blockchain != null && blockchain !in excludedBlockchains &&
(hasOnlyHotWallets.not() || blockchain !in hotExcludedBlockchains)
if (blockchain in excludedBlockchains) return false
if (hasOnlyHotWallets && blockchain in hotExcludedBlockchains) return false
if (!contractAddress.isNullOrEmpty()) {
if (!blockchain.canHandleTokens()) return false
if (coinId != null && !isNotBlockedByTerraV1Filter(blockchainId, coinId)) return false
}
return true
}
fun isArbitrum(blockchainId: String): Boolean {