Updated on 2026-08-14
This commit is contained in:
parent
c729a406df
commit
9278f6f627
6 changed files with 12 additions and 4 deletions
|
|
@ -34,6 +34,7 @@ internal data class BalanceState(
|
|||
val validator: Yield.Validator?,
|
||||
val pendingActions: ImmutableList<PendingAction>,
|
||||
val isPending: Boolean,
|
||||
val validatorAddress: String?,
|
||||
)
|
||||
|
||||
@Immutable
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ internal class BalanceItemConverter(
|
|||
pendingActions = value.pendingActions.toPersistentList(),
|
||||
isClickable = value.isClickable(),
|
||||
isPending = value.isPending,
|
||||
validatorAddress = value.validatorAddress,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ internal class RewardsValidatorStateConverter(
|
|||
isClickable = true,
|
||||
type = balance.type,
|
||||
isPending = balance.isPending,
|
||||
validatorAddress = balance.validatorAddress,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -57,8 +57,10 @@ internal class StakingFeeTransactionLoader @AssistedInject constructor(
|
|||
val state = stateController.value
|
||||
val confirmationState = state.confirmationState as? StakingStates.ConfirmationState.Data
|
||||
?: error("Illegal state")
|
||||
val validatorState = state.validatorState as? StakingStates.ValidatorState.Data
|
||||
?: error("No validator provided")
|
||||
|
||||
val validatorAddress = (state.validatorState as? StakingStates.ValidatorState.Data)?.chosenValidator?.address
|
||||
?: state.balanceState?.validatorAddress
|
||||
?: error("No validator address provided")
|
||||
|
||||
val amount = (state.amountState as? AmountState.Data)?.amountTextField?.cryptoAmount?.value
|
||||
?: error("No amount provided")
|
||||
|
|
@ -66,8 +68,6 @@ internal class StakingFeeTransactionLoader @AssistedInject constructor(
|
|||
val pendingAction = confirmationState.pendingAction
|
||||
val pendingActions = confirmationState.pendingActions
|
||||
|
||||
val validatorAddress = validatorState.chosenValidator.address
|
||||
|
||||
val isEnter = state.actionType is StakingActionCommonType.Enter
|
||||
val isApprovalNeeded = confirmationState.isApprovalNeeded
|
||||
val isAllowanceNotEnough = confirmationState.allowance < amount
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ internal object InitialStakingStatePreview {
|
|||
type = BalanceType.STAKED,
|
||||
subtitle = null,
|
||||
isPending = false,
|
||||
validatorAddress = "",
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ internal class ValidatorSelectChangeTransformer(
|
|||
selectedValidator
|
||||
}
|
||||
|
||||
if (selectedValidator == null && yield.preferredValidators.isEmpty()) {
|
||||
return prevState
|
||||
}
|
||||
|
||||
return prevState.copy(
|
||||
validatorState = StakingStates.ValidatorState.Data(
|
||||
chosenValidator = selectedValidator ?: yield.preferredValidators.first(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue