2

Starting to build some stuff in Solana, well looking to. And am used to EVM chains.

With what I am building on the EVM side i would normally get token information creating an contract with web3js, using the ERC20 ABI, calling Name, Symbol, Decimals, Supply to get token information, and then using Etherscan to get the verified contract, holders, etc.

When looking to do the same on Solana, it seems not cut and dry. I've searched and found outdated information, old npm packages, so wondering what is the best way to get this similar information on Solana?

Much appreciated.

2
  • What token information are you interested in, please detail? Do you know the contract of the token?
    – Serban
    Commented Dec 10, 2023 at 18:09
  • Yes I mentioned it in the original post, but the Name, Symbol, Decimals, Supply, Owner, and Metadata (which I believe is equivalent to the source code of a Solidity contract).
    – plat_winz
    Commented Dec 10, 2023 at 18:54

1 Answer 1

5

You can get the Decimals and Supply from the mint account. And you can get the Name, Symbol and other Metadata from the metadata account that is associated with the mint account.

I've hacked this code together right now just to demo: https://gist.github.com/serbangv/9e65ec32b0c3bf257d2355ad285a1e58

But please be aware it's using and older (version 2) mpl-token-metadata package because I couldn't bother with the newest one right now.

1
  • This worked perfect! Thank you!
    – plat_winz
    Commented Dec 11, 2023 at 18:54

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.