Updated on 2026-08-14

This commit is contained in:
Tangem 2025-06-28 11:55:20 +04:00
parent 58c6eeac8c
commit 288bddfe18
13 changed files with 52 additions and 51 deletions

View file

@ -1,6 +1,6 @@
package com.tangem.data.swap
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
import com.tangem.data.common.currency.ResponseCryptoCurrenciesFactory
import com.tangem.data.common.currency.UserTokensResponseFactory
import com.tangem.data.swap.converter.transaction.SavedSwapStatusConverter
import com.tangem.data.swap.converter.transaction.SavedSwapTransactionConverter
@ -31,15 +31,15 @@ import kotlinx.coroutines.withContext
internal class DefaultSwapTransactionRepository(
private val appPreferencesStore: AppPreferencesStore,
private val responseCryptoCurrenciesFactory: ResponseCryptoCurrenciesFactory,
private val dispatchers: CoroutineDispatcherProvider,
excludedBlockchains: ExcludedBlockchains,
) : SwapTransactionRepository {
private val listConverter by lazy(LazyThreadSafetyMode.NONE) {
SavedSwapTransactionListConverter(excludedBlockchains)
SavedSwapTransactionListConverter(responseCryptoCurrenciesFactory = responseCryptoCurrenciesFactory)
}
private val converter by lazy(LazyThreadSafetyMode.NONE) {
SavedSwapTransactionConverter(excludedBlockchains)
SavedSwapTransactionConverter(responseCryptoCurrenciesFactory = responseCryptoCurrenciesFactory)
}
private val savedStatusConverter by lazy(LazyThreadSafetyMode.NONE) {
SavedSwapStatusConverter()

View file

@ -1,6 +1,5 @@
package com.tangem.data.swap.converter.transaction
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
import com.tangem.data.common.currency.ResponseCryptoCurrenciesFactory
import com.tangem.data.swap.models.SwapStatusDTO
import com.tangem.data.swap.models.SwapTransactionDTO
@ -9,9 +8,9 @@ import com.tangem.domain.swap.models.SwapTransactionModel
import com.tangem.utils.converter.TwoWayConverter
internal class SavedSwapTransactionConverter(
excludedBlockchains: ExcludedBlockchains,
private val responseCryptoCurrenciesFactory: ResponseCryptoCurrenciesFactory,
) : TwoWayConverter<SwapTransactionModel, SwapTransactionDTO> {
private val responseCryptoCurrenciesFactory = ResponseCryptoCurrenciesFactory(excludedBlockchains)
private val statusConverter by lazy(LazyThreadSafetyMode.NONE) {
SavedSwapStatusConverter()
}

View file

@ -1,6 +1,5 @@
package com.tangem.data.swap.converter.transaction
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
import com.tangem.data.common.currency.ResponseCryptoCurrenciesFactory
import com.tangem.data.common.currency.UserTokensResponseFactory
import com.tangem.data.swap.models.SwapStatusDTO
@ -13,13 +12,12 @@ import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.utils.converter.Converter
internal class SavedSwapTransactionListConverter(
excludedBlockchains: ExcludedBlockchains,
private val responseCryptoCurrenciesFactory: ResponseCryptoCurrenciesFactory,
) : Converter<SwapTransactionListModel, SwapTransactionListDTO> {
private val responseCryptoCurrenciesFactory = ResponseCryptoCurrenciesFactory(excludedBlockchains)
private val userTokensResponseFactory = UserTokensResponseFactory()
private val savedSwapTransactionConverter by lazy(LazyThreadSafetyMode.NONE) {
SavedSwapTransactionConverter(excludedBlockchains)
SavedSwapTransactionConverter(responseCryptoCurrenciesFactory = responseCryptoCurrenciesFactory)
}
override fun convert(value: SwapTransactionListModel) = SwapTransactionListDTO(

View file

@ -1,7 +1,7 @@
package com.tangem.data.swap.di
import com.squareup.moshi.Moshi
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
import com.tangem.data.common.currency.ResponseCryptoCurrenciesFactory
import com.tangem.data.express.converter.ExpressErrorConverter
import com.tangem.data.swap.DefaultSwapErrorResolver
import com.tangem.data.swap.DefaultSwapRepositoryV2
@ -56,14 +56,14 @@ internal object SwapDataModule {
@Provides
@Singleton
fun provideSwapTransactionRepository(
coroutineDispatcher: CoroutineDispatcherProvider,
appPreferencesStore: AppPreferencesStore,
excludedBlockchains: ExcludedBlockchains,
responseCryptoCurrenciesFactory: ResponseCryptoCurrenciesFactory,
dispatchers: CoroutineDispatcherProvider,
): SwapTransactionRepository {
return DefaultSwapTransactionRepository(
appPreferencesStore = appPreferencesStore,
dispatchers = coroutineDispatcher,
excludedBlockchains = excludedBlockchains,
responseCryptoCurrenciesFactory = responseCryptoCurrenciesFactory,
dispatchers = dispatchers,
)
}
}