Updated on 2026-08-14

This commit is contained in:
Tangem 2025-06-26 18:11:51 +04:00
parent 2bbded1c29
commit e2a6af1ccb
2 changed files with 10 additions and 1 deletions

View file

@ -165,7 +165,7 @@ internal class DefaultMultiYieldBalanceFetcher @Inject constructor(
val yieldBalances = coroutineScope {
requests
// TODO: in the future, consider optimizing this part
.chunked(size = 16) // StakeKitApi limitation: no more than 16 requests at the same time
.chunked(size = 15) // StakeKitApi limitation: no more than 15 requests at the same time
.map {
async(dispatchers.io) { stakeKitApi.getMultipleYieldBalances(it).bind() }
}

View file

@ -1,6 +1,7 @@
package com.tangem.features.staking.impl.presentation.state.helpers
import com.tangem.domain.staking.FetchActionsUseCase
import com.tangem.domain.staking.FetchStakingYieldBalanceUseCase
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.domain.staking.model.stakekit.action.StakingActionStatus
import com.tangem.domain.tokens.FetchCurrencyStatusUseCase
@ -22,6 +23,7 @@ internal class StakingBalanceUpdater @AssistedInject constructor(
private val fetchActionsUseCase: FetchActionsUseCase,
private val txHistoryContentUpdateEmitter: TxHistoryContentUpdateEmitter,
private val fetchCurrencyStatusUseCase: FetchCurrencyStatusUseCase,
private val fetchStakingYieldBalanceUseCase: FetchStakingYieldBalanceUseCase,
@DelayedWork private val coroutineScope: CoroutineScope,
@Assisted private val userWallet: UserWallet,
@Assisted private val cryptoCurrencyStatus: CryptoCurrencyStatus,
@ -37,6 +39,13 @@ internal class StakingBalanceUpdater @AssistedInject constructor(
network = cryptoCurrencyStatus.currency.network,
)
},
async {
fetchStakingYieldBalanceUseCase(
userWalletId = userWallet.walletId,
cryptoCurrency = cryptoCurrencyStatus.currency,
isRefactoringEnabled = true,
)
},
// we should update tx history and network for new balances
async {
fetchCurrencyStatus(delayMillis = BALANCE_UPDATE_DELAY)