use crate::generated::types::Collection;
use crate::generated::types::CollectionDetails;
use crate::generated::types::Creator;
use crate::generated::types::PrintSupply;
use crate::generated::types::TokenStandard;
use crate::generated::types::Uses;
#[cfg(feature = "anchor")]
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
#[cfg(not(feature = "anchor"))]
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::pubkey::Pubkey;
pub struct CreateV1 {
pub metadata: solana_program::pubkey::Pubkey,
pub master_edition: Option<solana_program::pubkey::Pubkey>,
pub mint: (solana_program::pubkey::Pubkey, bool),
pub authority: solana_program::pubkey::Pubkey,
pub payer: solana_program::pubkey::Pubkey,
pub update_authority: (solana_program::pubkey::Pubkey, bool),
pub system_program: solana_program::pubkey::Pubkey,
pub sysvar_instructions: solana_program::pubkey::Pubkey,
pub spl_token_program: Option<solana_program::pubkey::Pubkey>,
}
impl CreateV1 {
pub fn instruction(
&self,
args: CreateV1InstructionArgs,
) -> solana_program::instruction::Instruction {
self.instruction_with_remaining_accounts(args, &[])
}
#[allow(clippy::vec_init_then_push)]
pub fn instruction_with_remaining_accounts(
&self,
args: CreateV1InstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(9 + remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new(
self.metadata,
false,
));
if let Some(master_edition) = self.master_edition {
accounts.push(solana_program::instruction::AccountMeta::new(
master_edition,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_TOKEN_METADATA_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new(
self.mint.0,
self.mint.1,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.authority,
true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.payer, true,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.update_authority.0,
self.update_authority.1,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.system_program,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.sysvar_instructions,
false,
));
if let Some(spl_token_program) = self.spl_token_program {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
spl_token_program,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_TOKEN_METADATA_ID,
false,
));
}
accounts.extend_from_slice(remaining_accounts);
let mut data = borsh::to_vec(&(CreateV1InstructionData::new())).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);
solana_program::instruction::Instruction {
program_id: crate::MPL_TOKEN_METADATA_ID,
accounts,
data,
}
}
}
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
pub struct CreateV1InstructionData {
discriminator: u8,
create_v1_discriminator: u8,
}
impl CreateV1InstructionData {
pub fn new() -> Self {
Self {
discriminator: 42,
create_v1_discriminator: 0,
}
}
}
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CreateV1InstructionArgs {
pub name: String,
pub symbol: String,
pub uri: String,
pub seller_fee_basis_points: u16,
pub creators: Option<Vec<Creator>>,
pub primary_sale_happened: bool,
pub is_mutable: bool,
pub token_standard: TokenStandard,
pub collection: Option<Collection>,
pub uses: Option<Uses>,
pub collection_details: Option<CollectionDetails>,
pub rule_set: Option<Pubkey>,
pub decimals: Option<u8>,
pub print_supply: Option<PrintSupply>,
}
#[derive(Default)]
pub struct CreateV1Builder {
metadata: Option<solana_program::pubkey::Pubkey>,
master_edition: Option<solana_program::pubkey::Pubkey>,
mint: Option<(solana_program::pubkey::Pubkey, bool)>,
authority: Option<solana_program::pubkey::Pubkey>,
payer: Option<solana_program::pubkey::Pubkey>,
update_authority: Option<(solana_program::pubkey::Pubkey, bool)>,
system_program: Option<solana_program::pubkey::Pubkey>,
sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
spl_token_program: Option<solana_program::pubkey::Pubkey>,
name: Option<String>,
symbol: Option<String>,
uri: Option<String>,
seller_fee_basis_points: Option<u16>,
creators: Option<Vec<Creator>>,
primary_sale_happened: Option<bool>,
is_mutable: Option<bool>,
token_standard: Option<TokenStandard>,
collection: Option<Collection>,
uses: Option<Uses>,
collection_details: Option<CollectionDetails>,
rule_set: Option<Pubkey>,
decimals: Option<u8>,
print_supply: Option<PrintSupply>,
__remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
}
impl CreateV1Builder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self {
self.metadata = Some(metadata);
self
}
#[inline(always)]
pub fn master_edition(
&mut self,
master_edition: Option<solana_program::pubkey::Pubkey>,
) -> &mut Self {
self.master_edition = master_edition;
self
}
#[inline(always)]
pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey, as_signer: bool) -> &mut Self {
self.mint = Some((mint, as_signer));
self
}
#[inline(always)]
pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self {
self.authority = Some(authority);
self
}
#[inline(always)]
pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
self.payer = Some(payer);
self
}
#[inline(always)]
pub fn update_authority(
&mut self,
update_authority: solana_program::pubkey::Pubkey,
as_signer: bool,
) -> &mut Self {
self.update_authority = Some((update_authority, as_signer));
self
}
#[inline(always)]
pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
self.system_program = Some(system_program);
self
}
#[inline(always)]
pub fn sysvar_instructions(
&mut self,
sysvar_instructions: solana_program::pubkey::Pubkey,
) -> &mut Self {
self.sysvar_instructions = Some(sysvar_instructions);
self
}
#[inline(always)]
pub fn spl_token_program(
&mut self,
spl_token_program: Option<solana_program::pubkey::Pubkey>,
) -> &mut Self {
self.spl_token_program = spl_token_program;
self
}
#[inline(always)]
pub fn name(&mut self, name: String) -> &mut Self {
self.name = Some(name);
self
}
#[inline(always)]
pub fn symbol(&mut self, symbol: String) -> &mut Self {
self.symbol = Some(symbol);
self
}
#[inline(always)]
pub fn uri(&mut self, uri: String) -> &mut Self {
self.uri = Some(uri);
self
}
#[inline(always)]
pub fn seller_fee_basis_points(&mut self, seller_fee_basis_points: u16) -> &mut Self {
self.seller_fee_basis_points = Some(seller_fee_basis_points);
self
}
#[inline(always)]
pub fn creators(&mut self, creators: Vec<Creator>) -> &mut Self {
self.creators = Some(creators);
self
}
#[inline(always)]
pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self {
self.primary_sale_happened = Some(primary_sale_happened);
self
}
#[inline(always)]
pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self {
self.is_mutable = Some(is_mutable);
self
}
#[inline(always)]
pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self {
self.token_standard = Some(token_standard);
self
}
#[inline(always)]
pub fn collection(&mut self, collection: Collection) -> &mut Self {
self.collection = Some(collection);
self
}
#[inline(always)]
pub fn uses(&mut self, uses: Uses) -> &mut Self {
self.uses = Some(uses);
self
}
#[inline(always)]
pub fn collection_details(&mut self, collection_details: CollectionDetails) -> &mut Self {
self.collection_details = Some(collection_details);
self
}
#[inline(always)]
pub fn rule_set(&mut self, rule_set: Pubkey) -> &mut Self {
self.rule_set = Some(rule_set);
self
}
#[inline(always)]
pub fn decimals(&mut self, decimals: u8) -> &mut Self {
self.decimals = Some(decimals);
self
}
#[inline(always)]
pub fn print_supply(&mut self, print_supply: PrintSupply) -> &mut Self {
self.print_supply = Some(print_supply);
self
}
#[inline(always)]
pub fn add_remaining_account(
&mut self,
account: solana_program::instruction::AccountMeta,
) -> &mut Self {
self.__remaining_accounts.push(account);
self
}
#[inline(always)]
pub fn add_remaining_accounts(
&mut self,
accounts: &[solana_program::instruction::AccountMeta],
) -> &mut Self {
self.__remaining_accounts.extend_from_slice(accounts);
self
}
#[allow(clippy::clone_on_copy)]
pub fn instruction(&self) -> solana_program::instruction::Instruction {
let accounts = CreateV1 {
metadata: self.metadata.expect("metadata is not set"),
master_edition: self.master_edition,
mint: self.mint.expect("mint is not set"),
authority: self.authority.expect("authority is not set"),
payer: self.payer.expect("payer is not set"),
update_authority: self.update_authority.expect("update_authority is not set"),
system_program: self
.system_program
.unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!(
"Sysvar1nstructions1111111111111111111111111"
)),
spl_token_program: self.spl_token_program,
};
let args = CreateV1InstructionArgs {
name: self.name.clone().expect("name is not set"),
symbol: self.symbol.clone().unwrap_or(String::from("")),
uri: self.uri.clone().expect("uri is not set"),
seller_fee_basis_points: self
.seller_fee_basis_points
.clone()
.expect("seller_fee_basis_points is not set"),
creators: self.creators.clone(),
primary_sale_happened: self.primary_sale_happened.clone().unwrap_or(false),
is_mutable: self.is_mutable.clone().unwrap_or(true),
token_standard: self
.token_standard
.clone()
.unwrap_or(TokenStandard::NonFungible),
collection: self.collection.clone(),
uses: self.uses.clone(),
collection_details: self.collection_details.clone(),
rule_set: self.rule_set.clone(),
decimals: self.decimals.clone(),
print_supply: self.print_supply.clone(),
};
accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
}
}
pub struct CreateV1CpiAccounts<'a, 'b> {
pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
pub master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub mint: (&'b solana_program::account_info::AccountInfo<'a>, bool),
pub authority: &'b solana_program::account_info::AccountInfo<'a>,
pub payer: &'b solana_program::account_info::AccountInfo<'a>,
pub update_authority: (&'b solana_program::account_info::AccountInfo<'a>, bool),
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
pub spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
}
pub struct CreateV1Cpi<'a, 'b> {
pub __program: &'b solana_program::account_info::AccountInfo<'a>,
pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
pub master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub mint: (&'b solana_program::account_info::AccountInfo<'a>, bool),
pub authority: &'b solana_program::account_info::AccountInfo<'a>,
pub payer: &'b solana_program::account_info::AccountInfo<'a>,
pub update_authority: (&'b solana_program::account_info::AccountInfo<'a>, bool),
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
pub spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub __args: CreateV1InstructionArgs,
}
impl<'a, 'b> CreateV1Cpi<'a, 'b> {
pub fn new(
program: &'b solana_program::account_info::AccountInfo<'a>,
accounts: CreateV1CpiAccounts<'a, 'b>,
args: CreateV1InstructionArgs,
) -> Self {
Self {
__program: program,
metadata: accounts.metadata,
master_edition: accounts.master_edition,
mint: accounts.mint,
authority: accounts.authority,
payer: accounts.payer,
update_authority: accounts.update_authority,
system_program: accounts.system_program,
sysvar_instructions: accounts.sysvar_instructions,
spl_token_program: accounts.spl_token_program,
__args: args,
}
}
#[inline(always)]
pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed_with_remaining_accounts(&[], &[])
}
#[inline(always)]
pub fn invoke_with_remaining_accounts(
&self,
remaining_accounts: &[(
&'b solana_program::account_info::AccountInfo<'a>,
bool,
bool,
)],
) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
}
#[inline(always)]
pub fn invoke_signed(
&self,
signers_seeds: &[&[&[u8]]],
) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
}
#[allow(clippy::clone_on_copy)]
#[allow(clippy::vec_init_then_push)]
pub fn invoke_signed_with_remaining_accounts(
&self,
signers_seeds: &[&[&[u8]]],
remaining_accounts: &[(
&'b solana_program::account_info::AccountInfo<'a>,
bool,
bool,
)],
) -> solana_program::entrypoint::ProgramResult {
let mut accounts = Vec::with_capacity(9 + remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new(
*self.metadata.key,
false,
));
if let Some(master_edition) = self.master_edition {
accounts.push(solana_program::instruction::AccountMeta::new(
*master_edition.key,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_TOKEN_METADATA_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new(
*self.mint.0.key,
self.mint.1,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.authority.key,
true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.payer.key,
true,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.update_authority.0.key,
self.update_authority.1,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.system_program.key,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.sysvar_instructions.key,
false,
));
if let Some(spl_token_program) = self.spl_token_program {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*spl_token_program.key,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_TOKEN_METADATA_ID,
false,
));
}
remaining_accounts.iter().for_each(|remaining_account| {
accounts.push(solana_program::instruction::AccountMeta {
pubkey: *remaining_account.0.key,
is_writable: remaining_account.1,
is_signer: remaining_account.2,
})
});
let mut data = borsh::to_vec(&(CreateV1InstructionData::new())).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);
let instruction = solana_program::instruction::Instruction {
program_id: crate::MPL_TOKEN_METADATA_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(9 + 1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.metadata.clone());
if let Some(master_edition) = self.master_edition {
account_infos.push(master_edition.clone());
}
account_infos.push(self.mint.0.clone());
account_infos.push(self.authority.clone());
account_infos.push(self.payer.clone());
account_infos.push(self.update_authority.0.clone());
account_infos.push(self.system_program.clone());
account_infos.push(self.sysvar_instructions.clone());
if let Some(spl_token_program) = self.spl_token_program {
account_infos.push(spl_token_program.clone());
}
remaining_accounts
.iter()
.for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
if signers_seeds.is_empty() {
solana_program::program::invoke(&instruction, &account_infos)
} else {
solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
}
}
}
pub struct CreateV1CpiBuilder<'a, 'b> {
instruction: Box<CreateV1CpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> CreateV1CpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(CreateV1CpiBuilderInstruction {
__program: program,
metadata: None,
master_edition: None,
mint: None,
authority: None,
payer: None,
update_authority: None,
system_program: None,
sysvar_instructions: None,
spl_token_program: None,
name: None,
symbol: None,
uri: None,
seller_fee_basis_points: None,
creators: None,
primary_sale_happened: None,
is_mutable: None,
token_standard: None,
collection: None,
uses: None,
collection_details: None,
rule_set: None,
decimals: None,
print_supply: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[inline(always)]
pub fn metadata(
&mut self,
metadata: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.metadata = Some(metadata);
self
}
#[inline(always)]
pub fn master_edition(
&mut self,
master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
) -> &mut Self {
self.instruction.master_edition = master_edition;
self
}
#[inline(always)]
pub fn mint(
&mut self,
mint: &'b solana_program::account_info::AccountInfo<'a>,
as_signer: bool,
) -> &mut Self {
self.instruction.mint = Some((mint, as_signer));
self
}
#[inline(always)]
pub fn authority(
&mut self,
authority: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.authority = Some(authority);
self
}
#[inline(always)]
pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
self.instruction.payer = Some(payer);
self
}
#[inline(always)]
pub fn update_authority(
&mut self,
update_authority: &'b solana_program::account_info::AccountInfo<'a>,
as_signer: bool,
) -> &mut Self {
self.instruction.update_authority = Some((update_authority, as_signer));
self
}
#[inline(always)]
pub fn system_program(
&mut self,
system_program: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.system_program = Some(system_program);
self
}
#[inline(always)]
pub fn sysvar_instructions(
&mut self,
sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.sysvar_instructions = Some(sysvar_instructions);
self
}
#[inline(always)]
pub fn spl_token_program(
&mut self,
spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
) -> &mut Self {
self.instruction.spl_token_program = spl_token_program;
self
}
#[inline(always)]
pub fn name(&mut self, name: String) -> &mut Self {
self.instruction.name = Some(name);
self
}
#[inline(always)]
pub fn symbol(&mut self, symbol: String) -> &mut Self {
self.instruction.symbol = Some(symbol);
self
}
#[inline(always)]
pub fn uri(&mut self, uri: String) -> &mut Self {
self.instruction.uri = Some(uri);
self
}
#[inline(always)]
pub fn seller_fee_basis_points(&mut self, seller_fee_basis_points: u16) -> &mut Self {
self.instruction.seller_fee_basis_points = Some(seller_fee_basis_points);
self
}
#[inline(always)]
pub fn creators(&mut self, creators: Vec<Creator>) -> &mut Self {
self.instruction.creators = Some(creators);
self
}
#[inline(always)]
pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self {
self.instruction.primary_sale_happened = Some(primary_sale_happened);
self
}
#[inline(always)]
pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self {
self.instruction.is_mutable = Some(is_mutable);
self
}
#[inline(always)]
pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self {
self.instruction.token_standard = Some(token_standard);
self
}
#[inline(always)]
pub fn collection(&mut self, collection: Collection) -> &mut Self {
self.instruction.collection = Some(collection);
self
}
#[inline(always)]
pub fn uses(&mut self, uses: Uses) -> &mut Self {
self.instruction.uses = Some(uses);
self
}
#[inline(always)]
pub fn collection_details(&mut self, collection_details: CollectionDetails) -> &mut Self {
self.instruction.collection_details = Some(collection_details);
self
}
#[inline(always)]
pub fn rule_set(&mut self, rule_set: Pubkey) -> &mut Self {
self.instruction.rule_set = Some(rule_set);
self
}
#[inline(always)]
pub fn decimals(&mut self, decimals: u8) -> &mut Self {
self.instruction.decimals = Some(decimals);
self
}
#[inline(always)]
pub fn print_supply(&mut self, print_supply: PrintSupply) -> &mut Self {
self.instruction.print_supply = Some(print_supply);
self
}
#[inline(always)]
pub fn add_remaining_account(
&mut self,
account: &'b solana_program::account_info::AccountInfo<'a>,
is_writable: bool,
is_signer: bool,
) -> &mut Self {
self.instruction
.__remaining_accounts
.push((account, is_writable, is_signer));
self
}
#[inline(always)]
pub fn add_remaining_accounts(
&mut self,
accounts: &[(
&'b solana_program::account_info::AccountInfo<'a>,
bool,
bool,
)],
) -> &mut Self {
self.instruction
.__remaining_accounts
.extend_from_slice(accounts);
self
}
#[inline(always)]
pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
self.invoke_signed(&[])
}
#[allow(clippy::clone_on_copy)]
#[allow(clippy::vec_init_then_push)]
pub fn invoke_signed(
&self,
signers_seeds: &[&[&[u8]]],
) -> solana_program::entrypoint::ProgramResult {
let args = CreateV1InstructionArgs {
name: self.instruction.name.clone().expect("name is not set"),
symbol: self.instruction.symbol.clone().unwrap_or(String::from("")),
uri: self.instruction.uri.clone().expect("uri is not set"),
seller_fee_basis_points: self
.instruction
.seller_fee_basis_points
.clone()
.expect("seller_fee_basis_points is not set"),
creators: self.instruction.creators.clone(),
primary_sale_happened: self
.instruction
.primary_sale_happened
.clone()
.unwrap_or(false),
is_mutable: self.instruction.is_mutable.clone().unwrap_or(true),
token_standard: self
.instruction
.token_standard
.clone()
.unwrap_or(TokenStandard::NonFungible),
collection: self.instruction.collection.clone(),
uses: self.instruction.uses.clone(),
collection_details: self.instruction.collection_details.clone(),
rule_set: self.instruction.rule_set.clone(),
decimals: self.instruction.decimals.clone(),
print_supply: self.instruction.print_supply.clone(),
};
let instruction = CreateV1Cpi {
__program: self.instruction.__program,
metadata: self.instruction.metadata.expect("metadata is not set"),
master_edition: self.instruction.master_edition,
mint: self.instruction.mint.expect("mint is not set"),
authority: self.instruction.authority.expect("authority is not set"),
payer: self.instruction.payer.expect("payer is not set"),
update_authority: self
.instruction
.update_authority
.expect("update_authority is not set"),
system_program: self
.instruction
.system_program
.expect("system_program is not set"),
sysvar_instructions: self
.instruction
.sysvar_instructions
.expect("sysvar_instructions is not set"),
spl_token_program: self.instruction.spl_token_program,
__args: args,
};
instruction.invoke_signed_with_remaining_accounts(
signers_seeds,
&self.instruction.__remaining_accounts,
)
}
}
struct CreateV1CpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
master_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>,
mint: Option<(&'b solana_program::account_info::AccountInfo<'a>, bool)>,
authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
update_authority: Option<(&'b solana_program::account_info::AccountInfo<'a>, bool)>,
system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
spl_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
name: Option<String>,
symbol: Option<String>,
uri: Option<String>,
seller_fee_basis_points: Option<u16>,
creators: Option<Vec<Creator>>,
primary_sale_happened: Option<bool>,
is_mutable: Option<bool>,
token_standard: Option<TokenStandard>,
collection: Option<Collection>,
uses: Option<Uses>,
collection_details: Option<CollectionDetails>,
rule_set: Option<Pubkey>,
decimals: Option<u8>,
print_supply: Option<PrintSupply>,
__remaining_accounts: Vec<(
&'b solana_program::account_info::AccountInfo<'a>,
bool,
bool,
)>,
}