diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml index eaddf5b46e..f323d25978 100644 --- a/core/res/src/main/res/values/strings.xml +++ b/core/res/src/main/res/values/strings.xml @@ -1787,6 +1787,8 @@ Ok, Got it! Really cool! Refresh + According to Clore’s official documentation, all tokens received before December 21 will be migrated to Clore (ERC20); tokens received after will not. Transfer solution coming — stay tuned. + Clore Network Migration You are currently in the Demo mode Demo mode active The card you scanned is a developer card. Do not use it to create your wallet. diff --git a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyWarning.kt b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyWarning.kt index 9edbf243da..1d69153c6e 100644 --- a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyWarning.kt +++ b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyWarning.kt @@ -57,6 +57,8 @@ sealed class CryptoCurrencyWarning { data object MigrationMaticToPol : CryptoCurrencyWarning() + data object MigrationClore : CryptoCurrencyWarning() + /** * Shows a warning about an available fee resource for a transaction in several blockchains (ex. Koinos) */ diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt index d4611e9d40..6ca1aa64ce 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt @@ -41,16 +41,16 @@ class GetCurrencyWarningsUseCase( // don't add here notifications that require async requests return combine( - getCoinRelatedWarnings( + flow = getCoinRelatedWarnings( userWalletId = userWalletId, networkId = currency.network.id, currencyId = currency.id, derivationPath = derivationPath, isSingleWalletWithTokens = isSingleWalletWithTokens, ), - flowOf(currencyChecksRepository.getRentInfoWarning(userWalletId, currencyStatus)), - flowOf(currencyChecksRepository.getExistentialDeposit(userWalletId, currency.network)), - flowOf(currencyChecksRepository.getFeeResourceAmount(userWalletId, currency.network)), + flow2 = flowOf(currencyChecksRepository.getRentInfoWarning(userWalletId, currencyStatus)), + flow3 = flowOf(currencyChecksRepository.getExistentialDeposit(userWalletId, currency.network)), + flow4 = flowOf(currencyChecksRepository.getFeeResourceAmount(userWalletId, currency.network)), ) { coinRelatedWarnings, maybeRentWarning, maybeEdWarning, maybeFeeResource -> setOfNotNull( maybeRentWarning, @@ -62,6 +62,7 @@ class GetCurrencyWarningsUseCase( getBeaconChainShutdownWarning(rawId = currency.network.id.rawId), getAssetRequirementsWarning(userWalletId = userWalletId, currency = currency), getMigrationFromMaticToPolWarning(currency), + getCloreMigrationWarning(currency), ) }.flowOn(dispatchers.io) } @@ -261,11 +262,20 @@ class GetCurrencyWarningsUseCase( } } + private fun getCloreMigrationWarning(currency: CryptoCurrency): CryptoCurrencyWarning? { + return if (currency.symbol == CLORE_SYMBOL && BlockchainUtils.isClore(currency.network.rawId)) { + CryptoCurrencyWarning.MigrationClore + } else { + null + } + } + private fun BigDecimal?.isZero(): Boolean { return this?.signum() == 0 } companion object { private const val MATIC_SYMBOL = "MATIC" + private const val CLORE_SYMBOL = "CLORE" } } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/analytics/TokenDetailsNotificationsAnalyticsSender.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/analytics/TokenDetailsNotificationsAnalyticsSender.kt index 3bef7418c8..d65921fdb9 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/analytics/TokenDetailsNotificationsAnalyticsSender.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/analytics/TokenDetailsNotificationsAnalyticsSender.kt @@ -59,6 +59,7 @@ internal class TokenDetailsNotificationsAnalyticsSender( is TokenDetailsNotification.RequiredTrustlineWarning, is TokenDetailsNotification.KoinosMana, is TokenDetailsNotification.MigrationMaticToPol, + is TokenDetailsNotification.MigrationClore, is TokenDetailsNotification.UsedOutdatedData, -> null } diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt index b1ae6761a1..5733db0e18 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt @@ -258,6 +258,11 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) { subtitle = resourceReference(id = R.string.warning_matic_migration_message), ) + data object MigrationClore : Warning( + title = resourceReference(id = R.string.warning_clore_migration_title), + subtitle = resourceReference(id = R.string.warning_clore_migration_message), + ) + data object UsedOutdatedData : TokenDetailsNotification( config = NotificationConfig( subtitle = resourceReference(R.string.warning_some_token_balances_not_updated), diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt index 0b4d3a4e71..eb54aca878 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt @@ -155,6 +155,7 @@ internal class TokenDetailsNotificationConverter( }, ) is CryptoCurrencyWarning.MigrationMaticToPol -> MigrationMaticToPol + is CryptoCurrencyWarning.MigrationClore -> MigrationClore is CryptoCurrencyWarning.UsedOutdatedDataWarning -> UsedOutdatedData } } diff --git a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt index b51011e498..91fb30dd4f 100644 --- a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt +++ b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt @@ -115,6 +115,10 @@ object BlockchainUtils { return blockchain == Blockchain.BSC || blockchain == Blockchain.BSCTestnet } + fun isClore(blockchainId: String): Boolean { + return Blockchain.fromId(blockchainId) == Blockchain.Clore + } + data class BlockchainInfo( val blockchainId: String, val name: String,