Updated on 2026-08-14

This commit is contained in:
Tangem 2022-12-23 20:34:08 +04:00
parent e56e411930
commit 5352f6e6f4
7 changed files with 1186 additions and 1 deletions

View file

@ -169,6 +169,26 @@ internal class DefaultWalletAmountsRepository(
.fold()
}
private suspend fun fetchAmountsForUserWallet(
userWallet: UserWallet,
): CompletionResult<Unit> = withContext(Dispatchers.Default) {
val walletId = userWallet.walletId
val scanResponse = userWallet.scanResponse
val walletStores = walletStoresStorage.getAll()
.first()
.getOrElse(walletId) { emptyList() }
walletStores.map { walletStore ->
async {
// TODO: Find wallet manager via [com.tangem.tap.domain.walletStores.repository.WalletManagersRepository]
val walletManager = walletStore.walletManager
fetchAmountsForWalletStore(walletId, scanResponse, walletStore, walletManager)
}
}
.awaitAll()
.fold()
}
private suspend fun fetchAmountsForWalletStore(
walletId: UserWalletId,
scanResponse: ScanResponse,

View file

@ -73,7 +73,7 @@ class MultiWalletReducer {
val selectedCurrency = if (!state.isMultiwalletAllowed) {
walletStores.firstOrNull()?.walletsData?.firstOrNull()?.currency
} else {
state.selectedCurrency
state.selectedWalletData?.currency
}
state.copy(
walletsStores = walletStores,