Updated on 2026-08-14
This commit is contained in:
parent
9ebefa77ad
commit
a601f1d76d
6 changed files with 35 additions and 27 deletions
|
|
@ -124,7 +124,7 @@ data class YieldDTO(
|
|||
@Json(name = "rewardSchedule")
|
||||
val rewardSchedule: RewardScheduleDTO,
|
||||
@Json(name = "cooldownPeriod")
|
||||
val cooldownPeriod: PeriodDTO,
|
||||
val cooldownPeriod: PeriodDTO?,
|
||||
@Json(name = "warmupPeriod")
|
||||
val warmupPeriod: PeriodDTO,
|
||||
@Json(name = "rewardClaiming")
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class YieldConverter(
|
|||
tokens = metadataDTO.tokensDTO.map { tokenConverter.convert(it) },
|
||||
type = metadataDTO.type,
|
||||
rewardSchedule = convertRewardSchedule(metadataDTO.rewardSchedule),
|
||||
cooldownPeriod = convertPeriod(metadataDTO.cooldownPeriod),
|
||||
cooldownPeriod = metadataDTO.cooldownPeriod?.let { convertPeriod(it) },
|
||||
warmupPeriod = convertPeriod(metadataDTO.warmupPeriod),
|
||||
rewardClaiming = convertRewardClaiming(metadataDTO.rewardClaiming),
|
||||
defaultValidator = metadataDTO.defaultValidator,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ data class Yield(
|
|||
val tokens: List<Token>,
|
||||
val type: String,
|
||||
val rewardSchedule: RewardSchedule,
|
||||
val cooldownPeriod: Period,
|
||||
val cooldownPeriod: Period?,
|
||||
val warmupPeriod: Period,
|
||||
val rewardClaiming: RewardClaiming,
|
||||
val defaultValidator: String?,
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ internal class BalanceItemConverter(
|
|||
-> null
|
||||
}
|
||||
|
||||
private fun getUnbondingDate(date: DateTime?): TextReference {
|
||||
val unbondingPeriod = yield.metadata.cooldownPeriod.days
|
||||
private fun getUnbondingDate(date: DateTime?): TextReference? {
|
||||
val unbondingPeriod = yield.metadata.cooldownPeriod?.days ?: return null
|
||||
if (date == null) {
|
||||
return combinedReference(
|
||||
resourceReference(R.string.staking_details_unbonding_period),
|
||||
|
|
|
|||
|
|
@ -257,16 +257,19 @@ internal class AddStakingNotificationsTransformer(
|
|||
}
|
||||
|
||||
private fun MutableList<NotificationUM>.addExitInfoNotifications() {
|
||||
add(
|
||||
StakingNotification.Info.Unstake(
|
||||
cooldownPeriodDays = yield.metadata.cooldownPeriod.days,
|
||||
subtitleRes = if (isCosmos(cryptoCurrencyStatusProvider().currency.network.id.value)) {
|
||||
R.string.staking_notification_unstake_cosmos_text
|
||||
} else {
|
||||
R.string.staking_notification_unstake_text
|
||||
},
|
||||
),
|
||||
)
|
||||
val cooldownPeriodDays = yield.metadata.cooldownPeriod?.days
|
||||
if (cooldownPeriodDays != null) {
|
||||
add(
|
||||
StakingNotification.Info.Unstake(
|
||||
cooldownPeriodDays = cooldownPeriodDays,
|
||||
subtitleRes = if (isCosmos(cryptoCurrencyStatusProvider().currency.network.id.value)) {
|
||||
R.string.staking_notification_unstake_cosmos_text
|
||||
} else {
|
||||
R.string.staking_notification_unstake_text
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun MutableList<NotificationUM>.addEnterInfoNotifications() {
|
||||
|
|
@ -300,17 +303,21 @@ internal class AddStakingNotificationsTransformer(
|
|||
resourceReference(R.string.staking_notification_withdraw_text)
|
||||
}
|
||||
StakingActionType.UNLOCK_LOCKED -> {
|
||||
val cooldownPeriodDays = yield.metadata.cooldownPeriod.days
|
||||
resourceReference(R.string.staking_unlocked_locked) to resourceReference(
|
||||
R.string.staking_notification_unlock_text,
|
||||
wrappedList(
|
||||
pluralReference(
|
||||
id = R.plurals.common_days,
|
||||
count = cooldownPeriodDays,
|
||||
formatArgs = wrappedList(cooldownPeriodDays),
|
||||
val cooldownPeriodDays = yield.metadata.cooldownPeriod?.days
|
||||
if (cooldownPeriodDays != null) {
|
||||
resourceReference(R.string.staking_unlocked_locked) to resourceReference(
|
||||
R.string.staking_notification_unlock_text,
|
||||
wrappedList(
|
||||
pluralReference(
|
||||
id = R.plurals.common_days,
|
||||
count = cooldownPeriodDays,
|
||||
formatArgs = wrappedList(cooldownPeriodDays),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
} else {
|
||||
null to null
|
||||
}
|
||||
}
|
||||
else -> null to null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ internal class SetInitialDataStateTransformer(
|
|||
return listOfNotNull(
|
||||
createAnnualPercentageRateItem(yield.validators),
|
||||
createAvailableItem(cryptoCurrencyStatus),
|
||||
createUnbondingPeriodItem(yield.metadata.cooldownPeriod.days),
|
||||
createUnbondingPeriodItem(yield.metadata.cooldownPeriod?.days),
|
||||
createMinimumRequirementItem(
|
||||
cryptoCurrencyStatus = cryptoCurrencyStatus,
|
||||
minimumCryptoAmount = yield.args.enter.args[Yield.Args.ArgType.AMOUNT]?.minimum,
|
||||
|
|
@ -140,7 +140,8 @@ internal class SetInitialDataStateTransformer(
|
|||
)
|
||||
}
|
||||
|
||||
private fun createUnbondingPeriodItem(cooldownPeriodDays: Int): RoundedListWithDividersItemData {
|
||||
private fun createUnbondingPeriodItem(cooldownPeriodDays: Int?): RoundedListWithDividersItemData? {
|
||||
cooldownPeriodDays ?: return null
|
||||
return RoundedListWithDividersItemData(
|
||||
id = R.string.staking_details_unbonding_period,
|
||||
startText = TextReference.Res(R.string.staking_details_unbonding_period),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue