From 50806204abf0f95c7c0b103d0b887ab288e56b47 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 9 Oct 2025 17:41:42 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../DefaultAccountsCRUDRepository.kt | 18 ++ .../repository/DefaultCurrenciesRepository.kt | 69 +---- .../repository/AccountsCRUDRepository.kt | 7 + domain/account/status/build.gradle.kts | 1 + .../status/di/AccountStatusUseCaseModule.kt | 41 +++ .../usecase/SaveCryptoCurrenciesUseCase.kt | 269 ++++++++++++++++++ .../tangem/domain/models/account/Account.kt | 8 +- .../tokens/repository/CurrenciesRepository.kt | 23 +- .../repository/MockCurrenciesRepository.kt | 13 +- 9 files changed, 357 insertions(+), 92 deletions(-) create mode 100644 domain/account/status/src/main/java/com/tangem/domain/account/status/usecase/SaveCryptoCurrenciesUseCase.kt diff --git a/data/account/src/main/kotlin/com/tangem/data/account/repository/DefaultAccountsCRUDRepository.kt b/data/account/src/main/kotlin/com/tangem/data/account/repository/DefaultAccountsCRUDRepository.kt index 524e256767..5af36f3594 100644 --- a/data/account/src/main/kotlin/com/tangem/data/account/repository/DefaultAccountsCRUDRepository.kt +++ b/data/account/src/main/kotlin/com/tangem/data/account/repository/DefaultAccountsCRUDRepository.kt @@ -24,6 +24,7 @@ import com.tangem.domain.models.account.AccountId import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.utils.coroutines.CoroutineDispatcherProvider +import com.tangem.utils.extensions.replaceBy import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.withContext @@ -109,6 +110,23 @@ internal class DefaultAccountsCRUDRepository( walletAccountsSaver.pushAndStore(userWalletId = userWallet.walletId, response = accountsResponse) } + override suspend fun saveAccount(account: Account.CryptoPortfolio) { + val store = getAccountsResponseStore(userWalletId = account.userWalletId) + + val converter = convertersContainer.createCryptoPortfolioConverter(userWalletId = account.userWalletId) + val newAccountDTO = converter.convertBack(value = account) + + store.updateData { response -> + response ?: return@updateData response + + response.copy( + accounts = response.accounts.toMutableList().apply { + replaceBy(newAccountDTO) { it.id == newAccountDTO.id } + }, + ) + } + } + override suspend fun getTotalAccountsCountSync(userWalletId: UserWalletId): Option = option { val accountListResponse = getAccountsResponseSync(userWalletId = userWalletId) diff --git a/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt b/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt index ce7c5ddb13..80b1a4577d 100644 --- a/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt +++ b/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt @@ -74,77 +74,18 @@ internal class DefaultCurrenciesRepository( userTokensSaver.storeAndPush(userWalletId, response) } - override suspend fun saveNewCurrenciesList(userWalletId: UserWalletId, currencies: List) { + override suspend fun saveCurrenciesLocal(userWalletId: UserWalletId, currencies: List) { withContext(dispatchers.io) { val savedResponse = requireNotNull( value = getSavedUserTokensResponseSync(key = userWalletId), lazyMessage = { "Saved tokens empty. Can not perform add currencies action." }, ) - val newCurrencies = populateCurrenciesWithMissedCoins(currencies) - val updatedResponse = savedResponse.copy( - tokens = newCurrencies.map(userTokensResponseFactory::createResponseToken), - ) - userTokensSaver.storeAndPush( - userWalletId = userWalletId, - response = updatedResponse, + tokens = currencies.map(userTokensResponseFactory::createResponseToken), ) - fetchExpressAssetsByNetworkIds( - userWallet = userWalletsStore.getSyncStrict(key = userWalletId), - userTokens = updatedResponse, - ) - } - } - - override suspend fun addCurrencies( - userWalletId: UserWalletId, - currencies: List, - ): List = withContext(dispatchers.io) { - val savedCurrencies = requireNotNull( - value = getSavedUserTokensResponseSync(key = userWalletId), - lazyMessage = { "Saved tokens empty. Can not perform add currencies action" }, - ) - - val currenciesToAdd = filterAlreadyAddedCurrencies( - savedCurrencies = savedCurrencies.tokens, - currenciesToAdd = populateCurrenciesWithMissedCoins(currencies = currencies), - ) - - val updatedResponse = savedCurrencies.copy( - tokens = savedCurrencies.tokens + currenciesToAdd.map(userTokensResponseFactory::createResponseToken), - ) - - userTokensSaver.storeAndPush( - userWalletId = userWalletId, - response = updatedResponse, - ) - - fetchExpressAssetsByNetworkIds( - userWallet = userWalletsStore.getSyncStrict(key = userWalletId), - userTokens = updatedResponse, - ) - - currenciesToAdd - } - - override suspend fun saveNewCurrenciesListCache(userWalletId: UserWalletId, currencies: List) { - withContext(dispatchers.io) { - val savedResponse = requireNotNull( - value = getSavedUserTokensResponseSync(key = userWalletId), - lazyMessage = { "Saved tokens empty. Can not perform add currencies action." }, - ) - - val newCurrencies = populateCurrenciesWithMissedCoins(currencies) - - val updatedResponse = savedResponse.copy( - tokens = newCurrencies.map(userTokensResponseFactory::createResponseToken), - ) - userTokensSaver.store( - userWalletId = userWalletId, - response = updatedResponse, - ) + userTokensSaver.store(userWalletId = userWalletId, response = updatedResponse) fetchExpressAssetsByNetworkIds( userWallet = userWalletsStore.getSyncStrict(key = userWalletId), @@ -551,6 +492,10 @@ internal class DefaultCurrenciesRepository( } } + override fun createCoinCurrency(network: Network): CryptoCurrency.Coin { + return cryptoCurrencyFactory.createCoin(network = network) + } + override fun createTokenCurrency(cryptoCurrency: CryptoCurrency.Token, network: Network): CryptoCurrency.Token { return cryptoCurrencyFactory.createToken( cryptoCurrency = cryptoCurrency, diff --git a/domain/account/src/main/java/com/tangem/domain/account/repository/AccountsCRUDRepository.kt b/domain/account/src/main/java/com/tangem/domain/account/repository/AccountsCRUDRepository.kt index e58992d600..5eb7a0433a 100644 --- a/domain/account/src/main/java/com/tangem/domain/account/repository/AccountsCRUDRepository.kt +++ b/domain/account/src/main/java/com/tangem/domain/account/repository/AccountsCRUDRepository.kt @@ -68,6 +68,13 @@ interface AccountsCRUDRepository { */ suspend fun saveAccounts(accountList: AccountList) + /** + * Save account + * + * @param account account to be saved + */ + suspend fun saveAccount(account: Account.CryptoPortfolio) + /** * Retrieves the total count of accounts associated with a specific user wallet including archived accounts * diff --git a/domain/account/status/build.gradle.kts b/domain/account/status/build.gradle.kts index 564baa96b8..8e2f490e75 100644 --- a/domain/account/status/build.gradle.kts +++ b/domain/account/status/build.gradle.kts @@ -24,6 +24,7 @@ dependencies { api(projects.domain.networks) api(projects.domain.staking) api(projects.domain.tokens) + api(projects.domain.wallets) implementation(projects.libs.blockchainSdk) implementation(projects.libs.crypto) diff --git a/domain/account/status/src/main/java/com/tangem/domain/account/status/di/AccountStatusUseCaseModule.kt b/domain/account/status/src/main/java/com/tangem/domain/account/status/di/AccountStatusUseCaseModule.kt index f7cab3c413..79d373768b 100644 --- a/domain/account/status/src/main/java/com/tangem/domain/account/status/di/AccountStatusUseCaseModule.kt +++ b/domain/account/status/src/main/java/com/tangem/domain/account/status/di/AccountStatusUseCaseModule.kt @@ -1,11 +1,22 @@ package com.tangem.domain.account.status.di +import com.tangem.domain.account.repository.AccountsCRUDRepository import com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier import com.tangem.domain.account.status.usecase.GetAccountCurrencyByAddressUseCase import com.tangem.domain.account.status.usecase.GetAccountCurrencyStatusUseCase +import com.tangem.domain.account.status.usecase.SaveCryptoCurrenciesUseCase import com.tangem.domain.account.supplier.SingleAccountListSupplier import com.tangem.domain.common.wallets.UserWalletsListRepository +import com.tangem.domain.networks.multi.MultiNetworkStatusFetcher import com.tangem.domain.networks.multi.MultiNetworkStatusSupplier +import com.tangem.domain.networks.utils.NetworksCleaner +import com.tangem.domain.quotes.multi.MultiQuoteStatusFetcher +import com.tangem.domain.staking.StakingIdFactory +import com.tangem.domain.staking.multi.MultiYieldBalanceFetcher +import com.tangem.domain.staking.utils.StakingCleaner +import com.tangem.domain.tokens.repository.CurrenciesRepository +import com.tangem.domain.wallets.derivations.DerivationsRepository +import com.tangem.utils.coroutines.CoroutineDispatcherProvider import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -37,4 +48,34 @@ internal object AccountStatusUseCaseModule { ): GetAccountCurrencyStatusUseCase { return GetAccountCurrencyStatusUseCase(singleAccountStatusListSupplier = singleAccountStatusListSupplier) } + + @Provides + @Singleton + fun provideSaveCryptoCurrenciesUseCase( + singleAccountListSupplier: SingleAccountListSupplier, + accountsCRUDRepository: AccountsCRUDRepository, + currenciesRepository: CurrenciesRepository, + derivationsRepository: DerivationsRepository, + multiNetworkStatusFetcher: MultiNetworkStatusFetcher, + multiQuoteStatusFetcher: MultiQuoteStatusFetcher, + multiYieldBalanceFetcher: MultiYieldBalanceFetcher, + stakingIdFactory: StakingIdFactory, + networksCleaner: NetworksCleaner, + stakingCleaner: StakingCleaner, + dispatchers: CoroutineDispatcherProvider, + ): SaveCryptoCurrenciesUseCase { + return SaveCryptoCurrenciesUseCase( + singleAccountListSupplier = singleAccountListSupplier, + accountsCRUDRepository = accountsCRUDRepository, + currenciesRepository = currenciesRepository, + derivationsRepository = derivationsRepository, + multiNetworkStatusFetcher = multiNetworkStatusFetcher, + multiQuoteStatusFetcher = multiQuoteStatusFetcher, + multiYieldBalanceFetcher = multiYieldBalanceFetcher, + stakingIdFactory = stakingIdFactory, + networksCleaner = networksCleaner, + stakingCleaner = stakingCleaner, + dispatchers = dispatchers, + ) + } } \ No newline at end of file diff --git a/domain/account/status/src/main/java/com/tangem/domain/account/status/usecase/SaveCryptoCurrenciesUseCase.kt b/domain/account/status/src/main/java/com/tangem/domain/account/status/usecase/SaveCryptoCurrenciesUseCase.kt new file mode 100644 index 0000000000..b89a3f03f5 --- /dev/null +++ b/domain/account/status/src/main/java/com/tangem/domain/account/status/usecase/SaveCryptoCurrenciesUseCase.kt @@ -0,0 +1,269 @@ +package com.tangem.domain.account.status.usecase + +import arrow.core.Either +import arrow.core.raise.Raise +import arrow.core.raise.catch +import com.tangem.domain.account.producer.SingleAccountListProducer +import com.tangem.domain.account.repository.AccountsCRUDRepository +import com.tangem.domain.account.supplier.SingleAccountListSupplier +import com.tangem.domain.core.utils.eitherOn +import com.tangem.domain.models.account.Account +import com.tangem.domain.models.account.AccountId +import com.tangem.domain.models.currency.CryptoCurrency +import com.tangem.domain.models.network.Network +import com.tangem.domain.models.wallet.UserWalletId +import com.tangem.domain.networks.multi.MultiNetworkStatusFetcher +import com.tangem.domain.networks.utils.NetworksCleaner +import com.tangem.domain.quotes.multi.MultiQuoteStatusFetcher +import com.tangem.domain.staking.StakingIdFactory +import com.tangem.domain.staking.multi.MultiYieldBalanceFetcher +import com.tangem.domain.staking.utils.StakingCleaner +import com.tangem.domain.tokens.repository.CurrenciesRepository +import com.tangem.domain.wallets.derivations.DerivationsRepository +import com.tangem.utils.coroutines.CoroutineDispatcherProvider +import kotlinx.coroutines.* +import timber.log.Timber + +/** + * Use case for saving crypto currencies to a specific account. + * + * @property singleAccountListSupplier Supplier to get account details. + * @property currenciesRepository Repository for managing currencies. + * @property derivationsRepository Repository for deriving public keys. + * @property multiNetworkStatusFetcher Fetcher for updating network statuses. + * @property multiQuoteStatusFetcher Fetcher for updating quote statuses. + * @property multiYieldBalanceFetcher Fetcher for updating yield balances. + * @property stakingIdFactory Factory for creating staking IDs. + * @property networksCleaner Cleaner for removing obsolete network data. + * @property stakingCleaner Cleaner for removing obsolete staking data. + * @property dispatchers Coroutine dispatchers for managing threading. + * +[REDACTED_AUTHOR] + */ +@Suppress("LongParameterList") +class SaveCryptoCurrenciesUseCase( + private val singleAccountListSupplier: SingleAccountListSupplier, + private val accountsCRUDRepository: AccountsCRUDRepository, + private val currenciesRepository: CurrenciesRepository, + private val derivationsRepository: DerivationsRepository, + private val multiNetworkStatusFetcher: MultiNetworkStatusFetcher, + private val multiQuoteStatusFetcher: MultiQuoteStatusFetcher, + private val multiYieldBalanceFetcher: MultiYieldBalanceFetcher, + private val stakingIdFactory: StakingIdFactory, + private val networksCleaner: NetworksCleaner, + private val stakingCleaner: StakingCleaner, + private val dispatchers: CoroutineDispatcherProvider, +) { + + suspend operator fun invoke( + accountId: AccountId, + add: List, + remove: List, + ): Either = eitherOn(dispatchers.default) { + if (add.isEmpty() && remove.isEmpty()) { + Timber.d("No currencies to add or remove, skipping") + return@eitherOn + } + + val userWalletId = accountId.userWalletId + withContext(NonCancellable) { + val account = getAccount(accountId = accountId) + + val modifiedCurrencyList = account.cryptoCurrencies.modify(add = add, remove = remove) + + saveAccount( + account = account.copy(cryptoCurrencies = modifiedCurrencyList.total.toSet()), + ) + + derivePublicKeys(userWalletId = userWalletId, currencies = modifiedCurrencyList.added) + + val jobs = refreshBalances(userWalletId = userWalletId, currencies = modifiedCurrencyList.added) + + clearMetadata(userWalletId = userWalletId, currencies = modifiedCurrencyList.removed) + + jobs.joinAll() + } + } + + private suspend fun Raise.getAccount(accountId: AccountId): Account.CryptoPortfolio { + val accountList = singleAccountListSupplier.getSyncOrNull( + params = SingleAccountListProducer.Params(userWalletId = accountId.userWalletId), + ) ?: raise(IllegalStateException("No accounts for wallet ${accountId.userWalletId}")) + + return accountList.accounts.firstOrNull { it.accountId == accountId } as? Account.CryptoPortfolio + ?: raise(IllegalStateException("No account with id $accountId")) + } + + private fun Set.modify( + add: List, + remove: List, + ): ModifiedCurrencyList { + val mutableCurrencies = this.toMutableList() + val added = mutableListOf() + val removed = mutableListOf() + + val existingCurrenciesById = mutableCurrencies.associateBy(::TempID) + + add.groupByNetwork { !existingCurrenciesById.containsKey(it) } + .forEach { (network, currenciesById) -> + val coinTempId = TempID(network) + + if (!existingCurrenciesById.containsKey(coinTempId)) { + val coin = currenciesById[coinTempId] + + if (coin != null) { + mutableCurrencies.add(coin) + added.add(coin) + + currenciesById.remove(coinTempId) + } else { + val createdCoin = currenciesRepository.createCoinCurrency(network) + mutableCurrencies.add(createdCoin) + added.add(createdCoin) + } + } + + mutableCurrencies.addAll(currenciesById.values) + added.addAll(currenciesById.values) + } + + remove.groupByNetwork(valuePredicate = existingCurrenciesById::containsKey) + .forEach { (network, currenciesById) -> + val coinTempId = TempID(network) + + if (currenciesById.containsKey(coinTempId)) { + val existingNetworkCurrenciesCount = mutableCurrencies.count { it.network == network } + + if (existingNetworkCurrenciesCount != currenciesById.size) { + return@forEach + } + } + + mutableCurrencies.removeAll(currenciesById.values) + removed.addAll(currenciesById.values) + } + + return ModifiedCurrencyList(added = added, removed = removed, total = mutableCurrencies) + } + + private suspend fun Raise.saveAccount(account: Account.CryptoPortfolio) { + catch( + block = { accountsCRUDRepository.saveAccount(account) }, + catch = ::raise, + ) + } + + private suspend fun Raise.derivePublicKeys( + userWalletId: UserWalletId, + currencies: List, + ) { + catch( + block = { derivationsRepository.derivePublicKeys(userWalletId = userWalletId, currencies = currencies) }, + catch = ::raise, + ) + } + + private fun List.groupByNetwork( + valuePredicate: (TempID) -> Boolean, + ): LinkedHashMap> { + val destination = LinkedHashMap>() + + for (currency in this) { + val key = currency.network + val mutableMap = destination.getOrPut(key) { mutableMapOf() } + + val id = TempID(currency) + + if (valuePredicate(id)) { + mutableMap.put(id, currency) + } + } + + return destination + } + + private suspend fun refreshBalances(userWalletId: UserWalletId, currencies: List): List { + if (currencies.isEmpty()) return emptyList() + + return coroutineScope { + listOf( + launch { refreshNetworks(userWalletId = userWalletId, currencies = currencies) }, + launch { refreshYieldBalances(userWalletId = userWalletId, currencies = currencies) }, + launch { refreshQuotes(currencies = currencies) }, + ) + } + } + + private suspend fun refreshNetworks(userWalletId: UserWalletId, currencies: List) { + multiNetworkStatusFetcher( + params = MultiNetworkStatusFetcher.Params( + userWalletId = userWalletId, + networks = currencies.mapTo(hashSetOf(), CryptoCurrency::network), + ), + ) + + currenciesRepository.syncTokens(userWalletId) + } + + private suspend fun refreshYieldBalances(userWalletId: UserWalletId, currencies: List) { + val stakingIds = currencies.mapNotNullTo(hashSetOf()) { + stakingIdFactory.create(userWalletId = userWalletId, cryptoCurrency = it).getOrNull() + } + + multiYieldBalanceFetcher( + params = MultiYieldBalanceFetcher.Params(userWalletId = userWalletId, stakingIds = stakingIds), + ) + } + + private suspend fun refreshQuotes(currencies: List) { + multiQuoteStatusFetcher( + params = MultiQuoteStatusFetcher.Params( + currenciesIds = currencies.mapNotNullTo(hashSetOf()) { it.id.rawCurrencyId }, + appCurrencyId = null, + ), + ) + } + + private suspend fun clearMetadata(userWalletId: UserWalletId, currencies: List): List { + if (currencies.isEmpty()) return emptyList() + + return coroutineScope { + listOf( + launch { networksCleaner(userWalletId = userWalletId, currencies = currencies) }, + launch { clearStaking(userWalletId = userWalletId, currencies = currencies) }, + ) + } + } + + private suspend fun clearStaking(userWalletId: UserWalletId, currencies: List) { + val stakingIds = currencies.mapNotNullTo(hashSetOf()) { + stakingIdFactory.create(userWalletId = userWalletId, cryptoCurrency = it).getOrNull() + } + + stakingCleaner(userWalletId = userWalletId, stakingIds = stakingIds) + } + + private data class TempID( + val networkId: String, + val derivationPath: Network.DerivationPath, + val contractAddress: String?, + ) { + + constructor(network: Network) : this( + networkId = network.backendId, + derivationPath = network.derivationPath, + contractAddress = null, + ) + + constructor(currency: CryptoCurrency) : this( + networkId = currency.network.backendId, + derivationPath = currency.network.derivationPath, + contractAddress = (currency as? CryptoCurrency.Token)?.contractAddress, + ) + } + + private data class ModifiedCurrencyList( + val added: List, + val removed: List, + val total: List, + ) +} \ No newline at end of file diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/account/Account.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/account/Account.kt index d3962fbd50..4b0f60f75a 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/account/Account.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/account/Account.kt @@ -57,13 +57,17 @@ sealed interface Account { val networksCount: Int get() = cryptoCurrencies.map(CryptoCurrency::network).distinct().size - fun copy(accountName: AccountName = this.accountName, icon: CryptoPortfolioIcon = this.icon): CryptoPortfolio { + fun copy( + accountName: AccountName = this.accountName, + icon: CryptoPortfolioIcon = this.icon, + cryptoCurrencies: Set = this.cryptoCurrencies, + ): CryptoPortfolio { return CryptoPortfolio( accountId = this.accountId, accountName = accountName, icon = icon, derivationIndex = this.derivationIndex, - cryptoCurrencies = this.cryptoCurrencies, + cryptoCurrencies = cryptoCurrencies, ) } diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt index 6dd77dfdc2..826fb686d5 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt @@ -40,26 +40,7 @@ interface CurrenciesRepository { * @param userWalletId The unique identifier of the user wallet. * @param currencies The list of cryptocurrencies to be saved. */ - suspend fun saveNewCurrenciesList(userWalletId: UserWalletId, currencies: List) - - /** - * Add currencies to a specific user wallet. - * - * @param userWalletId The unique identifier of the user wallet. - * @param currencies The currencies which must be added. - * @throws DataError.UserWalletError.WrongUserWallet If single-currency user wallet - * ID provided. - */ - suspend fun addCurrencies(userWalletId: UserWalletId, currencies: List): List - - /** - * Saves the given list of cryptocurrencies for a specific multi-currency user wallet. - * - * @param userWalletId The unique identifier of the user wallet. - * @param currencies The list of cryptocurrencies to be saved. - */ - @Deprecated("Tech debt") - suspend fun saveNewCurrenciesListCache(userWalletId: UserWalletId, currencies: List) + suspend fun saveCurrenciesLocal(userWalletId: UserWalletId, currencies: List) /** * Add currencies to a specific user wallet. @@ -256,6 +237,8 @@ interface CurrenciesRepository { */ suspend fun getFeePaidCurrency(userWalletId: UserWalletId, network: Network): FeePaidCurrency + fun createCoinCurrency(network: Network): CryptoCurrency.Coin + /** * Creates token [cryptoCurrency] based on current token and [network] it`s will be added */ diff --git a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt index 8a0f5fa136..c4459c749e 100644 --- a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt +++ b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt @@ -46,14 +46,7 @@ internal class MockCurrenciesRepository( isTokensSortedByBalanceAfterSortingApply = isSortedByBalance } - override suspend fun saveNewCurrenciesList(userWalletId: UserWalletId, currencies: List) = Unit - - override suspend fun addCurrencies( - userWalletId: UserWalletId, - currencies: List, - ): List = emptyList() - - override suspend fun saveNewCurrenciesListCache(userWalletId: UserWalletId, currencies: List) = Unit + override suspend fun saveCurrenciesLocal(userWalletId: UserWalletId, currencies: List) = Unit override suspend fun addCurrenciesCache( userWalletId: UserWalletId, @@ -152,6 +145,10 @@ internal class MockCurrenciesRepository( return FeePaidCurrency.Coin } + override fun createCoinCurrency(network: Network): CryptoCurrency.Coin { + error("not implemented") + } + override fun createTokenCurrency(cryptoCurrency: CryptoCurrency.Token, network: Network): CryptoCurrency.Token { return cryptoCurrency }