From a363d4d4760126b0d5d442b265a0f0e67a82d02b Mon Sep 17 00:00:00 2001 From: Tangem Date: Sun, 7 Jul 2024 19:05:03 +0100 Subject: [PATCH] Updated on 2026-08-14 --- .../domain/models/domain/SavedSwapTransactionListModel.kt | 1 + .../feature/swap/domain/models/domain/SwapPairLeast.kt | 5 ++++- .../com/tangem/feature/swap/domain/SwapInteractorImpl.kt | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt index 3eb907948a..d771aa4ecb 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt @@ -26,6 +26,7 @@ data class SavedSwapTransactionListModelInner( val transactions: List, ) +// TODO refactor to use separate models to store data class SavedSwapTransactionModel( val txId: String, val timestamp: Long, diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt index 4314fe1c81..9e82c4a39f 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt @@ -26,6 +26,9 @@ data class CryptoCurrencySwapInfo( * @property providerId provider id * @property rateTypes supported rate types * @property isRecommended flag that indicates if this provider is recommended + * + * Uses to store transaction data in datastore, when extends - should always add default value + * to support backward compatibility */ data class SwapProvider( val providerId: String, @@ -35,7 +38,7 @@ data class SwapProvider( val imageLarge: String, val termsOfUse: String?, val privacyPolicy: String?, - val isRecommended: Boolean, + val isRecommended: Boolean = false, ) enum class ExchangeProviderType(val providerName: String) { diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt index eb1639b60d..df53e5e0e7 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt @@ -896,8 +896,9 @@ internal class SwapInteractorImpl @Inject constructor( txExternalUrl: String? = null, txExternalId: String? = null, ) { + val selectedWallet = getSelectedWallet() ?: return swapTransactionRepository.storeTransaction( - userWalletId = UserWalletId(userWalletManager.getWalletId()), + userWalletId = selectedWallet.walletId, fromCryptoCurrency = currencyToSend.currency, toCryptoCurrency = currencyToGet.currency, transaction = SavedSwapTransactionModel(