Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-25 14:37:38 +05:00
parent 150026e2bd
commit cf05b371ef

View file

@ -30,6 +30,7 @@ import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.joinAll
import kotlinx.coroutines.launch
import java.lang.UnsupportedOperationException
import java.util.concurrent.ConcurrentHashMap
import javax.inject.Inject
import com.tangem.blockchain.nft.models.NFTAsset as SdkNFTAsset
@ -85,8 +86,6 @@ internal class DefaultNFTRepository @Inject constructor(
) = coroutineScope {
launch(dispatchers.io) {
Either.catch {
expireAssets(userWalletId, network, collectionId)
val sdkCollectionId = NFTSdkCollectionIdentifierConverter.convertBack(collectionId)
val assets = walletManagersFacade.getNFTAssets(
@ -95,6 +94,8 @@ internal class DefaultNFTRepository @Inject constructor(
collectionIdentifier = sdkCollectionId,
)
expireAssets(userWalletId, network, collectionId)
assets.forEach {
val assetId = NFTSdkAssetIdentifierConverter.convert(it.identifier)
val price = getNFTRuntimeStore(userWalletId, network).getSalePriceSync(assetId)
@ -125,11 +126,13 @@ internal class DefaultNFTRepository @Inject constructor(
)
}
}.onLeft {
saveFailedStateInRuntime(
userWalletId = userWalletId,
network = network,
error = it,
)
if (it !is UnsupportedOperationException) {
saveFailedStateInRuntime(
userWalletId = userWalletId,
network = network,
error = it,
)
}
}
}.saveIn(getCollectionJobHolder(collectionId)).join()
}