Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-26 17:07:40 +02:00
parent e04ac1fb2c
commit 99d32963b5
20 changed files with 336 additions and 27 deletions

View file

@ -182,7 +182,8 @@ internal class StakingModel @Inject constructor(
}
StakingIntegrationID.P2PEthPool -> {
val vaults = p2pEthPoolRepository.getVaultsSync()
P2PEthPoolIntegration(integrationId, vaults)
val limits = p2pEthPoolRepository.getVaultLimitsSyncOrNull().orEmpty()
P2PEthPoolIntegration(integrationId, vaults, limits)
}
}
}

View file

@ -57,6 +57,7 @@ internal sealed class StakingStates {
val yieldBalance: InnerYieldBalanceState,
val pullToRefreshConfig: PullToRefreshConfig,
val legalUrls: LegalUrls,
val areAllTargetsFull: Boolean = false,
) : InitialInfoState()
data class LegalUrls(

View file

@ -166,7 +166,11 @@ internal class SetButtonsStateTransformer(
val hasNotStaking = initialState?.yieldBalance == InnerYieldBalanceState.Empty
val isCardano = BlockchainUtils.isCardano(cryptoCurrencyBlockchainId)
return !hasNotStaking && isCardano && currentStep == StakingStep.InitialInfo
if (!hasNotStaking && isCardano && currentStep == StakingStep.InitialInfo) return true
val hasStaking = initialState?.yieldBalance is InnerYieldBalanceState.Data
val areAllTargetsFull = initialState?.areAllTargetsFull == true
return hasStaking && areAllTargetsFull && currentStep == StakingStep.InitialInfo
}
private fun StakingUiState.isApprovalRequired(): Boolean {

View file

@ -110,6 +110,7 @@ internal class SetInitialDataStateTransformer(
termsOfServiceUrl = integration.legalUrls.termsOfServiceUrl,
privacyPolicyUrl = integration.legalUrls.privacyPolicyUrl,
),
areAllTargetsFull = integration.areAllTargetsFull,
)
}

View file

@ -133,6 +133,7 @@ internal class StakingModelTransactionTest : StakingModelTestBase() {
integrationId = StakingIntegrationID.P2PEthPool,
)
coEvery { p2pEthPoolRepository.getVaultsSync() } returns emptyList()
coEvery { p2pEthPoolRepository.getVaultLimitsSyncOrNull() } returns emptyMap()
val uiStateFlow = MutableStateFlow(initialUiState)
every { stateController.uiState } returns uiStateFlow
coEvery {
@ -218,6 +219,7 @@ internal class StakingModelTransactionTest : StakingModelTestBase() {
integrationId = StakingIntegrationID.P2PEthPool,
)
coEvery { p2pEthPoolRepository.getVaultsSync() } returns emptyList()
coEvery { p2pEthPoolRepository.getVaultLimitsSyncOrNull() } returns emptyMap()
val uiStateFlow = MutableStateFlow(initialUiState)
every { stateController.uiState } returns uiStateFlow
coEvery {