0

How can I fetch the metadata of an SPL Token in 2022?

I attempted to fetch it from UMI, but it failed. It works fine with SPL 2020, but it's showing an error

    const umi = createUmi("https://api.mainnet-beta.solana.com").use(
    mplTokenMetadata());
    
     const mintAddress = umiPublicKey(
      "7usVzynPTUJ9czdS96ezm9C6Z3hCsjb7j6TMKipURyyQ"
    );

    const asset = await fetchDigitalAsset(umi, mintAddress);
    console.log("asset", asset);

Error:

Error fetching owner Info: AccountNotFoundError: The account of type [Metadata] was not found at the provided address [ESo96eKA5QsXAVUrHUR66qnbVMNy83v16Mut9RFBrh7X].

Source: SDK

EDIT

Token That I'm searching https://solscan.io/token/7usVzynPTUJ9czdS96ezm9C6Z3hCsjb7j6TMKipURyyQ

1 Answer 1

1

The method is the same for SPL and Token2022 tokens.

It looks like the token you're searching for doesn't exist yet.

Edit:

You need to use UMI publickeys for UMI instructions.

import { publicKey as umiPublicKey } from "@metaplex-foundation/umi";

const mintAddress = umiPublicKey("token address here"));

Edit 2:

It might be the case that this token isn't using the metaplex metadata program and is using the experimental token2022 metadata program that some token creators were using a while ago.

I'm not entirely sure if you can fetch the metadata for those through UMI sorry.

5
  • thanks for reply, check I edit the question with token address
    – Bobz
    Mar 7 at 12:48
  • Ah okay, edited my answer now
    – Zombi
    Mar 7 at 13:37
  • Doing the same, and got the same error...edited my answer now.
    – Bobz
    Mar 7 at 13:47
  • So this is working with other tokens but not this one?
    – Zombi
    Mar 7 at 14:32
  • On standard 2020 it works fine, but 2022 makes issues.
    – Bobz
    Mar 8 at 6:15

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.