Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-11 13:37:16 +05:00
commit 99013dee42
20 changed files with 1020 additions and 121 deletions

View file

@ -0,0 +1,25 @@
package com.tangem.domain.tokens
import arrow.core.Either
import com.tangem.domain.tokens.error.CurrencyStatusError
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.repository.CurrenciesRepository
import com.tangem.domain.wallets.models.UserWalletId
class GetCryptoCurrenciesUseCase(
private val currenciesRepository: CurrenciesRepository,
) {
/**
* Retrieves the list of cryptocurrencies within a multi-currency wallet.
*
* @param userWalletId The unique identifier of the user wallet.
*
* @return An [Either] representing success (Right) or an error (Left) in fetching the status.
*/
suspend operator fun invoke(userWalletId: UserWalletId): Either<CurrencyStatusError, List<CryptoCurrency>> {
return Either.catch {
currenciesRepository.getMultiCurrencyWalletCurrenciesSync(userWalletId)
}.mapLeft(CurrencyStatusError::DataError)
}
}