Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-18 18:18:29 +04:00
parent 097e9c1bce
commit 2437fa39d8
9 changed files with 120 additions and 22 deletions

View file

@ -135,10 +135,9 @@ internal class DefaultCardCryptoCurrencyFactory(
userWallet: UserWallet,
networks: Set<Network>,
): Map<Network, List<CryptoCurrency>> {
val response = walletAccountsFetcher.getSaved(userWallet.walletId)
?: return emptyMap()
val response = walletAccountsFetcher.getSaved(userWallet.walletId) ?: return emptyMap()
val existingNetworkWithCurrencies = response.accounts.flatMapTo(hashSetOf()) { accountDTO ->
val currenciesByNetworkId = response.accounts.flatMapTo(hashSetOf()) { accountDTO ->
val accountIndex = DerivationIndex(accountDTO.derivationIndex).getOrNull()
?: return@flatMapTo emptySet()
@ -152,9 +151,11 @@ internal class DefaultCardCryptoCurrencyFactory(
accountIndex = accountIndex,
)
}
.groupBy(CryptoCurrency::network)
.groupBy { it.network.id }
return networks.associateWith { emptyList<CryptoCurrency>() } + existingNetworkWithCurrencies
return networks.associateWith { network ->
currenciesByNetworkId[network.id].orEmpty()
}
}
private suspend fun getMultiWalletCurrenciesByRawId(