Updated on 2026-08-14

This commit is contained in:
Tangem 2024-11-28 17:53:01 +02:00
parent 164e0718e6
commit ab1b0b082c
6 changed files with 19 additions and 3 deletions

View file

@ -75,6 +75,7 @@ internal class StakingStateController @Inject constructor(
walletName = "",
cryptoCurrencyName = "",
cryptoCurrencySymbol = "",
cryptoCurrencyBlockchainId = "",
currentStep = StakingStep.InitialInfo,
initialInfoState = StakingStates.InitialInfoState.Empty(),
amountState = AmountState.Empty(),

View file

@ -5,6 +5,7 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
import com.tangem.domain.staking.analytics.StakingAnalyticsEvent
import com.tangem.features.staking.impl.analytics.utils.StakingAnalyticSender
import com.tangem.lib.crypto.BlockchainUtils.isSolana
internal class StakingStateRouter(
private val appRouter: AppRouter,
@ -23,7 +24,13 @@ internal class StakingStateRouter(
fun onNextClick() {
when (stateController.value.currentStep) {
StakingStep.InitialInfo -> when (stateController.value.actionType) {
StakingActionCommonType.Enter, StakingActionCommonType.Exit -> showAmount()
StakingActionCommonType.Enter -> showAmount()
// TODO staking [REDACTED_TASK_KEY] support solana multisize hashes signing
StakingActionCommonType.Exit -> if (isSolana(stateController.value.cryptoCurrencyBlockchainId)) {
showConfirmation()
} else {
showAmount()
}
StakingActionCommonType.Pending.Other,
StakingActionCommonType.Pending.Rewards,
-> showConfirmation()
@ -50,7 +57,9 @@ internal class StakingStateRouter(
val isEnter = uiState.actionType == StakingActionCommonType.Enter
val isExit = uiState.actionType == StakingActionCommonType.Exit
if (isEnter || isExit) {
// TODO staking [REDACTED_TASK_KEY] support solana multisize hashes signing
val isSolana = isSolana(uiState.cryptoCurrencyBlockchainId)
if (isEnter || isExit && !isSolana) {
showAmount()
} else {
showInitial()

View file

@ -29,6 +29,7 @@ internal data class StakingUiState(
val walletName: String,
val cryptoCurrencyName: String,
val cryptoCurrencySymbol: String,
val cryptoCurrencyBlockchainId: String,
val currentStep: StakingStep,
val initialInfoState: StakingStates.InitialInfoState,
val amountState: AmountState,

View file

@ -64,6 +64,7 @@ internal class SetInitialDataStateTransformer(
title = TextReference.EMPTY,
cryptoCurrencyName = cryptoCurrency.name,
cryptoCurrencySymbol = cryptoCurrency.symbol,
cryptoCurrencyBlockchainId = cryptoCurrency.network.id.value,
clickIntents = clickIntents,
currentStep = StakingStep.InitialInfo,
initialInfoState = createInitialInfoState(),

View file

@ -40,9 +40,10 @@ internal fun StakingConfirmationContent(
validatorState: StakingStates.ValidatorState,
clickIntents: StakingClickIntents,
type: StakingActionCommonType,
isSolana: Boolean, // TODO staking [REDACTED_TASK_KEY] support solana multisize hashes signing
) {
if (state !is StakingStates.ConfirmationState.Data) return
val isAmountEditable = type == StakingActionCommonType.Enter || type == StakingActionCommonType.Exit
val isAmountEditable = type == StakingActionCommonType.Enter || type == StakingActionCommonType.Exit && !isSolana
val isTransactionSent = state.innerState == InnerConfirmationStakingState.COMPLETED
val isTransactionInProgress = state.notifications.any { it is StakingNotification.Warning.TransactionInProgress }
Column(
@ -90,6 +91,7 @@ private fun Preview_StakingConfirmationContent() {
validatorState = ValidatorStatePreviewData.validatorState,
clickIntents = StakingClickIntentsStub,
type = StakingActionCommonType.Enter,
isSolana = false,
)
}
}

View file

@ -28,6 +28,7 @@ import com.tangem.features.staking.impl.presentation.state.bottomsheet.StakingAc
import com.tangem.features.staking.impl.presentation.state.bottomsheet.StakingInfoBottomSheetConfig
import com.tangem.features.staking.impl.presentation.ui.bottomsheet.StakingActionSelectorBottomSheet
import com.tangem.features.staking.impl.presentation.ui.bottomsheet.StakingInfoBottomSheet
import com.tangem.lib.crypto.BlockchainUtils.isSolana
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
@ -170,6 +171,7 @@ private fun StakingScreenContent(uiState: StakingUiState, modifier: Modifier = M
validatorState = uiState.validatorState,
clickIntents = uiState.clickIntents,
type = uiState.actionType,
isSolana = isSolana(uiState.cryptoCurrencyBlockchainId),
)
StakingStep.RestakeValidator,
StakingStep.Validators,