From b0fbf5e92a08ca96cd279eb78d72ea4a4be08b3d Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Mon, 29 Apr 2024 14:23:50 -0300 Subject: [PATCH] fix: not visible collections --- .../stores/selected-account-collections.store.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/shared/src/lib/core/nfts/stores/selected-account-collections.store.ts b/packages/shared/src/lib/core/nfts/stores/selected-account-collections.store.ts index adfaa972d7..d537ca49d7 100644 --- a/packages/shared/src/lib/core/nfts/stores/selected-account-collections.store.ts +++ b/packages/shared/src/lib/core/nfts/stores/selected-account-collections.store.ts @@ -21,26 +21,28 @@ async function updateCollections(nfts: Nft[]): Promise { await Promise.all( nfts.map(async (nft) => { - if (nft.standard !== NftStandard.Irc27 || !nft.issuer?.aliasId) { + if (nft.standard !== NftStandard.Irc27 || !nft.issuer) { return } - const issuerAliasId = nft.issuer.aliasId + const issuerId = nft.issuer.aliasId ?? nft.issuer.nftId + if (!issuerId) { + return + } - if (!collectionsUpdate[issuerAliasId]) { + if (!collectionsUpdate[issuerId]) { const collection = await getCollectionFromNft(nft) if (collection) { - collectionsUpdate[issuerAliasId] = { ...collection, nfts: [nft] } + collectionsUpdate[issuerId] = { ...collection, nfts: [nft] } } } else { - const existingNfts = collectionsUpdate[issuerAliasId].nfts + const existingNfts = collectionsUpdate[issuerId].nfts if (!existingNfts.find((existingNft) => existingNft.id === nft.id)) { - collectionsUpdate[issuerAliasId].nfts.push(nft) + collectionsUpdate[issuerId].nfts.push(nft) } } }) ) - collectionsStore.set(collectionsUpdate) }