Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-09 13:59:18 +05:00
parent 6d0ae6a85a
commit 47c32fe112
2 changed files with 17 additions and 0 deletions

View file

@ -5,8 +5,10 @@ import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.features.staking.impl.R
import com.tangem.features.staking.impl.presentation.state.utils.StakingRewardSchedule.COSMOS_SCHEDULE
import com.tangem.features.staking.impl.presentation.state.utils.StakingRewardSchedule.SOLANA_SCHEDULE
import com.tangem.features.staking.impl.presentation.state.utils.StakingRewardSchedule.TON_SCHEDULE
import com.tangem.lib.crypto.BlockchainUtils.isCosmos
import com.tangem.lib.crypto.BlockchainUtils.isSolana
import com.tangem.lib.crypto.BlockchainUtils.isTon
import com.tangem.lib.crypto.BlockchainUtils.isTron
import com.tangem.utils.StringsSigns.MINUS
import com.tangem.utils.StringsSigns.NON_BREAKING_SPACE
@ -14,6 +16,7 @@ import com.tangem.utils.StringsSigns.NON_BREAKING_SPACE
private data object StakingRewardSchedule {
val COSMOS_SCHEDULE = 5 to 12
val SOLANA_SCHEDULE = 2 to 3
val TON_SCHEDULE = 1 to 2
}
internal fun getRewardScheduleText(
@ -71,6 +74,15 @@ private fun getCustomRewardSchedule(networkId: String, decapitalize: Boolean = f
)
}
isTron(networkId) -> resourceReference(id = R.string.staking_reward_schedule_day, decapitalize = decapitalize)
isTon(networkId) -> combinedReference(
resourceReference(id = R.string.staking_reward_schedule_each_plural, decapitalize = decapitalize),
stringReference(NON_BREAKING_SPACE.toString()),
stringReference("${TON_SCHEDULE.first}$MINUS${TON_SCHEDULE.second}$NON_BREAKING_SPACE"),
pluralReference(
id = R.plurals.common_days_no_param,
count = TON_SCHEDULE.second,
),
)
else -> null
}
}

View file

@ -72,6 +72,11 @@ object BlockchainUtils {
return blockchain == Blockchain.Tron || blockchain == Blockchain.TronTestnet
}
fun isTon(blockchainId: String): Boolean {
val blockchain = Blockchain.fromId(blockchainId)
return blockchain == Blockchain.TON || blockchain == Blockchain.TONTestnet
}
fun isSupportedNetworkId(blockchainId: String, excludedBlockchains: ExcludedBlockchains): Boolean {
val blockchain = Blockchain.fromNetworkId(blockchainId)