Skip to content

Commit

Permalink
Fix the way we read the nft's metadata (#9707)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsidorenko authored Aug 6, 2023
1 parent d78ae81 commit cdcbfda
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/page-nfts/src/AccountItems/useItemsInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
: ''
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/page-nfts/src/useCollectionInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function extractInfo (allAccounts: string[], id: BN, optDetails: Option<PalletUn
}

const addIpfsData = (ipfsData: IpfsData) => (collectionInfo: CollectionInfo): CollectionInfo => {
const ipfsHash = collectionInfo.metadata && collectionInfo.metadata.data?.toString();
const ipfsHash = collectionInfo.metadata && collectionInfo.metadata.data?.toPrimitive() as string;

return {
...collectionInfo,
Expand All @@ -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
: ''
)
: [],
Expand Down

0 comments on commit cdcbfda

Please sign in to comment.