Updated on 2026-08-14

This commit is contained in:
Tangem 2024-02-09 15:50:51 +03:00
parent fad7253757
commit b3a1dc5518
3 changed files with 29 additions and 4 deletions

View file

@ -2,10 +2,7 @@ package com.tangem.tap.domain.card
import com.tangem.common.card.CardWallet
import com.tangem.common.card.FirmwareVersion
import com.tangem.domain.common.configs.CardConfig
import com.tangem.domain.common.configs.GenericCardConfig
import com.tangem.domain.common.configs.MultiWalletCardConfig
import com.tangem.domain.common.configs.Wallet2CardConfig
import com.tangem.domain.common.configs.*
import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.KeyWalletPublicKey
import com.tangem.domain.models.scan.ProductType
@ -50,6 +47,7 @@ object ScanResponseMockFactory {
is GenericCardConfig -> genericFirmwareVersion
MultiWalletCardConfig -> walletFirmwareVersion
Wallet2CardConfig -> wallet2FirmwareVersion
EdSingleCurrencyCardConfig -> genericFirmwareVersion
},
manufacturer = CardDTO.Manufacturer(name = "NEVER-MIND", manufactureDate = Date(), signature = null),
issuer = CardDTO.Issuer(name = "NEVER-MIND", publicKey = ByteArray(0)),

View file

@ -22,6 +22,11 @@ sealed interface CardConfig {
) {
return MultiWalletCardConfig
}
if (cardDTO.supportedCurves.size == 1 &&
cardDTO.supportedCurves.contains(EllipticCurve.Ed25519)
) {
return EdSingleCurrencyCardConfig
}
return GenericCardConfig(cardDTO.settings.maxWalletsCount)
}
}

View file

@ -0,0 +1,22 @@
package com.tangem.domain.common.configs
import com.tangem.blockchain.common.Blockchain
import com.tangem.common.card.EllipticCurve
import timber.log.Timber
object EdSingleCurrencyCardConfig : CardConfig {
override val mandatoryCurves: List<EllipticCurve> = listOf(EllipticCurve.Ed25519)
override fun primaryCurve(blockchain: Blockchain): EllipticCurve? {
return when {
blockchain.getSupportedCurves().contains(EllipticCurve.Ed25519) -> {
EllipticCurve.Ed25519
}
else -> {
Timber.e("Unsupported blockchain, curve not found")
null
}
}
}
}