Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-18 13:48:33 +03:00
parent 2c2fcd2758
commit 64693f66ca
4 changed files with 51 additions and 25 deletions

View file

@ -3,7 +3,9 @@ package com.tangem.domain.account.supplier
import com.tangem.domain.account.models.AccountList
import com.tangem.domain.account.producer.MultiAccountListProducer
import com.tangem.domain.core.flow.FlowCachingSupplier
import com.tangem.domain.models.wallet.UserWalletId
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
/**
* Supplier that provides a list of [AccountList]s for all user wallets.
@ -18,4 +20,12 @@ abstract class MultiAccountListSupplier(
operator fun invoke(): Flow<List<AccountList>> {
return super.invoke(params = Unit)
}
fun invokeMap(): Flow<LinkedHashMap<UserWalletId, AccountList>> = invoke()
.map { accountLists ->
accountLists.associateByTo(
destination = linkedMapOf(),
keySelector = { accountList -> accountList.userWalletId },
)
}
}