Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-21 18:27:08 +04:00
parent b6fad30af9
commit 30a7d0dcec

View file

@ -168,15 +168,18 @@ class CachedCurrenciesStatusesOperations(
combine(
flow = getQuotes(currenciesIds),
flow2 = networksStatusesUpdates,
flow3 = networksStatusesUpdates.flatMapLatest {
val currenciesAddresses = it.getOrElse(default = { emptySet() })
.mapNotNull {
val currency = currencies.firstOrNull { currency -> currency.network == it.network }
?: return@mapNotNull null
flow3 = networksStatusesUpdates.flatMapLatest { maybeNetworksStatuses ->
val networksStatuses = maybeNetworksStatuses.getOrNull()
currency.id to extractAddress(it)
val currenciesAddresses = if (networksStatuses == null) {
emptyMap()
} else {
currencies.associate { currency ->
val networkStatus = networksStatuses.firstOrNull { it.network == currency.network }
currency.id to extractAddress(networkStatus)
}
.toMap()
}
getYieldsBalancesUpdates(userWalletId, currenciesAddresses)
},
@ -397,8 +400,11 @@ class CachedCurrenciesStatusesOperations(
return channelFlow {
val state = MutableStateFlow(emptyList<YieldBalance>())
val stakingIds = cryptoCurrencies.mapNotNullTo(hashSetOf()) {
stakingIdFactory.create(currencyId = it.key, defaultAddress = it.value)
val stakingIds = cryptoCurrencies.mapNotNullTo(hashSetOf()) { currencyWithAddress ->
stakingIdFactory.create(
currencyId = currencyWithAddress.key,
defaultAddress = currencyWithAddress.value,
)
.getOrNull()
}