Updated on 2026-08-14
This commit is contained in:
parent
b9b41e9d26
commit
6766af1971
1 changed files with 17 additions and 3 deletions
|
|
@ -45,19 +45,33 @@ fun CardDTO.supportedBlockchains(
|
|||
excludedBlockchains: ExcludedBlockchains,
|
||||
): List<Blockchain> {
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue