Updated on 2026-08-14
This commit is contained in:
parent
ba9113019a
commit
0bd68de818
5 changed files with 32 additions and 2 deletions
|
|
@ -27,6 +27,14 @@
|
|||
"name": "NFT_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "NFT_EVM_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "NFT_SOLANA_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "STAKING_CARDANO_ENABLED",
|
||||
"version": "undefined"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ dependencies {
|
|||
implementation(projects.domain.legacy)
|
||||
implementation(projects.libs.blockchainSdk)
|
||||
|
||||
/** Feature Api modules */
|
||||
implementation(projects.features.nft.api)
|
||||
|
||||
/** Libs - Other */
|
||||
implementation(deps.kotlin.coroutines)
|
||||
implementation(deps.arrow.core)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.tangem.domain.nft.repository.NFTRepository
|
|||
import com.tangem.domain.tokens.model.Network
|
||||
import com.tangem.domain.walletmanager.WalletManagersFacade
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.features.nft.NFTFeatureToggles
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import com.tangem.utils.coroutines.JobHolder
|
||||
import com.tangem.utils.coroutines.saveIn
|
||||
|
|
@ -34,7 +35,7 @@ import javax.inject.Inject
|
|||
import com.tangem.blockchain.nft.models.NFTAsset as SdkNFTAsset
|
||||
import com.tangem.blockchain.nft.models.NFTCollection as SdkNFTCollection
|
||||
|
||||
@Suppress("LargeClass")
|
||||
@Suppress("LargeClass", "LongParameterList")
|
||||
internal class DefaultNFTRepository @Inject constructor(
|
||||
private val nftPersistenceStoreFactory: NFTPersistenceStoreFactory,
|
||||
private val nftRuntimeStoreFactory: NFTRuntimeStoreFactory,
|
||||
|
|
@ -42,6 +43,7 @@ internal class DefaultNFTRepository @Inject constructor(
|
|||
private val dispatchers: CoroutineDispatcherProvider,
|
||||
private val excludedBlockchains: ExcludedBlockchains,
|
||||
private val userWalletsStore: UserWalletsStore,
|
||||
private val nftFeatureToggles: NFTFeatureToggles,
|
||||
) : NFTRepository {
|
||||
|
||||
private val networkJobs = ConcurrentHashMap<Network, JobHolder>()
|
||||
|
|
@ -479,5 +481,14 @@ internal class DefaultNFTRepository @Inject constructor(
|
|||
return walletId.stringValue + "_" + network.id.value + "_" + network.derivationPath.value
|
||||
}
|
||||
|
||||
private fun Network.canHandleNFTs(): Boolean = Blockchain.fromNetworkId(backendId)?.canHandleNFTs() == true
|
||||
private fun Network.canHandleNFTs(): Boolean {
|
||||
val blockchain = Blockchain.fromNetworkId(backendId)
|
||||
return when {
|
||||
blockchain == null -> false
|
||||
blockchain.isEvm() && !nftFeatureToggles.isNFTEVMEnabled -> false
|
||||
(blockchain == Blockchain.Solana || blockchain == Blockchain.SolanaTestnet) &&
|
||||
!nftFeatureToggles.isNFTSolanaEnabled -> false
|
||||
else -> blockchain.canHandleNFTs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,4 +2,6 @@ package com.tangem.features.nft
|
|||
|
||||
interface NFTFeatureToggles {
|
||||
val isNFTEnabled: Boolean
|
||||
val isNFTEVMEnabled: Boolean
|
||||
val isNFTSolanaEnabled: Boolean
|
||||
}
|
||||
|
|
@ -7,4 +7,10 @@ internal class DefaultNFTFeatureToggles(
|
|||
) : NFTFeatureToggles {
|
||||
override val isNFTEnabled: Boolean
|
||||
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_ENABLED")
|
||||
|
||||
override val isNFTEVMEnabled: Boolean
|
||||
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_EVM_ENABLED")
|
||||
|
||||
override val isNFTSolanaEnabled: Boolean
|
||||
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_SOLANA_ENABLED")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue