From cdcbfda0e91ad094f5aac47a4733a5156581a9fa Mon Sep 17 00:00:00 2001 From: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> Date: Sun, 6 Aug 2023 12:56:53 +0200 Subject: [PATCH] Fix the way we read the nft's metadata (#9707) --- packages/page-nfts/src/AccountItems/useItemsInfos.ts | 2 +- packages/page-nfts/src/useCollectionInfos.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/page-nfts/src/AccountItems/useItemsInfos.ts b/packages/page-nfts/src/AccountItems/useItemsInfos.ts index 0ac659b968..a1310d387d 100644 --- a/packages/page-nfts/src/AccountItems/useItemsInfos.ts +++ b/packages/page-nfts/src/AccountItems/useItemsInfos.ts @@ -72,7 +72,7 @@ function useItemsInfosImpl (accountItems: AccountItem[]): ItemInfo[] | undefined if (metadata && metadata[1].length) { return metadata[1].map((o) => o.isSome - ? o.unwrap().data.toString() + ? o.unwrap().data.toPrimitive() as string : '' ); } diff --git a/packages/page-nfts/src/useCollectionInfos.ts b/packages/page-nfts/src/useCollectionInfos.ts index 031a5dceca..ba38f67629 100644 --- a/packages/page-nfts/src/useCollectionInfos.ts +++ b/packages/page-nfts/src/useCollectionInfos.ts @@ -71,7 +71,7 @@ function extractInfo (allAccounts: string[], id: BN, optDetails: Option (collectionInfo: CollectionInfo): CollectionInfo => { - const ipfsHash = collectionInfo.metadata && collectionInfo.metadata.data?.toString(); + const ipfsHash = collectionInfo.metadata && collectionInfo.metadata.data?.toPrimitive() as string; return { ...collectionInfo, @@ -90,7 +90,7 @@ function useCollectionInfosImpl (ids?: BN[]): CollectionInfo[] | undefined { () => metadata && metadata[1].length ? metadata[1].map((o) => o.isSome - ? o.unwrap().data.toString() + ? o.unwrap().data.toPrimitive() as string : '' ) : [],