Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-07 19:25:20 +04:00
parent 01348109c2
commit a2504e3c4b
5 changed files with 26 additions and 4 deletions

View file

@ -35,7 +35,10 @@ import com.tangem.datasource.local.token.StakingYieldsStore
import com.tangem.domain.staking.model.StakingApproval
import com.tangem.domain.staking.model.StakingAvailability
import com.tangem.domain.staking.model.StakingEntryInfo
import com.tangem.domain.staking.model.stakekit.*
import com.tangem.domain.staking.model.stakekit.NetworkType
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.domain.staking.model.stakekit.YieldBalance
import com.tangem.domain.staking.model.stakekit.YieldBalanceList
import com.tangem.domain.staking.model.stakekit.action.StakingAction
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
import com.tangem.domain.staking.model.stakekit.action.StakingActionStatus
@ -480,6 +483,13 @@ internal class DefaultStakingRepository(
override fun getMultiYieldBalanceUpdates(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,
): Flow<YieldBalanceList> {
TODO("Will be implemented in [REDACTED_TASK_KEY]")
}
override fun getMultiYieldBalanceUpdatesLegacy(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,
): Flow<YieldBalanceList> = channelFlow {
stakingBalanceStore.get(userWalletId)
.onEach {

View file

@ -63,6 +63,11 @@ interface StakingRepository {
cryptoCurrencies: List<CryptoCurrency>,
): Flow<YieldBalanceList>
fun getMultiYieldBalanceUpdatesLegacy(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,
): Flow<YieldBalanceList>
suspend fun getMultiYieldBalanceSync(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,

View file

@ -189,7 +189,7 @@ internal class CurrenciesStatusesLceOperations(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,
): EitherFlow<TokenListError, YieldBalanceList> {
return stakingRepository.getMultiYieldBalanceUpdates(userWalletId, cryptoCurrencies)
return stakingRepository.getMultiYieldBalanceUpdatesLegacy(userWalletId, cryptoCurrencies)
.map<YieldBalanceList, Either<TokenListError, YieldBalanceList>> { it.right() }
.catch { emit(TokenListError.DataError(it).left()) }
.distinctUntilChanged()

View file

@ -349,7 +349,7 @@ internal class CurrenciesStatusesOperations(
private fun getQuotes(tokensIds: NonEmptySet<CryptoCurrency.ID>): Flow<Either<Error, Set<Quote>>> {
val rawIds = tokensIds.mapNotNull { it.rawCurrencyId }.toSet()
return quotesRepository.getQuotesUpdates(rawIds)
return quotesRepository.getQuotesUpdatesLegacy(rawIds)
.map<Set<Quote>, Either<Error, Set<Quote>>> { quotes ->
if (quotes.isEmpty()) Error.EmptyQuotes.left() else quotes.right()
}
@ -360,7 +360,7 @@ internal class CurrenciesStatusesOperations(
}
private fun getNetworksStatuses(networks: NonEmptySet<Network>): Flow<Either<Error, Set<NetworkStatus>>> {
return networksRepository.getNetworkStatusesUpdates(userWalletId, networks)
return networksRepository.getNetworkStatusesUpdatesLegacy(userWalletId, networks)
.map<Set<NetworkStatus>, Either<Error, Set<NetworkStatus>>> { it.right() }
.catch { emit(Error.DataError(it).left()) }
.onEmpty { emit(Error.EmptyNetworksStatuses.left()) }

View file

@ -157,6 +157,13 @@ class MockStakingRepository : StakingRepository {
override fun getMultiYieldBalanceUpdates(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,
): Flow<YieldBalanceList> {
return flowOf(YieldBalanceList.Data(listOf(YieldBalance.Error)))
}
override fun getMultiYieldBalanceUpdatesLegacy(
userWalletId: UserWalletId,
cryptoCurrencies: List<CryptoCurrency>,
): Flow<YieldBalanceList> = flowOf()
override suspend fun getMultiYieldBalanceSync(