简体   繁体   中英

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

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM