diff --git a/core/datasource/src/main/java/com/tangem/datasource/di/NetworkModule.kt b/core/datasource/src/main/java/com/tangem/datasource/di/NetworkModule.kt index 6f87fc5af0..98e783c10d 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/di/NetworkModule.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/di/NetworkModule.kt @@ -38,6 +38,7 @@ internal object NetworkModule { private const val PROD_V2_TANGEM_TECH_BASE_URL = "https://api.tangem-tech.com/v2/" private const val TANGEM_TECH_MARKETS_SERVICE_TIMEOUT_SECONDS = 60L + private const val STAKE_KIT_API_TIMEOUT_SECONDS = 60L @Provides @Singleton @@ -88,6 +89,10 @@ internal object NetworkModule { context = context, apiConfigsManager = apiConfigsManager, clientBuilder = { + this.callTimeout(STAKE_KIT_API_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .connectTimeout(STAKE_KIT_API_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .readTimeout(STAKE_KIT_API_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .applyTimeoutAnnotations() addInterceptor( NetworkLogsSaveInterceptor(appLogsStore), ) diff --git a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt index 7c7242509b..2d57ad5d63 100644 --- a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt +++ b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt @@ -569,6 +569,7 @@ internal class DefaultStakingRepository( -> TransactionData.Compiled.Data.Bytes(unsignedTransaction.hexToBytes()) Blockchain.BSC, Blockchain.Ethereum, + Blockchain.Polkadot, -> TransactionData.Compiled.Data.RawString(unsignedTransaction) Blockchain.Tron -> { val tronStakeKitTransaction = tronStakeKitTransactionAdapter.fromJson(unsignedTransaction) diff --git a/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/stakekit/action/StakingActionType.kt b/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/stakekit/action/StakingActionType.kt index 6c9e699f37..c51605d68b 100644 --- a/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/stakekit/action/StakingActionType.kt +++ b/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/stakekit/action/StakingActionType.kt @@ -39,4 +39,27 @@ enum class StakingActionType { MIGRATE -> "Migrate" UNKNOWN -> "Unknown" } + + val canChooseValidator + get() = when (this) { + STAKE, + RESTAKE, + VOTE, + VOTE_LOCKED, + -> true + + UNSTAKE, + CLAIM_REWARDS, + RESTAKE_REWARDS, + CLAIM_UNSTAKED, + WITHDRAW, + UNLOCK_LOCKED, + STAKE_LOCKED, + REVOKE, + REVOTE, + REBOND, + MIGRATE, + UNKNOWN, + -> false + } } diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/validator/ValidatorSelectChangeTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/validator/ValidatorSelectChangeTransformer.kt index e65a305e9d..134a6804fb 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/validator/ValidatorSelectChangeTransformer.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/validator/ValidatorSelectChangeTransformer.kt @@ -2,7 +2,6 @@ package com.tangem.features.staking.impl.presentation.state.transformers.validat import com.tangem.domain.staking.model.stakekit.Yield import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType -import com.tangem.domain.staking.model.stakekit.action.StakingActionType import com.tangem.features.staking.impl.presentation.state.StakingStates import com.tangem.features.staking.impl.presentation.state.StakingStep import com.tangem.features.staking.impl.presentation.state.StakingUiState @@ -20,7 +19,7 @@ internal class ValidatorSelectChangeTransformer( val isRestake = prevState.actionType == StakingActionCommonType.Pending.Restake val isEnter = prevState.actionType == StakingActionCommonType.Enter val isFromInfoScreen = prevState.currentStep == StakingStep.InitialInfo - val isVoteLocked = confirmationState?.pendingAction?.type == StakingActionType.VOTE_LOCKED + val canChooseValidator = confirmationState?.pendingAction?.type?.canChooseValidator ?: false val activeValidator = selectedValidator.takeIf { isFromInfoScreen && isRestake } ?: validatorState?.activeValidator @@ -39,7 +38,7 @@ internal class ValidatorSelectChangeTransformer( isPrimaryButtonEnabled = true, isClickable = true, activeValidator = activeValidator, - isVisibleOnConfirmation = isEnter || isRestake || isVoteLocked, + isVisibleOnConfirmation = isEnter || isRestake || canChooseValidator, ), ) }