1

In a NextJS app. Say I enable a user to created a basic token using the @metaplex-foundation/mpl-token-metadata library with some metadata like name, symbol, decimal, uri etc... And I also enable the user to create an associated account for this mint. How do I now fetch the metadata when I display this account to the user?

Right now I am using getParsedTokenAccountsByOwner from the @solana/web3 library to fetch all the users token accounts, and this does in fact fetch all the users token accounts including the ones created with metaplex but nowhere in the data structure does it have the metadata details.

What are my options?

1 Answer 1

1

Since you are using @metaplex-foundation/mpl-token-metadata already you can just use one of the fetch functions this package provides https://developers.metaplex.com/token-metadata/fetch

Since you are referring to showing the user a token that they minted something like this might be relevant to you

import { fetchDigitalAssetWithAssociatedToken } from '@metaplex-foundation/mpl-token-metadata'

const asset = await fetchDigitalAssetWithAssociatedToken(umi, mint, owner)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.