diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NftAdapterManager.kt b/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NftAdapterManager.kt index 4bef4ba2c6..6de99d731e 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NftAdapterManager.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NftAdapterManager.kt @@ -46,7 +46,7 @@ class NftAdapterManager( @Synchronized private fun initAdapters(wallets: List) { - val currentAdapters = adaptersMap.toMap() + val currentAdapters = adaptersMap.toMutableMap() adaptersMap.clear() val nftKeys = wallets.map { NftKey(it.account, it.token.blockchainType) }.distinct() @@ -54,7 +54,7 @@ class NftAdapterManager( for (nftKey in nftKeys) { if (nftKey.blockchainType.supportedNftTypes.isEmpty()) continue - val adapter = currentAdapters[nftKey] + val adapter = currentAdapters.remove(nftKey) if (adapter != null) { adaptersMap[nftKey] = adapter @@ -70,6 +70,10 @@ class NftAdapterManager( } } + currentAdapters.forEach { (nftKey, _) -> + evmBlockchainManager.getEvmKitManager(nftKey.blockchainType).unlink(nftKey.account) + } + _adaptersUpdatedFlow.update { adaptersMap.toMap() } } } \ No newline at end of file diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftFragment.kt index f98acae8cc..8cce525ddc 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftFragment.kt @@ -89,18 +89,13 @@ private fun getFactory(nftUidString: String): SendNftModule.Factory? { val evmNftRecord = (nftRecord as? EvmNftRecord) ?: return null - val evmKitWrapper = App.evmBlockchainManager - .getEvmKitManager(nftUid.blockchainType) - .getEvmKitWrapper(account, nftUid.blockchainType) - return SendNftModule.Factory( evmNftRecord, nftUid, nftRecord.balance, adapter, SendEvmAddressService(), - App.nftMetadataManager, - evmKitWrapper + App.nftMetadataManager ) } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftModule.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftModule.kt index a5152b2ba7..5af9e7bcf6 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftModule.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/nft/send/SendNftModule.kt @@ -3,7 +3,6 @@ package io.horizontalsystems.bankwallet.modules.nft.send import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import io.horizontalsystems.bankwallet.core.adapters.nft.INftAdapter -import io.horizontalsystems.bankwallet.core.managers.EvmKitWrapper import io.horizontalsystems.bankwallet.core.managers.NftMetadataManager import io.horizontalsystems.bankwallet.core.utils.AddressUriParser import io.horizontalsystems.bankwallet.entities.DataState @@ -21,8 +20,7 @@ object SendNftModule { val nftBalance: Int, private val adapter: INftAdapter, private val sendEvmAddressService: SendEvmAddressService, - private val nftMetadataManager: NftMetadataManager, - private val evmKitWrapper: EvmKitWrapper + private val nftMetadataManager: NftMetadataManager ) : ViewModelProvider.Factory { override fun create(modelClass: Class): T {