diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolio/impl/model/MarketsPortfolioModel.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolio/impl/model/MarketsPortfolioModel.kt index 7c7818ad79..0401beb1e7 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolio/impl/model/MarketsPortfolioModel.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/portfolio/impl/model/MarketsPortfolioModel.kt @@ -45,6 +45,14 @@ internal class MarketsPortfolioModel @Inject constructor( private val params = paramsContainer.require() + 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 } diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/availablepairs/model/AvailableSwapPairsModel.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/availablepairs/model/AvailableSwapPairsModel.kt index 363f0712d5..72fd13b5bb 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/availablepairs/model/AvailableSwapPairsModel.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/swap/availablepairs/model/AvailableSwapPairsModel.kt @@ -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, diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt index 3eb20abc33..e8a70ed5c4 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt @@ -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, diff --git a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt index 81838cfdbb..1be48e89c6 100644 --- a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt +++ b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt @@ -85,11 +85,20 @@ object BlockchainUtils { excludedBlockchains: ExcludedBlockchains, hotExcludedBlockchains: Set, 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 {