123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880 |
- use anchor_lang::context::CpiContext;
- use anchor_lang::{Accounts, ErrorCode, Result, ToAccountInfos};
- use mpl_token_metadata::state::{CollectionDetails, DataV2, TokenMetadataAccount};
- use mpl_token_metadata::ID;
- use solana_program::account_info::AccountInfo;
- use solana_program::pubkey::Pubkey;
- use std::ops::Deref;
- pub fn approve_collection_authority<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, ApproveCollectionAuthority<'info>>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::approve_collection_authority(
- ID,
- *ctx.accounts.collection_authority_record.key,
- *ctx.accounts.new_collection_authority.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.metadata.key,
- *ctx.accounts.mint.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn bubblegum_set_collection_size<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, BubblegumSetCollectionSize<'info>>,
- collection_authority_record: Option<Pubkey>,
- size: u64,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::bubblegum_set_collection_size(
- ID,
- *ctx.accounts.metadata_account.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.mint.key,
- *ctx.accounts.bubblegum_signer.key,
- collection_authority_record,
- size,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn burn_edition_nft<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, BurnEditionNft<'info>>,
- collection_metadata: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::burn_edition_nft(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.owner.key,
- *ctx.accounts.print_edition_mint.key,
- *ctx.accounts.master_edition_mint.key,
- *ctx.accounts.print_edition_token.key,
- *ctx.accounts.master_edition_token.key,
- *ctx.accounts.master_edition.key,
- *ctx.accounts.print_edition.key,
- *ctx.accounts.edition_marker.key,
- *ctx.accounts.spl_token.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn burn_nft<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, BurnNft<'info>>,
- collection_metadata: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::burn_nft(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.owner.key,
- *ctx.accounts.mint.key,
- *ctx.accounts.token.key,
- *ctx.accounts.edition.key,
- *ctx.accounts.spl_token.key,
- collection_metadata,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- #[deprecated(note = "internal instructions deprecated by Metaplex")]
- pub fn create_metadata_accounts_v2<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV2<'info>>,
- data: DataV2,
- is_mutable: bool,
- update_authority_is_signer: bool,
- ) -> Result<()> {
- let DataV2 {
- name,
- symbol,
- uri,
- creators,
- seller_fee_basis_points,
- collection,
- uses,
- } = data;
- let ix = mpl_token_metadata::instruction::create_metadata_accounts_v2(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.mint.key,
- *ctx.accounts.mint_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.update_authority.key,
- name,
- symbol,
- uri,
- creators,
- seller_fee_basis_points,
- update_authority_is_signer,
- is_mutable,
- collection,
- uses,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn create_metadata_accounts_v3<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV3<'info>>,
- data: DataV2,
- is_mutable: bool,
- update_authority_is_signer: bool,
- details: Option<CollectionDetails>,
- ) -> Result<()> {
- let DataV2 {
- name,
- symbol,
- uri,
- creators,
- seller_fee_basis_points,
- collection,
- uses,
- } = data;
- let ix = mpl_token_metadata::instruction::create_metadata_accounts_v3(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.mint.key,
- *ctx.accounts.mint_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.update_authority.key,
- name,
- symbol,
- uri,
- creators,
- seller_fee_basis_points,
- update_authority_is_signer,
- is_mutable,
- collection,
- uses,
- details,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn update_metadata_accounts_v2<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, UpdateMetadataAccountsV2<'info>>,
- new_update_authority: Option<Pubkey>,
- data: Option<DataV2>,
- primary_sale_happened: Option<bool>,
- is_mutable: Option<bool>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::update_metadata_accounts_v2(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.update_authority.key,
- new_update_authority,
- data,
- primary_sale_happened,
- is_mutable,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn create_master_edition_v3<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, CreateMasterEditionV3<'info>>,
- max_supply: Option<u64>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::create_master_edition_v3(
- ID,
- *ctx.accounts.edition.key,
- *ctx.accounts.mint.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.mint_authority.key,
- *ctx.accounts.metadata.key,
- *ctx.accounts.payer.key,
- max_supply,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn mint_new_edition_from_master_edition_via_token<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, MintNewEditionFromMasterEditionViaToken<'info>>,
- edition: u64,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::mint_new_edition_from_master_edition_via_token(
- ID,
- *ctx.accounts.new_metadata.key,
- *ctx.accounts.new_edition.key,
- *ctx.accounts.master_edition.key,
- *ctx.accounts.new_mint.key,
- *ctx.accounts.new_mint_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.token_account_owner.key,
- *ctx.accounts.token_account.key,
- *ctx.accounts.new_metadata_update_authority.key,
- *ctx.accounts.metadata.key,
- *ctx.accounts.metadata_mint.key,
- edition,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn revoke_collection_authority<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, RevokeCollectionAuthority<'info>>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::revoke_collection_authority(
- ID,
- *ctx.accounts.collection_authority_record.key,
- *ctx.accounts.delegate_authority.key,
- *ctx.accounts.revoke_authority.key,
- *ctx.accounts.metadata.key,
- *ctx.accounts.mint.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn set_collection_size<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, SetCollectionSize<'info>>,
- collection_authority_record: Option<Pubkey>,
- size: u64,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::set_collection_size(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.mint.key,
- collection_authority_record,
- size,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn verify_collection<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, VerifyCollection<'info>>,
- collection_authority_record: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::verify_collection(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.collection_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.collection_mint.key,
- *ctx.accounts.collection_metadata.key,
- *ctx.accounts.collection_master_edition.key,
- collection_authority_record,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn verify_sized_collection_item<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, VerifySizedCollectionItem<'info>>,
- collection_authority_record: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::verify_sized_collection_item(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.collection_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.collection_mint.key,
- *ctx.accounts.collection_metadata.key,
- *ctx.accounts.collection_master_edition.key,
- collection_authority_record,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn set_and_verify_collection<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, SetAndVerifyCollection<'info>>,
- collection_authority_record: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::set_and_verify_collection(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.collection_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.collection_mint.key,
- *ctx.accounts.collection_metadata.key,
- *ctx.accounts.collection_master_edition.key,
- collection_authority_record,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn set_and_verify_sized_collection_item<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, SetAndVerifySizedCollectionItem<'info>>,
- collection_authority_record: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::set_and_verify_sized_collection_item(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.collection_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.collection_mint.key,
- *ctx.accounts.collection_metadata.key,
- *ctx.accounts.collection_master_edition.key,
- collection_authority_record,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn freeze_delegated_account<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, FreezeDelegatedAccount<'info>>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::freeze_delegated_account(
- ID,
- *ctx.accounts.delegate.key,
- *ctx.accounts.token_account.key,
- *ctx.accounts.edition.key,
- *ctx.accounts.mint.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn thaw_delegated_account<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, ThawDelegatedAccount<'info>>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::thaw_delegated_account(
- ID,
- *ctx.accounts.delegate.key,
- *ctx.accounts.token_account.key,
- *ctx.accounts.edition.key,
- *ctx.accounts.mint.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn update_primary_sale_happened_via_token<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, UpdatePrimarySaleHappenedViaToken<'info>>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::update_primary_sale_happened_via_token(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.owner.key,
- *ctx.accounts.token.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )?;
- Ok(())
- }
- pub fn set_token_standard<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, SetTokenStandard<'info>>,
- edition_account: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::set_token_standard(
- ID,
- *ctx.accounts.metadata_account.key,
- *ctx.accounts.update_authority.key,
- *ctx.accounts.mint_account.key,
- edition_account,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn sign_metadata<'info>(ctx: CpiContext<'_, '_, '_, 'info, SignMetadata<'info>>) -> Result<()> {
- let ix = mpl_token_metadata::instruction::sign_metadata(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.creator.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )?;
- Ok(())
- }
- pub fn remove_creator_verification<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, RemoveCreatorVerification<'info>>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::remove_creator_verification(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.creator.key,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )?;
- Ok(())
- }
- pub fn utilize<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, Utilize<'info>>,
- use_authority_record_pda: Option<Pubkey>,
- burner: Option<Pubkey>,
- number_of_uses: u64,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::utilize(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.token_account.key,
- *ctx.accounts.mint.key,
- use_authority_record_pda,
- *ctx.accounts.use_authority.key,
- *ctx.accounts.owner.key,
- burner,
- number_of_uses,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn unverify_collection<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, UnverifyCollection<'info>>,
- collection_authority_record: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::unverify_collection(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.collection_authority.key,
- *ctx.accounts.collection_mint.key,
- *ctx.accounts.collection.key,
- *ctx.accounts.collection_master_edition_account.key,
- collection_authority_record,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- pub fn unverify_sized_collection_item<'info>(
- ctx: CpiContext<'_, '_, '_, 'info, UnverifySizedCollectionItem<'info>>,
- collection_authority_record: Option<Pubkey>,
- ) -> Result<()> {
- let ix = mpl_token_metadata::instruction::unverify_sized_collection_item(
- ID,
- *ctx.accounts.metadata.key,
- *ctx.accounts.collection_authority.key,
- *ctx.accounts.payer.key,
- *ctx.accounts.collection_mint.key,
- *ctx.accounts.collection.key,
- *ctx.accounts.collection_master_edition_account.key,
- collection_authority_record,
- );
- solana_program::program::invoke_signed(
- &ix,
- &ToAccountInfos::to_account_infos(&ctx),
- ctx.signer_seeds,
- )
- .map_err(Into::into)
- }
- #[derive(Accounts)]
- pub struct ApproveCollectionAuthority<'info> {
- pub collection_authority_record: AccountInfo<'info>,
- pub new_collection_authority: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct BubblegumSetCollectionSize<'info> {
- pub metadata_account: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub bubblegum_signer: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct BurnEditionNft<'info> {
- pub metadata: AccountInfo<'info>,
- pub owner: AccountInfo<'info>,
- pub print_edition_mint: AccountInfo<'info>,
- pub master_edition_mint: AccountInfo<'info>,
- pub print_edition_token: AccountInfo<'info>,
- pub master_edition_token: AccountInfo<'info>,
- pub master_edition: AccountInfo<'info>,
- pub print_edition: AccountInfo<'info>,
- pub edition_marker: AccountInfo<'info>,
- pub spl_token: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct BurnNft<'info> {
- pub metadata: AccountInfo<'info>,
- pub owner: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub token: AccountInfo<'info>,
- pub edition: AccountInfo<'info>,
- pub spl_token: AccountInfo<'info>,
- }
- #[deprecated(note = "internal instructions deprecated by Metaplex")]
- #[derive(Accounts)]
- pub struct CreateMetadataAccountsV2<'info> {
- pub metadata: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub mint_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub system_program: AccountInfo<'info>,
- pub rent: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct CreateMetadataAccountsV3<'info> {
- pub metadata: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub mint_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub system_program: AccountInfo<'info>,
- pub rent: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct UpdateMetadataAccountsV2<'info> {
- pub metadata: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct CreateMasterEditionV3<'info> {
- pub edition: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub mint_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- pub token_program: AccountInfo<'info>,
- pub system_program: AccountInfo<'info>,
- pub rent: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct MintNewEditionFromMasterEditionViaToken<'info> {
- pub new_metadata: AccountInfo<'info>,
- pub new_edition: AccountInfo<'info>,
- pub master_edition: AccountInfo<'info>,
- pub new_mint: AccountInfo<'info>,
- pub edition_mark_pda: AccountInfo<'info>,
- pub new_mint_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub token_account_owner: AccountInfo<'info>,
- pub token_account: AccountInfo<'info>,
- pub new_metadata_update_authority: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- pub token_program: AccountInfo<'info>,
- pub system_program: AccountInfo<'info>,
- pub rent: AccountInfo<'info>,
- //
- // Not actually used by the program but still needed because it's needed
- // for the pda calculation in the helper. :/
- //
- // The better thing to do would be to remove this and have the instruction
- // helper pass in the `edition_mark_pda` directly.
- //
- pub metadata_mint: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct RevokeCollectionAuthority<'info> {
- pub collection_authority_record: AccountInfo<'info>,
- pub delegate_authority: AccountInfo<'info>,
- pub revoke_authority: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct SetCollectionSize<'info> {
- pub metadata: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub system_program: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct SetTokenStandard<'info> {
- pub metadata_account: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub mint_account: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct VerifyCollection<'info> {
- pub payer: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- pub collection_authority: AccountInfo<'info>,
- pub collection_mint: AccountInfo<'info>,
- pub collection_metadata: AccountInfo<'info>,
- pub collection_master_edition: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct VerifySizedCollectionItem<'info> {
- pub payer: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- pub collection_authority: AccountInfo<'info>,
- pub collection_mint: AccountInfo<'info>,
- pub collection_metadata: AccountInfo<'info>,
- pub collection_master_edition: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct SetAndVerifyCollection<'info> {
- pub metadata: AccountInfo<'info>,
- pub collection_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub collection_mint: AccountInfo<'info>,
- pub collection_metadata: AccountInfo<'info>,
- pub collection_master_edition: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct SetAndVerifySizedCollectionItem<'info> {
- pub metadata: AccountInfo<'info>,
- pub collection_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub update_authority: AccountInfo<'info>,
- pub collection_mint: AccountInfo<'info>,
- pub collection_metadata: AccountInfo<'info>,
- pub collection_master_edition: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct FreezeDelegatedAccount<'info> {
- pub metadata: AccountInfo<'info>,
- pub delegate: AccountInfo<'info>,
- pub token_account: AccountInfo<'info>,
- pub edition: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub token_program: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct ThawDelegatedAccount<'info> {
- pub metadata: AccountInfo<'info>,
- pub delegate: AccountInfo<'info>,
- pub token_account: AccountInfo<'info>,
- pub edition: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub token_program: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct UpdatePrimarySaleHappenedViaToken<'info> {
- pub metadata: AccountInfo<'info>,
- pub owner: AccountInfo<'info>,
- pub token: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct SignMetadata<'info> {
- pub creator: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct RemoveCreatorVerification<'info> {
- pub creator: AccountInfo<'info>,
- pub metadata: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct Utilize<'info> {
- pub metadata: AccountInfo<'info>,
- pub token_account: AccountInfo<'info>,
- pub mint: AccountInfo<'info>,
- pub use_authority: AccountInfo<'info>,
- pub owner: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct UnverifyCollection<'info> {
- pub metadata: AccountInfo<'info>,
- pub collection_authority: AccountInfo<'info>,
- pub collection_mint: AccountInfo<'info>,
- pub collection: AccountInfo<'info>,
- pub collection_master_edition_account: AccountInfo<'info>,
- }
- #[derive(Accounts)]
- pub struct UnverifySizedCollectionItem<'info> {
- pub metadata: AccountInfo<'info>,
- pub collection_authority: AccountInfo<'info>,
- pub payer: AccountInfo<'info>,
- pub collection_mint: AccountInfo<'info>,
- pub collection: AccountInfo<'info>,
- pub collection_master_edition_account: AccountInfo<'info>,
- }
- #[derive(Clone, Debug, PartialEq)]
- pub struct MetadataAccount(mpl_token_metadata::state::Metadata);
- impl MetadataAccount {
- pub const LEN: usize = mpl_token_metadata::state::MAX_METADATA_LEN;
- }
- impl anchor_lang::AccountDeserialize for MetadataAccount {
- fn try_deserialize(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
- let md = Self::try_deserialize_unchecked(buf)?;
- if md.key != mpl_token_metadata::state::Metadata::key() {
- return Err(ErrorCode::AccountNotInitialized.into());
- }
- Ok(md)
- }
- fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
- let md = mpl_token_metadata::state::Metadata::safe_deserialize(buf)?;
- Ok(Self(md))
- }
- }
- impl anchor_lang::AccountSerialize for MetadataAccount {}
- impl anchor_lang::Owner for MetadataAccount {
- fn owner() -> Pubkey {
- ID
- }
- }
- impl Deref for MetadataAccount {
- type Target = mpl_token_metadata::state::Metadata;
- fn deref(&self) -> &Self::Target {
- &self.0
- }
- }
- #[derive(Clone, Debug, PartialEq)]
- pub struct MasterEditionAccount(mpl_token_metadata::state::MasterEditionV2);
- impl MasterEditionAccount {
- pub const LEN: usize = mpl_token_metadata::state::MAX_MASTER_EDITION_LEN;
- }
- impl anchor_lang::AccountDeserialize for MasterEditionAccount {
- fn try_deserialize(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
- let me = Self::try_deserialize_unchecked(buf)?;
- if me.key != mpl_token_metadata::state::MasterEditionV2::key() {
- return Err(ErrorCode::AccountNotInitialized.into());
- }
- Ok(me)
- }
- fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
- let result = mpl_token_metadata::state::MasterEditionV2::safe_deserialize(buf)?;
- Ok(Self(result))
- }
- }
- impl Deref for MasterEditionAccount {
- type Target = mpl_token_metadata::state::MasterEditionV2;
- fn deref(&self) -> &Self::Target {
- &self.0
- }
- }
- impl anchor_lang::AccountSerialize for MasterEditionAccount {}
- impl anchor_lang::Owner for MasterEditionAccount {
- fn owner() -> Pubkey {
- ID
- }
- }
- #[derive(Clone)]
- pub struct Metadata;
- impl anchor_lang::Id for Metadata {
- fn id() -> Pubkey {
- ID
- }
- }
|