3

I can get the metadata of any token I build like that:

import { Metaplex, keypairIdentity } from '@metaplex-foundation/js';
import { Metadata } from "@metaplex-foundation/mpl-token-metadata";

const metaplex = Metaplex.make(connection)
  .use(keypairIdentity(wallet))

const metadataPda = metaplex.nfts().pdas().metadata({ mint: mint });
const account = await Metadata.fromAccountAddress(connection, metadataPda);

console.log('Name', account.data.name)
console.log('Symbol', account.data.symbol)
console.log('URI', account.data.uri)

It is a very simple code and works.

I am trying to get the metadata of very popular tokens like USDC on Devnet. I would like to get and show this information like Solana Explorer or Solscan. But, when I try it, I receive an error "Unable to find Metadata account".

Even, on Solscan, you do not see any metadata in the corresponding tab.

It seems the metadata of this token does not work in the same way. How I can get the name, symbol and image of USDC Dev?

Thanks!

1 Answer 1

5

The metadata for that particular mint was added using the token-list prior to the adoption of the Metaplex Token Metadata program as the preferred way of adding metadata to a token. As a result, it cannot be retrieved using the Metaplex SDK because it does not have a metadata account.

The metadata for that mint can be found on line 120875 of the now deprecated token-list. https://github.com/solana-labs/token-list/blob/main/src/tokens/solana.tokenlist.json

{
  "chainId": 103,
  "address": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
  "symbol": "USDC-Dev",
  "name": "USD Coin Dev",
  "decimals": 6,
  "logoURI": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",
  "tags": [
    "stablecoin"
  ],
  "extensions": {
    "blog": "https://medium.com/credix/building-an-spl-token-faucet-on-solana-2b8a07d364ff",
    "coingeckoId": "usd-coin"
  }
},

To clarify, there isn't an official devnet version of USDC. Rather, what exists is a mint that someone created on devnet which uses the same metadata as USDC. It's important to keep in mind that anyone can create new tokens with metadata that imitates real tokens. Ultimately, its the mint address that serves as the token's unique identifier.

2
  • Interesting. Thanks for the explanations! So, is it possible get this information from any service or API? I am building an app similar to Solana Explorer. I think, an alternative is to build my own API and persist this json in a BBDD. Commented Mar 16, 2023 at 14:03
  • 2
    This looks like it might have what you're looking for (although haven't personally used before): github.com/solflare-wallet/utl-aggregator
    – john
    Commented Mar 16, 2023 at 19:42

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.