From 6766af1971ba09a5a434c6d17fff92990994fb6a Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 13 Oct 2025 10:39:34 +0200 Subject: [PATCH] Updated on 2026-08-14 --- .../domain/card/common/extensions/CardSdk.kt | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt index 4606c72970..4be35ce782 100644 --- a/domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt @@ -45,19 +45,33 @@ fun CardDTO.supportedBlockchains( excludedBlockchains: ExcludedBlockchains, ): List { val supportedBlockchains = if (firmwareVersion < FirmwareVersion.MultiWalletAvailable) { - Blockchain.fromCurve(EllipticCurve.Secp256k1).toMutableList() + Blockchain.fromCurve(EllipticCurve.Secp256k1) } else if (!cardTypesResolver.isWallet2() && !cardTypesResolver.isTangemWallet()) { // need for old multiwallet that supports only secp256k1 - wallets.flatMap { Blockchain.fromCurve(it.curve) }.distinct().toMutableList() + wallets.flatMap { Blockchain.fromCurve(it.curve) }.distinct() } else { // multiwallet supports all blockchains, move this logic to config - Blockchain.entries.toMutableList() + Blockchain.entries } return supportedBlockchains .filter { isTestCard == it.isTestnet() } + .filterNot(::isBlockchainUnsupported) .filter { it !in excludedBlockchains } } +/** + * Filters out blockchains that are not supported by the specific card firmware. + * @return `false` if blockchain is not supported, `true` otherwise. + */ +private fun CardDTO.isBlockchainUnsupported(blockchain: Blockchain): Boolean { + return when (blockchain) { + Blockchain.Quai, Blockchain.QuaiTestnet -> { + firmwareVersion <= FirmwareVersion.HDWalletAvailable + } + else -> false + } +} + fun CardDTO.supportedTokens( cardTypesResolver: CardTypesResolver, excludedBlockchains: ExcludedBlockchains,