#anchor #solana #metaplex #blockchain

anchor-metaplex

collection of helper numeric operation functions that allows seamless interaction of your Solana Anchor program with the Metaplex ecosystem

6 releases (3 breaking)

0.8.2 Dec 12, 2024
0.8.1 Dec 9, 2024
0.3.1 Jun 13, 2022
0.2.0 Feb 27, 2022
0.1.0 Feb 18, 2022

#884 in Magic Beans

Download history 3/week @ 2024-09-20 2/week @ 2024-11-01 1/week @ 2024-11-08 390/week @ 2024-12-06 76/week @ 2024-12-13

466 downloads per month

Custom license

16KB
324 lines

Anchor Metaplex

Example

use anchor_metaplex::{CreateMetadata, create_metadata};

 pub fn Initialize(
    ctx: Context<Initialize>,
    name: String,
    symbol: String,
    uri: String,
 ) -> ProgramResult {
   let seeds: &[&[u8]] = &[
     b"mint_authority", name.as_bytes(), symbol.as_bytes(),
     &[state.bumps.mint_authority]
   ];
   let signer_seeds:&[&[&[u8]]] = &[&seeds[..]];
   let cpi_accounts = CreateMetadata {
     mint: *ctx.accounts.index_token.clone(),
     mint_authority: ctx.accounts.mint_authority.clone(),
     metadata_account: ctx.accounts.metadata_account.clone(),
     payer: (*ctx.accounts.deployer).to_account_info(),
     update_authority: ctx.accounts.mint_authority.to_account_info(),
     system_program: ctx.accounts.system_program.to_account_info(),
     rent: ctx.accounts.rent.to_account_info(),
   };
   
   create_metadata(
     cpi_accounts,
     signer_seeds,
     name.clone(),
     symbol.clone(),
     uri,
     None,
     0,
     true,
     true,
     None,
     None
    )
 }

Dependencies

~21–29MB
~512K SLoC