简体   繁体   English

如何使用 solana web3 js 在 solana 中获取令牌的符号/名称?

[英]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?在 solana web 3 中使用 getTokenSupply 我能够获得数量和小数,如何获得令牌的名称和其他元数据?

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 .如果您想要令牌的名称和其他元数据,您可能想要查询 Solana token-list Check out the repo at https://github.com/solana-labs/token-listhttps://github.com/solana-labs/token-list查看 repo

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 @solana/web3.js 从 Solana 中的自定义令牌中删除铸币权限? - How do I remove the minting authority from my custom token in Solana using @solana/web3.js? 如何从 Solana web3 中的交易签名中获取代币铸造地址 - How to get a token mint address from a transaction signature in Solana web3 使用 @solana/web3.js 将元数据添加到 Solana 令牌 - Add Meta Data To Solana Token with @solana/web3.js 如何通过“@solana/web3.js”和“@solana/sol-wallet-adapter”传输自定义 SPL 令牌 - How to transfer custom SPL token by '@solana/web3.js' and '@solana/sol-wallet-adapter' 如何通过“@solana/web3.js”和“@solana/spl-token”调用 nft 程序? - How to make a call to nft programs by '@solana/web3.js' and "@solana/spl-token"? 使用 phantom @solana/web3.js 在主网上发送自定义令牌 - Send a custom token on mainnet using phantom @solana/web3.js Solana:使用 Js 从 NFT 代币获取 Candy Machine 信息 - Solana: Get Candy Machine info from a NFT token using Js 如何使用虚拟钱包和 solana web3js 转移 NFT spl-token - How to transfer NFT spl-token using phantom wallet and solana web3js 如何使用 Web3.js 通过 Solana Pay 连接虚拟钱包? - How to connect phantom wallet by Solana Pay using Web3.js? Solana web3 js keep 在尝试确认交易时无法读取未定义的属性(读取“否定”) - Solana web3 js keep gives Cannot read properties of undefined (reading 'negative') while trying to confirm transaction
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM