Updated on 2026-08-14
This commit is contained in:
parent
db6157cae4
commit
99f62f79ee
35 changed files with 128 additions and 109 deletions
|
|
@ -20,6 +20,7 @@ import com.tangem.blockchain.nft.models.NFTAsset
|
|||
import com.tangem.blockchain.nft.models.NFTCollection
|
||||
import com.tangem.blockchain.transactionhistory.models.TransactionHistoryRequest
|
||||
import com.tangem.blockchainsdk.BlockchainSDKFactory
|
||||
import com.tangem.blockchainsdk.utils.toBlockchain
|
||||
import com.tangem.crypto.hdWallet.DerivationPath
|
||||
import com.tangem.datasource.asset.loader.AssetLoader
|
||||
import com.tangem.datasource.local.userwallet.UserWalletsStore
|
||||
|
|
@ -78,7 +79,7 @@ class DefaultWalletManagersFacade(
|
|||
extraTokens: Set<CryptoCurrency.Token>,
|
||||
): UpdateWalletManagerResult {
|
||||
val userWallet = getUserWallet(userWalletId)
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val derivationPath = network.derivationPath.value
|
||||
|
||||
return getAndUpdateWalletManager(userWallet, blockchain, derivationPath, extraTokens)
|
||||
|
|
@ -88,7 +89,7 @@ class DefaultWalletManagersFacade(
|
|||
if (networks.isEmpty()) return
|
||||
|
||||
val blockchainsToDerivationPaths = networks.map {
|
||||
Blockchain.fromId(it.rawId) to it.derivationPath.value
|
||||
it.toBlockchain() to it.derivationPath.value
|
||||
}
|
||||
|
||||
withContext(dispatchers.io) {
|
||||
|
|
@ -141,7 +142,7 @@ class DefaultWalletManagersFacade(
|
|||
withContext(dispatchers.io) {
|
||||
val walletManager = walletManagersStore.getSyncOrNull(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = Blockchain.fromId(network.rawId),
|
||||
blockchain = network.toBlockchain(),
|
||||
derivationPath = network.derivationPath.value,
|
||||
) ?: return@withContext
|
||||
|
||||
|
|
@ -158,7 +159,7 @@ class DefaultWalletManagersFacade(
|
|||
network: Network,
|
||||
): UpdateWalletManagerResult {
|
||||
val userWallet = getUserWallet(userWalletId)
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val derivationPath = network.derivationPath.value
|
||||
|
||||
if (derivationPath != null && !userWallet.scanResponse.hasDerivation(blockchain, derivationPath)) {
|
||||
|
|
@ -181,7 +182,7 @@ class DefaultWalletManagersFacade(
|
|||
addressType: AddressType,
|
||||
contractAddress: String?,
|
||||
): String {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
network = network,
|
||||
|
|
@ -385,7 +386,7 @@ class DefaultWalletManagersFacade(
|
|||
|
||||
@Deprecated("Will be removed in future")
|
||||
override suspend fun getOrCreateWalletManager(userWalletId: UserWalletId, network: Network): WalletManager? {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
return getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -477,7 +478,7 @@ class DefaultWalletManagersFacade(
|
|||
userWalletId: UserWalletId,
|
||||
network: Network,
|
||||
): Result<TransactionFee>? = withContext(dispatchers.io) {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -566,7 +567,7 @@ class DefaultWalletManagersFacade(
|
|||
decimals: Int,
|
||||
id: String?,
|
||||
): BigDecimal {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -637,7 +638,7 @@ class DefaultWalletManagersFacade(
|
|||
}
|
||||
|
||||
override suspend fun checkUtxoConsolidationAvailability(userWalletId: UserWalletId, network: Network): Boolean {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -648,7 +649,7 @@ class DefaultWalletManagersFacade(
|
|||
}
|
||||
|
||||
override suspend fun getNFTCollections(userWalletId: UserWalletId, network: Network): List<NFTCollection> {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -663,7 +664,7 @@ class DefaultWalletManagersFacade(
|
|||
network: Network,
|
||||
collectionIdentifier: NFTCollection.Identifier,
|
||||
): List<NFTAsset> {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -679,7 +680,7 @@ class DefaultWalletManagersFacade(
|
|||
collectionIdentifier: NFTCollection.Identifier,
|
||||
assetIdentifier: NFTAsset.Identifier,
|
||||
): NFTAsset? {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -694,7 +695,7 @@ class DefaultWalletManagersFacade(
|
|||
collectionIdentifier: NFTCollection.Identifier,
|
||||
assetIdentifier: NFTAsset.Identifier,
|
||||
): NFTAsset.SalePrice? {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
|
|
@ -704,7 +705,7 @@ class DefaultWalletManagersFacade(
|
|||
}
|
||||
|
||||
override suspend fun getNFTExploreUrl(network: Network, assetIdentifier: NFTAsset.Identifier): String? {
|
||||
val blockchain = Blockchain.fromId(network.rawId)
|
||||
val blockchain = network.toBlockchain()
|
||||
return blockchain.getNFTExploreUrl(assetIdentifier)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue