1

I am trying to extract the metadata of any NFT of interest on-chain. According to Lucid documentation, you can use metadataOf(). Here is my code:

const lucid = await Lucid.new(
    new Blockfrost(
      "https://cardano-preprod.blockfrost.io/api/v0",
      Deno.env.get("BLOCKFROST_API_KEY")
    ),
    "Preprod"
  );

const test = await lucid.metadataOf("ASSETNAME_HERE");
console.log(test)

The code throws an error: ""No variant matched." Meaning that it can't find .metadataOf. Anyone has an idea how to fix this?

1 Answer 1

1

The error "No variant matched" likely means that the metadataOf method didn't find the asset you're querying for, or there might be some issue with how the Lucid library is initialized or called.

  • Make sure Lucid and Blockfrost are properly imported.
  • Verify your BLOCKFROST_API_KEY is correctly set in your environment.
  • Confirm that "ASSETNAME_HERE" is actually the correct asset identifier.
  • Double-check if you're using the correct version of the Lucid library that supports the metadataOf method.

If all these are fine, try reaching out to the Lucid library maintainers or community for specific issues with the metadataOf method. You can find them on their Discord channel: https://discord.com/invite/82MWs63Tdm

If nothing works, you might want to look for some different library.

2
  • Yeah, all those were correct. So, I actually just skipped lucid and directly use blockfrost api commands to query the blockchain. Sep 16 at 13:38
  • Great to hear that. Please mark question as resolved.
    – Spawn
    Sep 17 at 14:40

Your Answer

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

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