Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-22 17:41:04 +04:00
parent db6157cae4
commit 99f62f79ee
35 changed files with 128 additions and 109 deletions

View file

@ -127,8 +127,7 @@ internal class DefaultCurrenciesRepository(
currenciesToAdd: List<CryptoCurrency>,
): List<CryptoCurrency> {
return currenciesToAdd.filter { currency ->
val blockchain = getBlockchain(networkId = currency.network.id)
val networkId = blockchain.toNetworkId()
val networkId = currency.network.toBlockchain().toNetworkId()
val contractAddress = (currency as? CryptoCurrency.Token)?.contractAddress
savedCurrencies.none { token ->
@ -357,7 +356,7 @@ internal class DefaultCurrenciesRepository(
"Unable to find tokens response for user wallet with provided ID: $userWalletId"
},
)
val blockchain = Blockchain.fromId(networkId.rawId.value)
val blockchain = networkId.toBlockchain()
val blockchainNetworkId = blockchain.toNetworkId()
val coinId = blockchain.toCoinId()
@ -410,7 +409,7 @@ internal class DefaultCurrenciesRepository(
cryptoCurrencyStatus: CryptoCurrencyStatus,
coinStatus: CryptoCurrencyStatus?,
): Boolean {
val blockchain = Blockchain.fromId(cryptoCurrencyStatus.currency.network.rawId)
val blockchain = cryptoCurrencyStatus.currency.network.toBlockchain()
val isBitcoinBlockchain = blockchain == Blockchain.Bitcoin || blockchain == Blockchain.BitcoinTestnet
return when {
cryptoCurrencyStatus.currency is CryptoCurrency.Coin && isBitcoinBlockchain -> {
@ -425,7 +424,7 @@ internal class DefaultCurrenciesRepository(
override suspend fun getFeePaidCurrency(userWalletId: UserWalletId, network: Network): FeePaidCurrency {
return withContext(dispatchers.io) {
val blockchain = Blockchain.fromId(network.rawId)
val blockchain = network.toBlockchain()
when (val feePaidCurrency = blockchain.feePaidCurrency()) {
FeePaidSdkCurrency.Coin -> FeePaidCurrency.Coin
FeePaidSdkCurrency.SameCurrency -> FeePaidCurrency.SameCurrency

View file

@ -5,6 +5,7 @@ import com.tangem.blockchain.blockchains.polkadot.AccountCheckProvider
import com.tangem.blockchain.blockchains.polkadot.network.accounthealthcheck.ExtrinsicListItemResponse
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.BlockchainSdkError
import com.tangem.blockchainsdk.utils.toBlockchain
import com.tangem.datasource.local.preferences.AppPreferencesStore
import com.tangem.datasource.local.preferences.PreferencesKeys.POLKADOT_HEALTH_CHECKED_IMMUTABLE_ACCOUNTS_KEY
import com.tangem.datasource.local.preferences.PreferencesKeys.POLKADOT_HEALTH_CHECKED_RESET_ACCOUNTS_KEY
@ -39,7 +40,7 @@ internal class DefaultPolkadotAccountHealthCheckRepository(
override suspend fun runCheck(userWalletId: UserWalletId, network: Network) {
// Run Polkadot account health check
if (Blockchain.fromId(network.rawId) != Blockchain.Polkadot) return
if (network.toBlockchain() != Blockchain.Polkadot) return
val walletManager = walletManagersFacade.getOrCreateWalletManager(userWalletId, network)
val address = requireNotNull(walletManager?.wallet?.address) {