Created
January 16, 2024 07:13
-
-
Save arivictor/ad0b1bcc5fcd38ea877a9b9b73e574c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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