Updated on 2026-08-14

This commit is contained in:
Tangem 2024-08-15 12:44:44 +04:00
parent 605f17c873
commit 517a9609ec
5 changed files with 44 additions and 0 deletions

View file

@ -454,6 +454,21 @@ internal class DefaultCurrenciesRepository(
) ?: error("Unable to create token")
}
override suspend fun hasTokens(userWalletId: UserWalletId, network: Network): Boolean {
val userWallet = getUserWallet(userWalletId)
fetchTokensIfCacheExpired(userWallet, refresh = false)
val storedTokens = requireNotNull(userTokensStore.getSyncOrNull(userWallet.walletId)) {
"Unable to find tokens response for user wallet with provided ID: $userWalletId"
}
return storedTokens.tokens.any {
it.contractAddress != null &&
it.networkId == network.backendId &&
it.derivationPath == network.derivationPath.value
}
}
private fun getMultiCurrencyWalletCurrencies(userWallet: UserWallet): Flow<List<CryptoCurrency>> {
return userTokensStore.get(userWallet.walletId).map { storedTokens ->
responseCurrenciesFactory.createCurrencies(