Updated on 2026-08-14

This commit is contained in:
Tangem 2023-11-28 21:35:56 +03:00
commit 0cccb75424
4 changed files with 1 additions and 33 deletions

View file

@ -381,7 +381,6 @@ internal class DefaultCurrenciesRepository(
) {
try {
val tokensList = userTokens.tokens
.distinctBy { it.networkId }
.map {
LeastTokenInfo(
contractAddress = it.contractAddress ?: EMPTY_CONTRACT_ADDRESS_VALUE,

View file

@ -3,14 +3,11 @@ package com.tangem.feature.swap.domain
import arrow.core.getOrElse
import com.tangem.blockchain.common.transaction.Fee
import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.domain.tokens.AddCryptoCurrenciesUseCase
import com.tangem.domain.tokens.GetCryptoCurrencyStatusesSyncUseCase
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.domain.tokens.model.Network
import com.tangem.domain.tokens.model.Quote
import com.tangem.domain.tokens.repository.CurrenciesRepository
import com.tangem.domain.tokens.repository.NetworksRepository
import com.tangem.domain.tokens.repository.QuotesRepository
import com.tangem.domain.tokens.utils.convertToAmount
import com.tangem.domain.transaction.error.SendTransactionError
@ -27,7 +24,6 @@ import com.tangem.feature.swap.domain.models.data.AggregatedSwapDataModel
import com.tangem.feature.swap.domain.models.domain.*
import com.tangem.feature.swap.domain.models.toStringWithRightOffset
import com.tangem.feature.swap.domain.models.ui.*
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
import com.tangem.lib.crypto.TransactionManager
import com.tangem.lib.crypto.UserWalletManager
import com.tangem.lib.crypto.models.*
@ -48,9 +44,6 @@ internal class SwapInteractorImpl @Inject constructor(
private val repository: SwapRepository,
private val cache: SwapDataCache,
private val allowPermissionsHandler: AllowPermissionsHandler,
private val currenciesRepository: CurrenciesRepository,
private val networksRepository: NetworksRepository,
private val walletFeatureToggles: WalletFeatureToggles,
private val getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase,
private val getMultiCryptoCurrencyStatusUseCase: GetCryptoCurrencyStatusesSyncUseCase,
private val walletManagersFacade: WalletManagersFacade,
@ -59,11 +52,6 @@ internal class SwapInteractorImpl @Inject constructor(
private val dispatcher: CoroutineDispatcherProvider,
) : SwapInteractor {
// TODO: Move to DI
private val addCryptoCurrenciesUseCase by lazy(LazyThreadSafetyMode.NONE) {
AddCryptoCurrenciesUseCase(currenciesRepository, networksRepository)
}
private val getFeeUseCase by lazy(LazyThreadSafetyMode.NONE) {
GetFeeUseCase(walletManagersFacade, dispatcher)
}
@ -535,12 +523,6 @@ internal class SwapInteractorImpl @Inject constructor(
derivationPath,
) ?: "",
)
TxState.TxSent(
txAddress = userWalletManager.getLastTransactionHash(
networkId = currencyToSend.currency.network.backendId,
derivationPath = derivationPath,
) ?: "",
)
},)
}

View file

@ -35,9 +35,6 @@ class SwapDomainModule {
swapRepository: SwapRepository,
userWalletManager: UserWalletManager,
transactionManager: TransactionManager,
currenciesRepository: CurrenciesRepository,
networksRepository: NetworksRepository,
walletFeatureToggles: WalletFeatureToggles,
@SwapScope getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase,
@SwapScope getCryptoCurrencyStatusUseCase: GetCryptoCurrencyStatusesSyncUseCase,
@SwapScope sendTransactionUseCase: SendTransactionUseCase,
@ -51,9 +48,6 @@ class SwapDomainModule {
repository = swapRepository,
cache = SwapDataCacheImpl(),
allowPermissionsHandler = AllowPermissionsHandlerImpl(),
currenciesRepository = currenciesRepository,
networksRepository = networksRepository,
walletFeatureToggles = walletFeatureToggles,
getSelectedWalletSyncUseCase = getSelectedWalletSyncUseCase,
getMultiCryptoCurrencyStatusUseCase = getCryptoCurrencyStatusUseCase,
sendTransactionUseCase = sendTransactionUseCase,

View file

@ -788,14 +788,7 @@ internal class SwapViewModel @Inject constructor(
}
private fun getUnavailableProvidersFor(state: Map<SwapProvider, SwapState>): List<SwapProvider> {
return getAllProviders()
.mapNotNull {
if (state.containsKey(it)) {
null
} else {
it
}
}
return getAllProviders().filterNot { it in state }
}
companion object {