Skip to content

Instantly share code, notes, and snippets.

@arivictor
Created January 16, 2024 07:13
Show Gist options
  • Select an option

  • Save arivictor/ad0b1bcc5fcd38ea877a9b9b73e574c3 to your computer and use it in GitHub Desktop.

Select an option

Save arivictor/ad0b1bcc5fcd38ea877a9b9b73e574c3 to your computer and use it in GitHub Desktop.
const web3 = require('@solana/web3.js');
const { Metadata } = require('@metaplex-foundation/mpl-token-metadata');
async function getNFTUpdateAuthority(mintAddress) {
// Connect to Solana cluster
const connection = new web3.Connection(web3.clusterApiUrl('mainnet-beta'));
// Convert the mint address to a PublicKey
const mintPublicKey = new web3.PublicKey(mintAddress);
// Calculate the PDA (This is specific to how Metaplex handles metadata)
const pda = await Metadata.getPDA(mintPublicKey);
// Fetch Metadata account
const metadata = await Metadata.load(connection, pda);
console.log("UA", metadata.data.updateAuthority)
console.log('PDA Address:', pda.toString());
console.log('Metadata Account Address:', metadata.pubkey.toString());
}
// Replace 'Your_NFT_Mint_Address' with the actual NFT mint address
getNFTMetadataAccount('NFT_ADDRESS').catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment