Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7994

Update NFT metadata after mint

$
0
0

Just need to know how to update NFT metadata after minting NFT. I am trying to use mpl_token_metadata::instruction::update_metadata_accounts_v2 for this. Don't know the correct way to use it or if there is some other way to update metadata.

    pub fn update_nft_metadata(ctx: Context<MintNFT>) -> Result<()> {        let program_id = ctx.accounts.token_metadata_program.key();        let metadata_account = ctx.accounts.metadata.key();        let update_authority = ctx.accounts.mint_authority.key();        let new_update_authority: Option<Pubkey> = Some(ctx.accounts.mint_authority.key());        let data: DataV2 = DataV2 {            name: ("superNFT").to_string(),            symbol: ("SMB").to_string(),            uri: ("abc.com").to_string(),            seller_fee_basis_points: 1000,            creators: None,            collection: None,            uses: None,        };        mpl_token_metadata::instruction::update_metadata_accounts_v2(            program_id,            metadata_account,            update_authority,            new_update_authority,            Some(data),            Some(false),            Some(true),        );        Ok(())    }

Viewing all articles
Browse latest Browse all 7994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>