Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-06 11:13:07 +04:00
parent 9f2b2eac71
commit 5463c87ff0
16 changed files with 11 additions and 295 deletions

View file

@ -1,28 +0,0 @@
package com.tangem.domain.managetokens
import arrow.core.Either
import com.tangem.domain.managetokens.model.ManagedCryptoCurrency
import com.tangem.domain.managetokens.repository.ManageTokensRepository
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.wallet.UserWalletId
class CheckHasLinkedTokensUseCase(
private val repository: ManageTokensRepository,
) {
suspend operator fun invoke(
userWalletId: UserWalletId,
network: Network,
tempAddedTokens: Map<ManagedCryptoCurrency.Token, Set<Network>>,
tempRemovedTokens: Map<ManagedCryptoCurrency.Token, Set<Network>>,
): Either<Throwable, Boolean> {
return Either.catch {
repository.hasLinkedTokens(
userWalletId = userWalletId,
network = network,
tempAddedTokens = tempAddedTokens,
tempRemovedTokens = tempRemovedTokens,
)
}
}
}

View file

@ -1,25 +0,0 @@
package com.tangem.domain.managetokens
import arrow.core.Either
import com.tangem.domain.managetokens.repository.CustomTokensRepository
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.wallet.UserWalletId
class CheckIsCurrencyNotAddedUseCase(
private val repository: CustomTokensRepository,
) {
suspend operator fun invoke(
userWalletId: UserWalletId,
networkId: Network.ID,
derivationPath: Network.DerivationPath,
contractAddress: String?,
): Either<Throwable, Boolean> = Either.catch {
repository.isCurrencyNotAdded(
userWalletId = userWalletId,
networkId = networkId,
derivationPath = derivationPath,
contractAddress = contractAddress,
)
}
}

View file

@ -10,13 +10,6 @@ interface CustomTokensRepository {
suspend fun validateContractAddress(contractAddress: String, networkId: Network.ID): Boolean
suspend fun isCurrencyNotAdded(
userWalletId: UserWalletId,
networkId: Network.ID,
derivationPath: Network.DerivationPath,
contractAddress: String?,
): Boolean
suspend fun findToken(
userWalletId: UserWalletId,
contractAddress: String,

View file

@ -4,7 +4,6 @@ import com.tangem.domain.managetokens.model.CurrencyUnsupportedState
import com.tangem.domain.managetokens.model.ManageTokensListBatchFlow
import com.tangem.domain.managetokens.model.ManageTokensListBatchingContext
import com.tangem.domain.managetokens.model.ManagedCryptoCurrency
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.wallet.UserWalletId
interface ManageTokensRepository {
@ -15,13 +14,6 @@ interface ManageTokensRepository {
batchSize: Int,
): ManageTokensListBatchFlow
suspend fun hasLinkedTokens(
userWalletId: UserWalletId,
network: Network,
tempAddedTokens: Map<ManagedCryptoCurrency.Token, Set<Network>>,
tempRemovedTokens: Map<ManagedCryptoCurrency.Token, Set<Network>>,
): Boolean
suspend fun checkCurrencyUnsupportedState(
userWalletId: UserWalletId,
sourceNetwork: ManagedCryptoCurrency.SourceNetwork,

View file

@ -7,7 +7,6 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.tokens.model.FeePaidCurrency
import kotlinx.coroutines.flow.Flow
/**
* Repository for everything related to the tokens of user wallet
@ -15,18 +14,6 @@ import kotlinx.coroutines.flow.Flow
@Suppress("TooManyFunctions")
interface CurrenciesRepository {
/**
* Retrieves the list of cryptocurrencies within a user wallet.
*
* This method returns a list of cryptocurrencies associated with the user wallet regardless of whether
* it is a multi-currency or single-currency wallet.
*
* @param userWalletId The unique identifier of the user wallet.
* @return A list of [CryptoCurrency].
*/
@Deprecated("Use MultiWalletCryptoCurrenciesSupplier")
fun getWalletCurrenciesUpdates(userWalletId: UserWalletId): Flow<List<CryptoCurrency>>
/**
* Retrieves the primary cryptocurrency for a specific single-currency user wallet.
*