Updated on 2026-08-14

This commit is contained in:
Tangem 2023-09-18 10:51:35 +03:00
parent 949f83cd34
commit 8fa01760a9
4 changed files with 53 additions and 21 deletions

View file

@ -102,7 +102,17 @@ class DerivationManagerImpl(
val curve = config.primaryCurve(currency.blockchain)
curve?.let { getDerivations(curve, scanResponse, currency) }
}
val derivations = derivationDataList.associate { it.derivations }
val derivations = buildMap<ByteArrayKey, MutableList<DerivationPath>> {
derivationDataList.forEach {
val current = this[it.derivations.first]
if (current != null) {
current.addAll(it.derivations.second)
current.distinct()
} else {
this[it.derivations.first] = it.derivations.second.toMutableList()
}
}
}
if (derivations.isEmpty()) {
onSuccess(scanResponse)
return
@ -165,10 +175,7 @@ class DerivationManagerImpl(
val wallet = scanResponse.card.wallets.firstOrNull { it.curve == curve } ?: return null
val supportedCurves = currency.blockchain.getSupportedCurves()
val path = currency.derivationPath
?.let {
currency.blockchain.derivationPath(scanResponse.derivationStyleProvider.getDerivationStyle())
}
val path = currency.blockchain.derivationPath(scanResponse.derivationStyleProvider.getDerivationStyle())
.takeIf { supportedCurves.contains(curve) }
val customPath = currency.derivationPath?.let {