Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-08 16:54:08 +02:00
parent 5d7aef4c6b
commit bec0253e6f
3 changed files with 6 additions and 32 deletions

View file

@ -1,31 +0,0 @@
package com.tangem.tap.network.auth
import com.tangem.datasource.config.ConfigManager
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.lib.auth.ExpressAuthProvider
import com.tangem.lib.auth.sessionId.ExpressSessionIdGenerator
import java.util.UUID
class ExpressAuthProviderImpl(
private val userWalletsStore: UserWalletsStore,
private val configManager: ConfigManager,
) : ExpressAuthProvider, ExpressSessionIdGenerator {
private var uuid = UUID.randomUUID()
override fun getApiKey(): String {
return configManager.config.tangemExpressApiKey
}
override fun getUserId(): String {
return userWalletsStore.selectedUserWalletOrNull?.walletId?.stringValue ?: ""
}
override fun getSessionId(): String {
return uuid.toString()
}
override fun generateNewSessionId() {
uuid = UUID.randomUUID()
}
}

View file

@ -11,6 +11,10 @@ class DefaultMarketCryptoCurrencyRepository(
) : MarketCryptoCurrencyRepository {
override suspend fun isExchangeable(userWalletId: UserWalletId, cryptoCurrency: CryptoCurrency): Boolean {
return getExchangeableFlag(userWalletId, cryptoCurrency) && !cryptoCurrency.isCustom
}
private suspend fun getExchangeableFlag(userWalletId: UserWalletId, cryptoCurrency: CryptoCurrency): Boolean {
val contractAddress = (cryptoCurrency as? CryptoCurrency.Token)?.contractAddress ?: EMPTY_CONTRACT_ADDRESS_VALUE
return assetsStore.getSyncOrNull(userWalletId)?.find {

View file

@ -79,7 +79,8 @@ internal class SwapInteractorImpl @Inject constructor(
val currencyFilter = it.currency.network.backendId != currency.network.backendId ||
it.currency.getContractAddress() != currency.getContractAddress()
val statusFilter = it.value is CryptoCurrencyStatus.Loaded
statusFilter && currencyFilter
val notCustomTokenFilter = !it.currency.isCustom
statusFilter && currencyFilter && notCustomTokenFilter
}
if (walletCurrencyStatusesExceptInitial.isEmpty()) {