I've been trying to figure out a way to programmatically derive the descriptive "label" given a program's base58 address, e.g. cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ
=> NFT Candy Machine V2 or 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
=> Serum DEX V3.
I found a useful answer here using Anchor to get the following data:
"root": {
"version": "0.0.0",
"name": "nft_candy_machine", <= this is kind of the data I want
"instructions": [...],
"accounts": [...],
"types": [...],
"errors": [...]
}
But I want to get the full descriptive label "NFT Candy Machine Program"
that explorer.solana.com displays. I've been trying to use solana web3 Connection.getParsedAccountInfo
and got so far as getting this result:
{
info: {
authority: 'AqH29mZfQFgRpfwaPoTMWSKJ5kqauoc1FwVBRksZyQrt',
data: [
'f0VMRgIBAQAAAAAAAAAAAAMA9wABAAAAwB0.......', <= really long base64 encoded value
'base64'
],
slot: 114756793
},
type: 'programData'
}
I tried const parsedData = Buffer.from( info.data[0], info.data[1] ).toString()
but it's not giving me the right decoded value.
What is the right way to decode this data?