Skip to content

Commit

Permalink
Disable NftKit creation
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrasulov committed Sep 30, 2024
1 parent 459b73f commit 59ca19d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package io.horizontalsystems.bankwallet.core.managers

import android.os.Handler
import android.os.Looper
import android.util.Log
import io.horizontalsystems.bankwallet.core.App
import io.horizontalsystems.bankwallet.core.UnsupportedAccountException
import io.horizontalsystems.bankwallet.core.supportedNftTypes
import io.horizontalsystems.bankwallet.entities.Account
import io.horizontalsystems.bankwallet.entities.AccountType
import io.horizontalsystems.core.BackgroundManager
Expand All @@ -20,7 +20,6 @@ import io.horizontalsystems.ethereumkit.models.RpcSource
import io.horizontalsystems.ethereumkit.models.TransactionData
import io.horizontalsystems.marketkit.models.BlockchainType
import io.horizontalsystems.nftkit.core.NftKit
import io.horizontalsystems.nftkit.models.NftType
import io.horizontalsystems.oneinchkit.OneInchKit
import io.horizontalsystems.uniswapkit.TokenFactory.UnsupportedChainError
import io.horizontalsystems.uniswapkit.UniswapKit
Expand Down Expand Up @@ -145,24 +144,25 @@ class EvmKitManager(
}
OneInchKit.addDecorators(evmKit)

var nftKit: NftKit? = null
val supportedNftTypes = blockchainType.supportedNftTypes
if (supportedNftTypes.isNotEmpty()) {
val nftKitInstance = NftKit.getInstance(App.instance, evmKit)
supportedNftTypes.forEach {
when (it) {
NftType.Eip721 -> {
nftKitInstance.addEip721TransactionSyncer()
nftKitInstance.addEip721Decorators()
}
NftType.Eip1155 -> {
nftKitInstance.addEip1155TransactionSyncer()
nftKitInstance.addEip1155Decorators()
}
}
}
nftKit = nftKitInstance
}
val nftKit: NftKit? = null
// var nftKit: NftKit? = null
// val supportedNftTypes = blockchainType.supportedNftTypes
// if (supportedNftTypes.isNotEmpty()) {
// val nftKitInstance = NftKit.getInstance(App.instance, evmKit)
// supportedNftTypes.forEach {
// when (it) {
// NftType.Eip721 -> {
// nftKitInstance.addEip721TransactionSyncer()
// nftKitInstance.addEip721Decorators()
// }
// NftType.Eip1155 -> {
// nftKitInstance.addEip1155TransactionSyncer()
// nftKitInstance.addEip1155Decorators()
// }
// }
// }
// nftKit = nftKitInstance
// }

evmKit.start()

Expand All @@ -175,6 +175,7 @@ class EvmKitManager(
useCount -= 1

if (useCount < 1) {
Log.d("AAA", "stopEvmKit()")
stopEvmKit()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ class NftAdapterManager(
if (adapter != null) {
adaptersMap[nftKey] = adapter
} else if (evmBlockchainManager.getBlockchain(nftKey.blockchainType) != null) {
val evmKitWrapper =
evmBlockchainManager.getEvmKitManager(nftKey.blockchainType).getEvmKitWrapper(nftKey.account, nftKey.blockchainType)
val evmKitManager = evmBlockchainManager.getEvmKitManager(nftKey.blockchainType)
val evmKitWrapper = evmKitManager.getEvmKitWrapper(nftKey.account, nftKey.blockchainType)

evmKitWrapper.nftKit?.let { nftKit ->
val nftKit = evmKitWrapper.nftKit
if (nftKit != null) {
adaptersMap[nftKey] = EvmNftAdapter(nftKey.blockchainType, nftKit, evmKitWrapper.evmKit.receiveAddress)
} else {
evmKitManager.unlink(nftKey.account)
}
} else {
// Init other blockchain adapter here (e.g. Solana)
Expand Down

0 comments on commit 59ca19d

Please sign in to comment.