Getting NFT metadata with graphql

Hi all, I’ve been looking at the graphql connections here Cardano GraphQL Voyager and have been trying to query the metadata of NFTs. It seems I’m able to correctly get all the assets (asset aggregation is 10000 as expected), but each asset seems to have/can have multiple tokenMints which can map to transactions thats metadata contains multiple mints. Is there a nicer way to get the metadata for each asset?

Most recent query attempt:

query {
    assets(
        where: {
            policyId: {
            _eq: "${policyId}"
            }
        }
    ) {
        tokenMints(
            limit: 1
            order_by: {transaction: {block: {forgedAt: asc}}}
        ) {
            transaction {
                metadata {
                    value
                }
            }
        }
    }
}
1 Like

Just started my GraphQL journey…

It looks like your query can return Metadata from other minted tokens, So the 1st level of the query for assets finds an asset from the policy ID(e.g. AssetID: asset1234 Asset Name: Test1234) then Then the query gets the transaction where that asset was minted. But that transaction could have minted other NFTs besides Test123/Asset1234. So you will need to only look at the keys that match your PolicyID and readable assetName.