use crate::{
deprecated_instruction::{MintPrintingTokensViaTokenArgs, SetReservationListArgs},
state::{
Collection, CollectionDetails, Creator, Data, DataV2, Uses, EDITION,
EDITION_MARKER_BIT_SIZE, PREFIX,
},
};
use borsh::{BorshDeserialize, BorshSerialize};
use shank::ShankInstruction;
use solana_program::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
sysvar,
};
#[cfg(feature = "serde-feature")]
use {
serde::{Deserialize, Serialize},
serde_with::{As, DisplayFromStr},
};
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct UpdateMetadataAccountArgs {
pub data: Option<Data>,
#[cfg_attr(
feature = "serde-feature",
serde(with = "As::<Option<DisplayFromStr>>")
)]
pub update_authority: Option<Pubkey>,
pub primary_sale_happened: Option<bool>,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct UpdateMetadataAccountArgsV2 {
pub data: Option<DataV2>,
#[cfg_attr(
feature = "serde-feature",
serde(with = "As::<Option<DisplayFromStr>>")
)]
pub update_authority: Option<Pubkey>,
pub primary_sale_happened: Option<bool>,
pub is_mutable: Option<bool>,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct CreateMetadataAccountArgs {
pub data: Data,
pub is_mutable: bool,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct CreateMetadataAccountArgsV2 {
pub data: DataV2,
pub is_mutable: bool,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct CreateMetadataAccountArgsV3 {
pub data: DataV2,
pub is_mutable: bool,
pub collection_details: Option<CollectionDetails>,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct CreateMasterEditionArgs {
pub max_supply: Option<u64>,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct MintNewEditionFromMasterEditionViaTokenArgs {
pub edition: u64,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct ApproveUseAuthorityArgs {
pub number_of_uses: u64,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct UtilizeArgs {
pub number_of_uses: u64,
}
#[repr(C)]
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct SetCollectionSizeArgs {
pub size: u64,
}
#[cfg_attr(feature = "serde-feature", derive(Serialize, Deserialize))]
#[derive(BorshSerialize, BorshDeserialize, Clone, ShankInstruction)]
#[rustfmt::skip]
pub enum MetadataInstruction {
#[account(0, writable, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, name="mint", desc="Mint of token asset")]
#[account(2, signer, name="mint_authority", desc="Mint authority")]
#[account(3, signer, writable, name="payer", desc="payer")]
#[account(4, name="update_authority", desc="update authority info")]
#[account(5, name="system_program", desc="System program")]
#[account(6, name="rent", desc="Rent info")]
CreateMetadataAccount(CreateMetadataAccountArgs),
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, name="update_authority", desc="Update authority key")]
UpdateMetadataAccount(UpdateMetadataAccountArgs),
#[account(0, writable, name="edition", desc="Unallocated edition V1 account with address as pda of ['metadata', program id, mint, 'edition']")]
#[account(1, writable, name="mint", desc="Metadata mint")]
#[account(2, writable, name="printing_mint", desc="Printing mint - A mint you control that can mint tokens that can be exchanged for limited editions of your master edition via the MintNewEditionFromMasterEditionViaToken endpoint")]
#[account(3, writable, name="one_time_printing_authorization_mint", desc="One time authorization printing mint - A mint you control that prints tokens that gives the bearer permission to mint any number of tokens from the printing mint one time via an endpoint with the token-metadata program for your metadata. Also burns the token.")]
#[account(4, signer, name="update_authority", desc="Current Update authority key")]
#[account(5, signer, name="printing_mint_authority", desc="Printing mint authority - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY.")]
#[account(6, signer, name="mint_authority", desc="Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY")]
#[account(7, name="metadata", desc="Metadata account")]
#[account(8, signer, name="payer", desc="payer")]
#[account(9, name="token_program", desc="Token program")]
#[account(10, name="system_program", desc="System program")]
#[account(11, name="rent", desc="Rent info")]
#[account(12, signer, name="one_time_printing_authorization_mint_authority", desc="One time authorization printing mint authority - must be provided if using max supply. THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY.")]
DeprecatedCreateMasterEdition(CreateMasterEditionArgs),
#[account(0, writable, name="metadata", desc="New Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, writable, name="edition", desc="New Edition V1 (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(2, writable, name="master_edition", desc="Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition'])")]
#[account(3, writable, name="mint", desc="Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY")]
#[account(4, signer, name="mint_authority", desc="Mint authority of new mint")]
#[account(5, writable, name="printing_mint", desc="Printing Mint of master record edition")]
#[account(6, writable, name="master_token_account", desc="Token account containing Printing mint token to be transferred")]
#[account(7, writable, name="edition_marker", desc="Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number])")]
#[account(8, signer, name="burn_authority", desc="Burn authority for this token")]
#[account(9, signer, name="payer", desc="payer")]
#[account(10, name="master_update_authority", desc="update authority info for new metadata account")]
#[account(11, name="master_metadata", desc="Master record metadata account")]
#[account(12, name="token_program", desc="Token program")]
#[account(13, name="system_program", desc="System program")]
#[account(14, name="rent", desc="Rent info")]
#[account(15, optional, writable, name="reservation_list", desc="Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list.")]
DeprecatedMintNewEditionFromMasterEditionViaPrintingToken,
#[account(0, writable, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, signer, name="owner", desc="Owner on the token account")]
#[account(2, name="token", desc="Account containing tokens from the metadata's mint")]
UpdatePrimarySaleHappenedViaToken,
#[account(0, writable, name="master_edition", desc="Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(1, writable, name="reservation_list", desc="PDA for ReservationList of ['metadata', program id, master edition key, 'reservation', resource-key]")]
#[account(2, signer, name="resource", desc="The resource you tied the reservation list too")]
DeprecatedSetReservationList(SetReservationListArgs),
#[account(0, writable, name="reservation_list", desc="PDA for ReservationList of ['metadata', program id, master edition key, 'reservation', resource-key]")]
#[account(1, signer, name="payer", desc="Payer")]
#[account(2, signer, name="update_authority", desc="Update authority")]
#[account(3, name="master_edition", desc=" Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(4, name="resource", desc="A resource you wish to tie the reservation list to. This is so your later visitors who come to redeem can derive your reservation list PDA with something they can easily get at. You choose what this should be.")]
#[account(5, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(6, name="system_program", desc="System program")]
#[account(7, name="rent", desc="Rent info")]
DeprecatedCreateReservationList,
#[account(0, writable, name="metadata", desc="Metadata (pda of ['metadata', program id, mint id])")]
#[account(1, signer, name="creator", desc="Creator")]
SignMetadata,
#[account(0, writable, name="destination", desc="Destination account")]
#[account(1, writable, name="token", desc="Token account containing one time authorization token")]
#[account(2, writable, name="one_time_printing_authorization_mint", desc="One time authorization mint")]
#[account(3, writable, name="printing_mint", desc="Printing mint")]
#[account(4, signer, name="burn_authority", desc="Burn authority")]
#[account(5, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(6, name="master_edition", desc="Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(7, name="token_program", desc="Token program")]
#[account(8, name="rent", desc="Rent")]
DeprecatedMintPrintingTokensViaToken(MintPrintingTokensViaTokenArgs),
#[account(0, writable, name="destination", desc="Destination account")]
#[account(1, writable, name="printing_mint", desc="Printing mint")]
#[account(2, signer, name="update_authority", desc="Update authority")]
#[account(3, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(4, name="master_edition", desc="Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(5, name="token_program", desc="Token program")]
#[account(6, name="rent", desc="Rent")]
DeprecatedMintPrintingTokens(MintPrintingTokensViaTokenArgs),
#[account(0, writable, name="edition", desc="Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition']")]
#[account(1, writable, name="mint", desc="Metadata mint")]
#[account(2, signer, name="update_authority", desc="Update authority")]
#[account(3, signer, name="mint_authority", desc="Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY")]
#[account(4, signer, writable, name="payer", desc="payer")]
#[account(5, name="metadata", desc="Metadata account")]
#[account(6, name="token_program", desc="Token program")]
#[account(7, name="system_program", desc="System program")]
#[account(8, name="rent", desc="Rent info")]
CreateMasterEdition(CreateMasterEditionArgs),
#[account(0, writable, name="new_metadata", desc="New Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, writable, name="new_edition", desc="New Edition (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(2, writable, name="master_edition", desc="Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'])")]
#[account(3, writable, name="new_mint", desc="Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY")]
#[account(4, writable, name="edition_mark_pda", desc="Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE).")]
#[account(5, signer, name="new_mint_authority", desc="Mint authority of new mint")]
#[account(6, signer, writable, name="payer", desc="payer")]
#[account(7, signer, name="token_account_owner", desc="owner of token account containing master token (#8)")]
#[account(8, name="token_account", desc="token account containing token from master metadata mint")]
#[account(9, name="new_metadata_update_authority", desc="Update authority info for new metadata")]
#[account(10, name="metadata", desc="Master record metadata account")]
#[account(11, name="token_program", desc="Token program")]
#[account(12, name="system_program", desc="System program")]
#[account(13, name="rent", desc="Rent info")]
MintNewEditionFromMasterEditionViaToken(MintNewEditionFromMasterEditionViaTokenArgs),
#[account(0, writable, name="master_edition", desc="Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition'])")]
#[account(1, writable, name="one_time_auth", desc="One time authorization mint")]
#[account(2, writable, name="printing_mint", desc="Printing mint")]
ConvertMasterEditionV1ToV2,
#[account(0, writable, name="new_metadata", desc="New Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, writable, name="new_edition", desc="New Edition (pda of ['metadata', program id, mint id, 'edition'])")]
#[account(2, writable, name="master_edition", desc="Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']")]
#[account(3, writable, name="new_mint", desc="Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY")]
#[account(4, writable, name="edition_mark_pda", desc="Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE).")]
#[account(5, signer, name="new_mint_authority", desc="Mint authority of new mint")]
#[account(6, signer, writable, name="payer", desc="payer")]
#[account(7, signer, name="vault_authority", desc="Vault authority")]
#[account(8, name="safety_deposit_store", desc="Safety deposit token store account")]
#[account(9, name="safety_deposit_box", desc="Safety deposit box")]
#[account(10, name="vault", desc="Vault")]
#[account(11, name="new_metadata_update_authority", desc="Update authority info for new metadata")]
#[account(12, name="metadata", desc="Master record metadata account")]
#[account(13, name="token_program", desc="Token program")]
#[account(14, name="token_vault_program", desc="Token vault program")]
#[account(15, name="system_program", desc="System program")]
#[account(16, name="rent", desc="Rent info")]
MintNewEditionFromMasterEditionViaVaultProxy(MintNewEditionFromMasterEditionViaTokenArgs),
#[account(0, writable, name="metadata", desc="Metadata account")]
PuffMetadata,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, name="update_authority", desc="Update authority key")]
UpdateMetadataAccountV2(UpdateMetadataAccountArgsV2),
#[account(0, writable, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, name="mint", desc="Mint of token asset")]
#[account(2, signer, name="mint_authority", desc="Mint authority")]
#[account(3, signer, writable, name="payer", desc="payer")]
#[account(4, name="update_authority", desc="update authority info")]
#[account(5, name="system_program", desc="System program")]
#[account(6, name="rent", desc="Rent info")]
CreateMetadataAccountV2(CreateMetadataAccountArgsV2),
#[account(0, writable, name="edition", desc="Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition']")]
#[account(1, writable, name="mint", desc="Metadata mint")]
#[account(2, signer, name="update_authority", desc="Update authority")]
#[account(3, signer, name="mint_authority", desc="Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY")]
#[account(4, signer, writable, name="payer", desc="payer")]
#[account(5, writable, name="metadata", desc="Metadata account")]
#[account(6, name="token_program", desc="Token program")]
#[account(7, name="system_program", desc="System program")]
#[account(8, name="rent", desc="Rent info")]
CreateMasterEditionV3(CreateMasterEditionArgs),
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")]
#[account(2, signer, writable, name="payer", desc="payer")]
#[account(3, name="collection_mint", desc="Mint of the Collection")]
#[account(4, name="collection", desc="Metadata Account of the Collection")]
#[account(5, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")]
VerifyCollection,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, writable, name="token_account", desc="Token Account Of NFT")]
#[account(2, writable, name="mint", desc="Mint of the Metadata")]
#[account(3, signer, writable, name="use_authority", desc="A Use Authority / Can be the current Owner of the NFT")]
#[account(4, name="owner", desc="Owner")]
#[account(5, name="token_program", desc="Token program")]
#[account(6, name="ata_program", desc="Associated Token program")]
#[account(7, name="system_program", desc="System program")]
#[account(8, name="rent", desc="Rent info")]
#[account(9, optional, writable, name="use_authority_record", desc="Use Authority Record PDA If present the program Assumes a delegated use authority")]
#[account(10, optional, name="burner", desc="Program As Signer (Burner)")]
Utilize(UtilizeArgs),
#[account(0, writable, name="use_authority_record", desc="Use Authority Record PDA")]
#[account(1, signer, writable, name="owner", desc="Owner")]
#[account(2, signer, writable, name="payer", desc="Payer")]
#[account(3, name="user", desc="A Use Authority")]
#[account(4, writable, name="owner_token_account", desc="Owned Token Account Of Mint")]
#[account(5, name="metadata", desc="Metadata account")]
#[account(6, name="mint", desc="Mint of Metadata")]
#[account(7, name="burner", desc="Program As Signer (Burner)")]
#[account(8, name="token_program", desc="Token program")]
#[account(9, name="system_program", desc="System program")]
#[account(10, name="rent", desc="Rent info")]
ApproveUseAuthority(ApproveUseAuthorityArgs),
#[account(0, writable, name="use_authority_record", desc="Use Authority Record PDA")]
#[account(1, signer, writable, name="owner", desc="Owner")]
#[account(2, name="user", desc="A Use Authority")]
#[account(3, writable, name="owner_token_account", desc="Owned Token Account Of Mint")]
#[account(4, name="mint", desc="Mint of Metadata")]
#[account(5, name="metadata", desc="Metadata account")]
#[account(6, name="token_program", desc="Token program")]
#[account(7, name="system_program", desc="System program")]
#[account(8, name="rent", desc="Rent info")]
RevokeUseAuthority,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Authority")]
#[account(2, name="collection_mint", desc="Mint of the Collection")]
#[account(3, name="collection", desc="Metadata Account of the Collection")]
#[account(4, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")]
#[account(5, optional, name="collection_authority_record", desc="Collection Authority Record PDA")]
UnverifyCollection,
#[account(0, writable, name="collection_authority_record", desc="Collection Authority Record PDA")]
#[account(1, name="new_collection_authority", desc="A Collection Authority")]
#[account(2, signer, writable, name="update_authority", desc="Update Authority of Collection NFT")]
#[account(3, signer, writable, name="payer", desc="Payer")]
#[account(4, name="metadata", desc="Collection Metadata account")]
#[account(5, name="mint", desc="Mint of Collection Metadata")]
#[account(6, name="system_program", desc="System program")]
#[account(7, name="rent", desc="Rent info")]
ApproveCollectionAuthority,
#[account(0, writable, name="collection_authority_record", desc="Collection Authority Record PDA")]
#[account(1, signer, writable, name="delegate_authority", desc="Delegated Collection Authority")]
#[account(2, signer, writable, name="revoke_authority", desc="Update Authority, or Delegated Authority, of Collection NFT")]
#[account(3, name="metadata", desc="Metadata account")]
#[account(4, name="mint", desc="Mint of Metadata")]
RevokeCollectionAuthority,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")]
#[account(2, signer, writable, name="payer", desc="Payer")]
#[account(3, name="update_authority", desc="Update Authority of Collection NFT and NFT")]
#[account(4, name="collection_mint", desc="Mint of the Collection")]
#[account(5, name="collection", desc="Metadata Account of the Collection")]
#[account(6, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")]
#[account(7, optional, name="collection_authority_record", desc="Collection Authority Record PDA")]
SetAndVerifyCollection,
#[account(0, signer, writable, name="delegate", desc="Delegate")]
#[account(1, writable, name="token_account", desc="Token account to freeze")]
#[account(2, name="edition", desc="Edition")]
#[account(3, name="mint", desc="Token mint")]
#[account(4, name="token_program", desc="Token Program")]
FreezeDelegatedAccount,
#[account(0, signer, writable, name="delegate", desc="Delegate")]
#[account(1, writable, name="token_account", desc="Token account to thaw")]
#[account(2, name="edition", desc="Edition")]
#[account(3, name="mint", desc="Token mint")]
#[account(4, name="token_program", desc="Token Program")]
ThawDelegatedAccount,
#[account(0, writable, name="metadata", desc="Metadata (pda of ['metadata', program id, mint id])")]
#[account(1, signer, name="creator", desc="Creator")]
RemoveCreatorVerification,
#[account(0, writable, name="metadata", desc="Metadata (pda of ['metadata', program id, mint id])")]
#[account(1, signer, writable, name="owner", desc="NFT owner")]
#[account(2, writable, name="mint", desc="Mint of the NFT")]
#[account(3, writable, name="token_account", desc="Token account to close")]
#[account(4, writable, name="master_edition_account", desc="MasterEdition2 of the NFT")]
#[account(5, name="spl token program", desc="SPL Token Program")]
#[account(6, optional, writable, name="collection_metadata", desc="Metadata of the Collection")]
BurnNft,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, name="collection_authority", desc="Collection Update authority")]
#[account(2, signer, writable, name="payer", desc="payer")]
#[account(3, name="collection_mint", desc="Mint of the Collection")]
#[account(4, writable, name="collection", desc="Metadata Account of the Collection")]
#[account(5, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")]
#[account(6, optional, name="collection_authority_record", desc="Collection Authority Record PDA")]
VerifySizedCollectionItem,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, name="collection_authority", desc="Collection Authority")]
#[account(2, signer, writable, name="payer", desc="payer")]
#[account(3, name="collection_mint", desc="Mint of the Collection")]
#[account(4, writable, name="collection", desc="Metadata Account of the Collection")]
#[account(5, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")]
#[account(6, optional, name="collection_authority_record", desc="Collection Authority Record PDA")]
UnverifySizedCollectionItem,
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, name="collection_authority", desc="Collection Update authority")]
#[account(2, signer, writable, name="payer", desc="payer")]
#[account(3, name="update_authority", desc="Update Authority of Collection NFT and NFT")]
#[account(4, name="collection_mint", desc="Mint of the Collection")]
#[account(5, writable, name="collection", desc="Metadata Account of the Collection")]
#[account(6, writable, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")]
#[account(7, optional, name="collection_authority_record", desc="Collection Authority Record PDA")]
SetAndVerifySizedCollectionItem,
#[account(0, writable, name="metadata", desc="Metadata key (pda of ['metadata', program id, mint id])")]
#[account(1, name="mint", desc="Mint of token asset")]
#[account(2, signer, name="mint_authority", desc="Mint authority")]
#[account(3, signer, writable, name="payer", desc="payer")]
#[account(4, name="update_authority", desc="update authority info")]
#[account(5, name="system_program", desc="System program")]
#[account(6, name="rent", desc="Rent info")]
CreateMetadataAccountV3(CreateMetadataAccountArgsV3),
#[account(0, writable, name="collection_metadata", desc="Collection Metadata account")]
#[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")]
#[account(2, name="collection_mint", desc="Mint of the Collection")]
#[account(3, optional, name="collection_authority_record", desc="Collection Authority Record PDA")]
SetCollectionSize(SetCollectionSizeArgs),
#[account(0, writable, name="metadata", desc="Metadata account")]
#[account(1, signer, writable, name="update_authority", desc="Metadata update authority")]
#[account(2, name="mint", desc="Mint account")]
#[account(3, optional, name="edition", desc="Edition account")]
SetTokenStandard,
}
#[allow(clippy::too_many_arguments)]
pub fn create_metadata_accounts(
program_id: Pubkey,
metadata_account: Pubkey,
mint: Pubkey,
mint_authority: Pubkey,
payer: Pubkey,
update_authority: Pubkey,
name: String,
symbol: String,
uri: String,
creators: Option<Vec<Creator>>,
seller_fee_basis_points: u16,
update_authority_is_signer: bool,
is_mutable: bool,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(update_authority, update_authority_is_signer),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: MetadataInstruction::CreateMetadataAccount(CreateMetadataAccountArgs {
data: Data {
name,
symbol,
uri,
seller_fee_basis_points,
creators,
},
is_mutable,
})
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn create_metadata_accounts_v2(
program_id: Pubkey,
metadata_account: Pubkey,
mint: Pubkey,
mint_authority: Pubkey,
payer: Pubkey,
update_authority: Pubkey,
name: String,
symbol: String,
uri: String,
creators: Option<Vec<Creator>>,
seller_fee_basis_points: u16,
update_authority_is_signer: bool,
is_mutable: bool,
collection: Option<Collection>,
uses: Option<Uses>,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(update_authority, update_authority_is_signer),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: MetadataInstruction::CreateMetadataAccountV2(CreateMetadataAccountArgsV2 {
data: DataV2 {
name,
symbol,
uri,
seller_fee_basis_points,
creators,
collection,
uses,
},
is_mutable,
})
.try_to_vec()
.unwrap(),
}
}
pub fn update_metadata_accounts(
program_id: Pubkey,
metadata_account: Pubkey,
update_authority: Pubkey,
new_update_authority: Option<Pubkey>,
data: Option<Data>,
primary_sale_happened: Option<bool>,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new_readonly(update_authority, true),
],
data: MetadataInstruction::UpdateMetadataAccount(UpdateMetadataAccountArgs {
data,
update_authority: new_update_authority,
primary_sale_happened,
})
.try_to_vec()
.unwrap(),
}
}
pub fn update_metadata_accounts_v2(
program_id: Pubkey,
metadata_account: Pubkey,
update_authority: Pubkey,
new_update_authority: Option<Pubkey>,
data: Option<DataV2>,
primary_sale_happened: Option<bool>,
is_mutable: Option<bool>,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new_readonly(update_authority, true),
],
data: MetadataInstruction::UpdateMetadataAccountV2(UpdateMetadataAccountArgsV2 {
data,
update_authority: new_update_authority,
primary_sale_happened,
is_mutable,
})
.try_to_vec()
.unwrap(),
}
}
pub fn puff_metadata_account(program_id: Pubkey, metadata_account: Pubkey) -> Instruction {
Instruction {
program_id,
accounts: vec![AccountMeta::new(metadata_account, false)],
data: MetadataInstruction::PuffMetadata.try_to_vec().unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn update_primary_sale_happened_via_token(
program_id: Pubkey,
metadata: Pubkey,
owner: Pubkey,
token: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata, false),
AccountMeta::new_readonly(owner, true),
AccountMeta::new_readonly(token, false),
],
data: MetadataInstruction::UpdatePrimarySaleHappenedViaToken
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn create_master_edition(
program_id: Pubkey,
edition: Pubkey,
mint: Pubkey,
update_authority: Pubkey,
mint_authority: Pubkey,
metadata: Pubkey,
payer: Pubkey,
max_supply: Option<u64>,
) -> Instruction {
let accounts = vec![
AccountMeta::new(edition, false),
AccountMeta::new(mint, false),
AccountMeta::new_readonly(update_authority, true),
AccountMeta::new_readonly(mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Instruction {
program_id,
accounts,
data: MetadataInstruction::CreateMasterEdition(CreateMasterEditionArgs { max_supply })
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn create_master_edition_v3(
program_id: Pubkey,
edition: Pubkey,
mint: Pubkey,
update_authority: Pubkey,
mint_authority: Pubkey,
metadata: Pubkey,
payer: Pubkey,
max_supply: Option<u64>,
) -> Instruction {
let accounts = vec![
AccountMeta::new(edition, false),
AccountMeta::new(mint, false),
AccountMeta::new_readonly(update_authority, true),
AccountMeta::new_readonly(mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new(metadata, false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Instruction {
program_id,
accounts,
data: MetadataInstruction::CreateMasterEditionV3(CreateMasterEditionArgs { max_supply })
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn mint_new_edition_from_master_edition_via_token(
program_id: Pubkey,
new_metadata: Pubkey,
new_edition: Pubkey,
master_edition: Pubkey,
new_mint: Pubkey,
new_mint_authority: Pubkey,
payer: Pubkey,
token_account_owner: Pubkey,
token_account: Pubkey,
new_metadata_update_authority: Pubkey,
metadata: Pubkey,
metadata_mint: Pubkey,
edition: u64,
) -> Instruction {
let edition_number = edition.checked_div(EDITION_MARKER_BIT_SIZE).unwrap();
let as_string = edition_number.to_string();
let (edition_mark_pda, _) = Pubkey::find_program_address(
&[
PREFIX.as_bytes(),
program_id.as_ref(),
metadata_mint.as_ref(),
EDITION.as_bytes(),
as_string.as_bytes(),
],
&program_id,
);
let accounts = vec![
AccountMeta::new(new_metadata, false),
AccountMeta::new(new_edition, false),
AccountMeta::new(master_edition, false),
AccountMeta::new(new_mint, false),
AccountMeta::new(edition_mark_pda, false),
AccountMeta::new_readonly(new_mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(token_account_owner, true),
AccountMeta::new_readonly(token_account, false),
AccountMeta::new_readonly(new_metadata_update_authority, false),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Instruction {
program_id,
accounts,
data: MetadataInstruction::MintNewEditionFromMasterEditionViaToken(
MintNewEditionFromMasterEditionViaTokenArgs { edition },
)
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn sign_metadata(program_id: Pubkey, metadata: Pubkey, creator: Pubkey) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata, false),
AccountMeta::new_readonly(creator, true),
],
data: MetadataInstruction::SignMetadata.try_to_vec().unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn remove_creator_verification(
program_id: Pubkey,
metadata: Pubkey,
creator: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata, false),
AccountMeta::new_readonly(creator, true),
],
data: MetadataInstruction::RemoveCreatorVerification
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn convert_master_edition_v1_to_v2(
program_id: Pubkey,
master_edition: Pubkey,
one_time_auth: Pubkey,
printing_mint: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(master_edition, false),
AccountMeta::new(one_time_auth, false),
AccountMeta::new(printing_mint, false),
],
data: MetadataInstruction::ConvertMasterEditionV1ToV2
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn mint_edition_from_master_edition_via_vault_proxy(
program_id: Pubkey,
new_metadata: Pubkey,
new_edition: Pubkey,
master_edition: Pubkey,
new_mint: Pubkey,
edition_mark_pda: Pubkey,
new_mint_authority: Pubkey,
payer: Pubkey,
vault_authority: Pubkey,
safety_deposit_store: Pubkey,
safety_deposit_box: Pubkey,
vault: Pubkey,
new_metadata_update_authority: Pubkey,
metadata: Pubkey,
token_program: Pubkey,
token_vault_program_info: Pubkey,
edition: u64,
) -> Instruction {
let accounts = vec![
AccountMeta::new(new_metadata, false),
AccountMeta::new(new_edition, false),
AccountMeta::new(master_edition, false),
AccountMeta::new(new_mint, false),
AccountMeta::new(edition_mark_pda, false),
AccountMeta::new_readonly(new_mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(vault_authority, true),
AccountMeta::new_readonly(safety_deposit_store, false),
AccountMeta::new_readonly(safety_deposit_box, false),
AccountMeta::new_readonly(vault, false),
AccountMeta::new_readonly(new_metadata_update_authority, false),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(token_program, false),
AccountMeta::new_readonly(token_vault_program_info, false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Instruction {
program_id,
accounts,
data: MetadataInstruction::MintNewEditionFromMasterEditionViaVaultProxy(
MintNewEditionFromMasterEditionViaTokenArgs { edition },
)
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn verify_collection(
program_id: Pubkey,
metadata: Pubkey,
collection_authority: Pubkey,
payer: Pubkey,
collection_mint: Pubkey,
collection: Pubkey,
collection_master_edition_account: Pubkey,
collection_authority_record: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new(collection_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(collection_mint, false),
AccountMeta::new_readonly(collection, false),
AccountMeta::new_readonly(collection_master_edition_account, false),
];
match collection_authority_record {
Some(collection_authority_record) => {
accounts.push(AccountMeta::new_readonly(
collection_authority_record,
false,
));
}
None => (),
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::VerifyCollection.try_to_vec().unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn unverify_collection(
program_id: Pubkey,
metadata: Pubkey,
collection_authority: Pubkey,
collection_mint: Pubkey,
collection: Pubkey,
collection_master_edition_account: Pubkey,
collection_authority_record: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new(collection_authority, true),
AccountMeta::new_readonly(collection_mint, false),
AccountMeta::new_readonly(collection, false),
AccountMeta::new_readonly(collection_master_edition_account, false),
];
match collection_authority_record {
Some(collection_authority_record) => {
accounts.push(AccountMeta::new_readonly(
collection_authority_record,
false,
));
}
None => (),
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::UnverifyCollection
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn utilize(
program_id: Pubkey,
metadata: Pubkey,
token_account: Pubkey,
mint: Pubkey,
use_authority_record_pda: Option<Pubkey>,
use_authority: Pubkey,
owner: Pubkey,
burner: Option<Pubkey>,
number_of_uses: u64,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new(token_account, false),
AccountMeta::new(mint, false),
AccountMeta::new(use_authority, true),
AccountMeta::new_readonly(owner, false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(spl_associated_token_account::id(), false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
match use_authority_record_pda {
Some(use_authority_record_pda) => {
accounts.push(AccountMeta::new(use_authority_record_pda, false));
}
None => (),
}
match burner {
Some(burner) => {
accounts.push(AccountMeta::new_readonly(burner, false));
}
None => (),
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::Utilize(UtilizeArgs { number_of_uses })
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn approve_use_authority(
program_id: Pubkey,
use_authority_record: Pubkey,
user: Pubkey,
owner: Pubkey,
payer: Pubkey,
owner_token_account: Pubkey,
metadata: Pubkey,
mint: Pubkey,
burner: Pubkey,
number_of_uses: u64,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(use_authority_record, false),
AccountMeta::new(owner, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(user, false),
AccountMeta::new(owner_token_account, false),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(burner, false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: MetadataInstruction::ApproveUseAuthority(ApproveUseAuthorityArgs { number_of_uses })
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn revoke_use_authority(
program_id: Pubkey,
use_authority_record: Pubkey,
user: Pubkey,
owner: Pubkey,
owner_token_account: Pubkey,
metadata: Pubkey,
mint: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(use_authority_record, false),
AccountMeta::new(owner, true),
AccountMeta::new_readonly(user, false),
AccountMeta::new(owner_token_account, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: MetadataInstruction::RevokeUseAuthority
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn approve_collection_authority(
program_id: Pubkey,
collection_authority_record: Pubkey,
new_collection_authority: Pubkey,
update_authority: Pubkey,
payer: Pubkey,
metadata: Pubkey,
mint: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(collection_authority_record, false),
AccountMeta::new_readonly(new_collection_authority, false),
AccountMeta::new(update_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: MetadataInstruction::ApproveCollectionAuthority
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn revoke_collection_authority(
program_id: Pubkey,
collection_authority_record: Pubkey,
delegate_authority: Pubkey,
revoke_authority: Pubkey,
metadata: Pubkey,
mint: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(collection_authority_record, false),
AccountMeta::new_readonly(delegate_authority, false),
AccountMeta::new(revoke_authority, true),
AccountMeta::new_readonly(metadata, false),
AccountMeta::new_readonly(mint, false),
],
data: MetadataInstruction::RevokeCollectionAuthority
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn set_and_verify_collection(
program_id: Pubkey,
metadata: Pubkey,
collection_authority: Pubkey,
payer: Pubkey,
update_authority: Pubkey,
collection_mint: Pubkey,
collection: Pubkey,
collection_master_edition_account: Pubkey,
collection_authority_record: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new(collection_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(update_authority, false),
AccountMeta::new_readonly(collection_mint, false),
AccountMeta::new_readonly(collection, false),
AccountMeta::new_readonly(collection_master_edition_account, false),
];
match collection_authority_record {
Some(collection_authority_record) => {
accounts.push(AccountMeta::new_readonly(
collection_authority_record,
false,
));
}
None => (),
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::SetAndVerifyCollection
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn freeze_delegated_account(
program_id: Pubkey,
delegate: Pubkey,
token_account: Pubkey,
edition: Pubkey,
mint: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(delegate, true),
AccountMeta::new(token_account, false),
AccountMeta::new_readonly(edition, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(spl_token::id(), false),
],
data: MetadataInstruction::FreezeDelegatedAccount
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn thaw_delegated_account(
program_id: Pubkey,
delegate: Pubkey,
token_account: Pubkey,
edition: Pubkey,
mint: Pubkey,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(delegate, true),
AccountMeta::new(token_account, false),
AccountMeta::new_readonly(edition, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(spl_token::id(), false),
],
data: MetadataInstruction::ThawDelegatedAccount
.try_to_vec()
.unwrap(),
}
}
pub fn burn_nft(
program_id: Pubkey,
metadata: Pubkey,
owner: Pubkey,
mint: Pubkey,
token: Pubkey,
edition: Pubkey,
spl_token: Pubkey,
collection_metadata: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new(owner, true),
AccountMeta::new(mint, false),
AccountMeta::new(token, false),
AccountMeta::new(edition, false),
AccountMeta::new_readonly(spl_token, false),
];
if let Some(collection_metadata) = collection_metadata {
accounts.push(AccountMeta::new(collection_metadata, false));
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::BurnNft.try_to_vec().unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn verify_sized_collection_item(
program_id: Pubkey,
metadata: Pubkey,
collection_authority: Pubkey,
payer: Pubkey,
collection_mint: Pubkey,
collection: Pubkey,
collection_master_edition_account: Pubkey,
collection_authority_record: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new_readonly(collection_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(collection_mint, false),
AccountMeta::new(collection, false),
AccountMeta::new_readonly(collection_master_edition_account, false),
];
if let Some(record) = collection_authority_record {
accounts.push(AccountMeta::new_readonly(record, false));
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::VerifySizedCollectionItem
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn unverify_sized_collection_item(
program_id: Pubkey,
metadata: Pubkey,
collection_authority: Pubkey,
payer: Pubkey,
collection_mint: Pubkey,
collection: Pubkey,
collection_master_edition_account: Pubkey,
collection_authority_record: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new_readonly(collection_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(collection_mint, false),
AccountMeta::new(collection, false),
AccountMeta::new_readonly(collection_master_edition_account, false),
];
match collection_authority_record {
Some(collection_authority_record) => {
accounts.push(AccountMeta::new_readonly(
collection_authority_record,
false,
));
}
None => (),
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::UnverifySizedCollectionItem
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn set_and_verify_sized_collection_item(
program_id: Pubkey,
metadata: Pubkey,
collection_authority: Pubkey,
payer: Pubkey,
update_authority: Pubkey,
collection_mint: Pubkey,
collection: Pubkey,
collection_master_edition_account: Pubkey,
collection_authority_record: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata, false),
AccountMeta::new(collection_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(update_authority, false),
AccountMeta::new_readonly(collection_mint, false),
AccountMeta::new(collection, false),
AccountMeta::new_readonly(collection_master_edition_account, false),
];
match collection_authority_record {
Some(collection_authority_record) => {
accounts.push(AccountMeta::new_readonly(
collection_authority_record,
false,
));
}
None => (),
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::SetAndVerifySizedCollectionItem
.try_to_vec()
.unwrap(),
}
}
#[allow(clippy::too_many_arguments)]
pub fn create_metadata_accounts_v3(
program_id: Pubkey,
metadata_account: Pubkey,
mint: Pubkey,
mint_authority: Pubkey,
payer: Pubkey,
update_authority: Pubkey,
name: String,
symbol: String,
uri: String,
creators: Option<Vec<Creator>>,
seller_fee_basis_points: u16,
update_authority_is_signer: bool,
is_mutable: bool,
collection: Option<Collection>,
uses: Option<Uses>,
collection_details: Option<CollectionDetails>,
) -> Instruction {
Instruction {
program_id,
accounts: vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new_readonly(mint, false),
AccountMeta::new_readonly(mint_authority, true),
AccountMeta::new(payer, true),
AccountMeta::new_readonly(update_authority, update_authority_is_signer),
AccountMeta::new_readonly(solana_program::system_program::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: MetadataInstruction::CreateMetadataAccountV3(CreateMetadataAccountArgsV3 {
data: DataV2 {
name,
symbol,
uri,
seller_fee_basis_points,
creators,
collection,
uses,
},
is_mutable,
collection_details,
})
.try_to_vec()
.unwrap(),
}
}
pub fn set_collection_size(
program_id: Pubkey,
metadata_account: Pubkey,
update_authority: Pubkey,
mint: Pubkey,
collection_authority_record: Option<Pubkey>,
size: u64,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new_readonly(update_authority, true),
AccountMeta::new_readonly(mint, false),
];
if let Some(record) = collection_authority_record {
accounts.push(AccountMeta::new_readonly(record, false));
}
Instruction {
program_id,
accounts,
data: MetadataInstruction::SetCollectionSize(SetCollectionSizeArgs { size })
.try_to_vec()
.unwrap(),
}
}
pub fn set_token_standard(
program_id: Pubkey,
metadata_account: Pubkey,
update_authority: Pubkey,
mint_account: Pubkey,
edition_account: Option<Pubkey>,
) -> Instruction {
let mut accounts = vec![
AccountMeta::new(metadata_account, false),
AccountMeta::new(update_authority, true),
AccountMeta::new_readonly(mint_account, false),
];
let data = MetadataInstruction::SetTokenStandard.try_to_vec().unwrap();
if let Some(edition_account) = edition_account {
accounts.push(AccountMeta::new_readonly(edition_account, false));
}
Instruction {
program_id,
accounts,
data,
}
}