javascriptblockchainsmartcontractssolanametaplex

how can i get the symbol/name of a token in solana using solana web3 js?


using getTokenSupply in solana web 3 i was able to get amount and decimals, how can get the name of the token and other metadata?

let from_pairs = new anchor.web3.PublicKey("DUru78GcRB8Ucg24Gy6WNTyufuyBhqcL5wppZJkckQHz")
const NETWORK = anchor.web3.clusterApiUrl('devnet');
const Connection = new anchor.web3.Connection(NETWORK);
const data = await Connection.getTokenSupply(from_pairs)
console.log(data, data2)

output

enter image description here


Solution

  • If you want the name of the token and other pieces of metadata, you likely want to query the Solana token-list. Check out the repo at https://github.com/solana-labs/token-list