Updated on 2026-08-14

This commit is contained in:
Tangem 2024-09-06 11:35:11 +03:00
parent 06eabf3699
commit 6045dce1df
2 changed files with 15 additions and 8 deletions

View file

@ -22,6 +22,7 @@ import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import com.tangem.features.staking.impl.presentation.state.converters.RewardsValidatorStateConverter
import com.tangem.features.staking.impl.presentation.state.converters.YieldBalancesConverter
import com.tangem.features.staking.impl.presentation.viewmodel.StakingClickIntents
import com.tangem.lib.crypto.BlockchainUtils.isPolkadot
import com.tangem.utils.Provider
import com.tangem.utils.isNullOrZero
import com.tangem.utils.transformer.Transformer
@ -144,18 +145,19 @@ internal class SetInitialDataStateTransformer(
cryptoCurrencyStatus: CryptoCurrencyStatus,
minimumCryptoAmount: SerializedBigDecimal?,
): RoundedListWithDividersItemData? {
minimumCryptoAmount ?: return null
if (minimumCryptoAmount == null) return null
if (!isPolkadot(cryptoCurrencyStatus.currency.network.id.value)) return null
val formattedAmount = BigDecimalFormatter.formatCryptoAmount(
cryptoAmount = minimumCryptoAmount,
cryptoCurrency = cryptoCurrencyStatus.currency.symbol,
decimals = cryptoCurrencyStatus.currency.decimals,
)
return RoundedListWithDividersItemData(
id = R.string.staking_details_minimum_requirement,
startText = TextReference.Res(R.string.staking_details_minimum_requirement),
endText = TextReference.Str(
value = BigDecimalFormatter.formatCryptoAmount(
cryptoAmount = minimumCryptoAmount,
cryptoCurrency = cryptoCurrencyStatus.currency.symbol,
decimals = cryptoCurrencyStatus.currency.decimals,
),
),
endText = TextReference.Str(formattedAmount),
)
}

View file

@ -77,6 +77,11 @@ object BlockchainUtils {
return blockchain == Blockchain.Solana
}
fun isPolkadot(networkId: String): Boolean {
val blockchain = Blockchain.fromId(networkId)
return blockchain == Blockchain.Polkadot || blockchain == Blockchain.PolkadotTestnet
}
data class BlockchainInfo(
val blockchainId: String,
val name: String,