From fa1a34efa97b57dfebf1305540e467ff4d61136f Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 6 Dec 2023 18:35:00 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../repository/DefaultCurrenciesRepository.kt | 1 - .../tokens/GetCryptoCurrencyActionsUseCase.kt | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) 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 038d1678cf..d927d3e04e 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 @@ -399,7 +399,6 @@ internal class DefaultCurrenciesRepository( assetsStore.store(userWalletId, response.getOrThrow()) } - } catch (e: Throwable) { Timber.e(e, "Unable to fetch assets for: ${userWalletId.stringValue}") } diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt index b0f110d438..87dee2d3d9 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCryptoCurrencyActionsUseCase.kt @@ -1,5 +1,6 @@ package com.tangem.domain.tokens +import com.tangem.domain.common.CardTypesResolver import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.exchange.RampStateManager import com.tangem.domain.tokens.model.CryptoCurrency @@ -55,6 +56,7 @@ class GetCryptoCurrencyActionsUseCase( userWalletId = userWallet.walletId, coinStatus = maybeCoinStatus.getOrNull(), cryptoCurrencyStatus = cryptoCurrencyStatus, + cardTypesResolver = userWallet.scanResponse.cardTypesResolver, ) } @@ -66,11 +68,17 @@ class GetCryptoCurrencyActionsUseCase( userWalletId: UserWalletId, coinStatus: CryptoCurrencyStatus?, cryptoCurrencyStatus: CryptoCurrencyStatus, + cardTypesResolver: CardTypesResolver, ): TokenActionsState { return TokenActionsState( walletId = userWalletId, cryptoCurrencyStatus = cryptoCurrencyStatus, - states = createListOfActions(userWalletId, coinStatus, cryptoCurrencyStatus), + states = createListOfActions( + userWalletId, + coinStatus, + cryptoCurrencyStatus, + cardTypesResolver, + ), ) } @@ -82,6 +90,7 @@ class GetCryptoCurrencyActionsUseCase( userWalletId: UserWalletId, coinStatus: CryptoCurrencyStatus?, cryptoCurrencyStatus: CryptoCurrencyStatus, + cardTypesResolver: CardTypesResolver, ): List { val cryptoCurrency = cryptoCurrencyStatus.currency if (cryptoCurrencyStatus.value is CryptoCurrencyStatus.MissedDerivation) { @@ -107,8 +116,11 @@ class GetCryptoCurrencyActionsUseCase( activeList.add(TokenActionsState.ActionState.Send(true)) } + val isMulticurrencyWallet = cardTypesResolver.isTangemWallet() || cardTypesResolver.isWallet2() // swap - if (marketCryptoCurrencyRepository.isExchangeable(userWalletId, cryptoCurrency)) { + if (isMulticurrencyWallet && + marketCryptoCurrencyRepository.isExchangeable(userWalletId, cryptoCurrency) + ) { activeList.add(TokenActionsState.ActionState.Swap(true)) } else { disabledList.add(TokenActionsState.ActionState.Swap(false))