Updated on 2026-08-14
This commit is contained in:
parent
67016b4755
commit
57eb2359a7
19 changed files with 291 additions and 125 deletions
|
|
@ -5,6 +5,7 @@ import com.tangem.domain.staking.model.StakingEntryInfo
|
|||
import com.tangem.domain.staking.model.stakekit.StakingError
|
||||
import com.tangem.domain.staking.repositories.StakingErrorResolver
|
||||
import com.tangem.domain.staking.repositories.StakingRepository
|
||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
|
||||
/**
|
||||
* Use case for getting entry info about staking on token screen.
|
||||
|
|
@ -14,9 +15,17 @@ class GetStakingEntryInfoUseCase(
|
|||
private val stakingErrorResolver: StakingErrorResolver,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(integrationId: String): Either<StakingError, StakingEntryInfo> {
|
||||
suspend operator fun invoke(
|
||||
cryptoCurrencyId: CryptoCurrency.ID,
|
||||
symbol: String,
|
||||
): Either<StakingError, StakingEntryInfo> {
|
||||
return Either
|
||||
.catch { stakingRepository.getEntryInfo(integrationId) }
|
||||
.catch {
|
||||
stakingRepository.getEntryInfo(
|
||||
cryptoCurrencyId = cryptoCurrencyId,
|
||||
symbol = symbol,
|
||||
)
|
||||
}
|
||||
.mapLeft { stakingErrorResolver.resolve(it) }
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ interface StakingRepository {
|
|||
|
||||
suspend fun fetchEnabledYields(refresh: Boolean)
|
||||
|
||||
suspend fun getEntryInfo(integrationId: String): StakingEntryInfo
|
||||
suspend fun getEntryInfo(cryptoCurrencyId: CryptoCurrency.ID, symbol: String): StakingEntryInfo
|
||||
|
||||
suspend fun getYield(cryptoCurrencyId: CryptoCurrency.ID, symbol: String): Yield
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue