#[cfg(feature = "anchor")]
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
#[cfg(not(feature = "anchor"))]
use borsh::{BorshDeserialize, BorshSerialize};
pub struct BurnV2 {
pub tree_config: solana_program::pubkey::Pubkey,
pub payer: solana_program::pubkey::Pubkey,
pub authority: Option<solana_program::pubkey::Pubkey>,
pub leaf_owner: solana_program::pubkey::Pubkey,
pub leaf_delegate: Option<solana_program::pubkey::Pubkey>,
pub merkle_tree: solana_program::pubkey::Pubkey,
pub core_collection: Option<solana_program::pubkey::Pubkey>,
pub mpl_core_cpi_signer: Option<solana_program::pubkey::Pubkey>,
pub log_wrapper: solana_program::pubkey::Pubkey,
pub compression_program: solana_program::pubkey::Pubkey,
pub mpl_core_program: solana_program::pubkey::Pubkey,
pub system_program: solana_program::pubkey::Pubkey,
}
impl BurnV2 {
pub fn instruction(
&self,
args: BurnV2InstructionArgs,
) -> solana_program::instruction::Instruction {
self.instruction_with_remaining_accounts(args, &[])
}
#[allow(clippy::vec_init_then_push)]
pub fn instruction_with_remaining_accounts(
&self,
args: BurnV2InstructionArgs,
remaining_accounts: &[solana_program::instruction::AccountMeta],
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(12 + remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new(
self.tree_config,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.payer, true,
));
if let Some(authority) = self.authority {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
authority, true,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.leaf_owner,
false,
));
if let Some(leaf_delegate) = self.leaf_delegate {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
leaf_delegate,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new(
self.merkle_tree,
false,
));
if let Some(core_collection) = self.core_collection {
accounts.push(solana_program::instruction::AccountMeta::new(
core_collection,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
if let Some(mpl_core_cpi_signer) = self.mpl_core_cpi_signer {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
mpl_core_cpi_signer,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.log_wrapper,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.compression_program,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.mpl_core_program,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
self.system_program,
false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = borsh::to_vec(&(BurnV2InstructionData::new())).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);
solana_program::instruction::Instruction {
program_id: crate::MPL_BUBBLEGUM_ID,
accounts,
data,
}
}
}
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
pub struct BurnV2InstructionData {
discriminator: [u8; 8],
}
impl BurnV2InstructionData {
pub fn new() -> Self {
Self {
discriminator: [115, 210, 34, 240, 232, 143, 183, 16],
}
}
}
#[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 BurnV2InstructionArgs {
pub root: [u8; 32],
pub data_hash: [u8; 32],
pub creator_hash: [u8; 32],
pub asset_data_hash: Option<[u8; 32]>,
pub flags: Option<u8>,
pub nonce: u64,
pub index: u32,
}
#[derive(Default)]
pub struct BurnV2Builder {
tree_config: Option<solana_program::pubkey::Pubkey>,
payer: Option<solana_program::pubkey::Pubkey>,
authority: Option<solana_program::pubkey::Pubkey>,
leaf_owner: Option<solana_program::pubkey::Pubkey>,
leaf_delegate: Option<solana_program::pubkey::Pubkey>,
merkle_tree: Option<solana_program::pubkey::Pubkey>,
core_collection: Option<solana_program::pubkey::Pubkey>,
mpl_core_cpi_signer: Option<solana_program::pubkey::Pubkey>,
log_wrapper: Option<solana_program::pubkey::Pubkey>,
compression_program: Option<solana_program::pubkey::Pubkey>,
mpl_core_program: Option<solana_program::pubkey::Pubkey>,
system_program: Option<solana_program::pubkey::Pubkey>,
root: Option<[u8; 32]>,
data_hash: Option<[u8; 32]>,
creator_hash: Option<[u8; 32]>,
asset_data_hash: Option<[u8; 32]>,
flags: Option<u8>,
nonce: Option<u64>,
index: Option<u32>,
__remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
}
impl BurnV2Builder {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn tree_config(&mut self, tree_config: solana_program::pubkey::Pubkey) -> &mut Self {
self.tree_config = Some(tree_config);
self
}
#[inline(always)]
pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
self.payer = Some(payer);
self
}
#[inline(always)]
pub fn authority(&mut self, authority: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
self.authority = authority;
self
}
#[inline(always)]
pub fn leaf_owner(&mut self, leaf_owner: solana_program::pubkey::Pubkey) -> &mut Self {
self.leaf_owner = Some(leaf_owner);
self
}
#[inline(always)]
pub fn leaf_delegate(
&mut self,
leaf_delegate: Option<solana_program::pubkey::Pubkey>,
) -> &mut Self {
self.leaf_delegate = leaf_delegate;
self
}
#[inline(always)]
pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self {
self.merkle_tree = Some(merkle_tree);
self
}
#[inline(always)]
pub fn core_collection(
&mut self,
core_collection: Option<solana_program::pubkey::Pubkey>,
) -> &mut Self {
self.core_collection = core_collection;
self
}
#[inline(always)]
pub fn mpl_core_cpi_signer(
&mut self,
mpl_core_cpi_signer: Option<solana_program::pubkey::Pubkey>,
) -> &mut Self {
self.mpl_core_cpi_signer = mpl_core_cpi_signer;
self
}
#[inline(always)]
pub fn log_wrapper(&mut self, log_wrapper: solana_program::pubkey::Pubkey) -> &mut Self {
self.log_wrapper = Some(log_wrapper);
self
}
#[inline(always)]
pub fn compression_program(
&mut self,
compression_program: solana_program::pubkey::Pubkey,
) -> &mut Self {
self.compression_program = Some(compression_program);
self
}
#[inline(always)]
pub fn mpl_core_program(
&mut self,
mpl_core_program: solana_program::pubkey::Pubkey,
) -> &mut Self {
self.mpl_core_program = Some(mpl_core_program);
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 root(&mut self, root: [u8; 32]) -> &mut Self {
self.root = Some(root);
self
}
#[inline(always)]
pub fn data_hash(&mut self, data_hash: [u8; 32]) -> &mut Self {
self.data_hash = Some(data_hash);
self
}
#[inline(always)]
pub fn creator_hash(&mut self, creator_hash: [u8; 32]) -> &mut Self {
self.creator_hash = Some(creator_hash);
self
}
#[inline(always)]
pub fn asset_data_hash(&mut self, asset_data_hash: [u8; 32]) -> &mut Self {
self.asset_data_hash = Some(asset_data_hash);
self
}
#[inline(always)]
pub fn flags(&mut self, flags: u8) -> &mut Self {
self.flags = Some(flags);
self
}
#[inline(always)]
pub fn nonce(&mut self, nonce: u64) -> &mut Self {
self.nonce = Some(nonce);
self
}
#[inline(always)]
pub fn index(&mut self, index: u32) -> &mut Self {
self.index = Some(index);
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 = BurnV2 {
tree_config: self.tree_config.expect("tree_config is not set"),
payer: self.payer.expect("payer is not set"),
authority: self.authority,
leaf_owner: self.leaf_owner.expect("leaf_owner is not set"),
leaf_delegate: self.leaf_delegate,
merkle_tree: self.merkle_tree.expect("merkle_tree is not set"),
core_collection: self.core_collection,
mpl_core_cpi_signer: self.mpl_core_cpi_signer,
log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!(
"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3"
)),
compression_program: self.compression_program.unwrap_or(solana_program::pubkey!(
"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW"
)),
mpl_core_program: self.mpl_core_program.unwrap_or(solana_program::pubkey!(
"CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"
)),
system_program: self
.system_program
.unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
};
let args = BurnV2InstructionArgs {
root: self.root.clone().expect("root is not set"),
data_hash: self.data_hash.clone().expect("data_hash is not set"),
creator_hash: self.creator_hash.clone().expect("creator_hash is not set"),
asset_data_hash: self.asset_data_hash.clone(),
flags: self.flags.clone(),
nonce: self.nonce.clone().expect("nonce is not set"),
index: self.index.clone().expect("index is not set"),
};
accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
}
}
pub struct BurnV2CpiAccounts<'a, 'b> {
pub tree_config: &'b solana_program::account_info::AccountInfo<'a>,
pub payer: &'b solana_program::account_info::AccountInfo<'a>,
pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub leaf_owner: &'b solana_program::account_info::AccountInfo<'a>,
pub leaf_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>,
pub core_collection: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub mpl_core_cpi_signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>,
pub compression_program: &'b solana_program::account_info::AccountInfo<'a>,
pub mpl_core_program: &'b solana_program::account_info::AccountInfo<'a>,
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
}
pub struct BurnV2Cpi<'a, 'b> {
pub __program: &'b solana_program::account_info::AccountInfo<'a>,
pub tree_config: &'b solana_program::account_info::AccountInfo<'a>,
pub payer: &'b solana_program::account_info::AccountInfo<'a>,
pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub leaf_owner: &'b solana_program::account_info::AccountInfo<'a>,
pub leaf_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>,
pub core_collection: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub mpl_core_cpi_signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>,
pub compression_program: &'b solana_program::account_info::AccountInfo<'a>,
pub mpl_core_program: &'b solana_program::account_info::AccountInfo<'a>,
pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
pub __args: BurnV2InstructionArgs,
}
impl<'a, 'b> BurnV2Cpi<'a, 'b> {
pub fn new(
program: &'b solana_program::account_info::AccountInfo<'a>,
accounts: BurnV2CpiAccounts<'a, 'b>,
args: BurnV2InstructionArgs,
) -> Self {
Self {
__program: program,
tree_config: accounts.tree_config,
payer: accounts.payer,
authority: accounts.authority,
leaf_owner: accounts.leaf_owner,
leaf_delegate: accounts.leaf_delegate,
merkle_tree: accounts.merkle_tree,
core_collection: accounts.core_collection,
mpl_core_cpi_signer: accounts.mpl_core_cpi_signer,
log_wrapper: accounts.log_wrapper,
compression_program: accounts.compression_program,
mpl_core_program: accounts.mpl_core_program,
system_program: accounts.system_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(12 + remaining_accounts.len());
accounts.push(solana_program::instruction::AccountMeta::new(
*self.tree_config.key,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.payer.key,
true,
));
if let Some(authority) = self.authority {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*authority.key,
true,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.leaf_owner.key,
false,
));
if let Some(leaf_delegate) = self.leaf_delegate {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*leaf_delegate.key,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new(
*self.merkle_tree.key,
false,
));
if let Some(core_collection) = self.core_collection {
accounts.push(solana_program::instruction::AccountMeta::new(
*core_collection.key,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
if let Some(mpl_core_cpi_signer) = self.mpl_core_cpi_signer {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*mpl_core_cpi_signer.key,
false,
));
} else {
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
crate::MPL_BUBBLEGUM_ID,
false,
));
}
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.log_wrapper.key,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.compression_program.key,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.mpl_core_program.key,
false,
));
accounts.push(solana_program::instruction::AccountMeta::new_readonly(
*self.system_program.key,
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(&(BurnV2InstructionData::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_BUBBLEGUM_ID,
accounts,
data,
};
let mut account_infos = Vec::with_capacity(12 + 1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.tree_config.clone());
account_infos.push(self.payer.clone());
if let Some(authority) = self.authority {
account_infos.push(authority.clone());
}
account_infos.push(self.leaf_owner.clone());
if let Some(leaf_delegate) = self.leaf_delegate {
account_infos.push(leaf_delegate.clone());
}
account_infos.push(self.merkle_tree.clone());
if let Some(core_collection) = self.core_collection {
account_infos.push(core_collection.clone());
}
if let Some(mpl_core_cpi_signer) = self.mpl_core_cpi_signer {
account_infos.push(mpl_core_cpi_signer.clone());
}
account_infos.push(self.log_wrapper.clone());
account_infos.push(self.compression_program.clone());
account_infos.push(self.mpl_core_program.clone());
account_infos.push(self.system_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 BurnV2CpiBuilder<'a, 'b> {
instruction: Box<BurnV2CpiBuilderInstruction<'a, 'b>>,
}
impl<'a, 'b> BurnV2CpiBuilder<'a, 'b> {
pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
let instruction = Box::new(BurnV2CpiBuilderInstruction {
__program: program,
tree_config: None,
payer: None,
authority: None,
leaf_owner: None,
leaf_delegate: None,
merkle_tree: None,
core_collection: None,
mpl_core_cpi_signer: None,
log_wrapper: None,
compression_program: None,
mpl_core_program: None,
system_program: None,
root: None,
data_hash: None,
creator_hash: None,
asset_data_hash: None,
flags: None,
nonce: None,
index: None,
__remaining_accounts: Vec::new(),
});
Self { instruction }
}
#[inline(always)]
pub fn tree_config(
&mut self,
tree_config: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.tree_config = Some(tree_config);
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 authority(
&mut self,
authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
) -> &mut Self {
self.instruction.authority = authority;
self
}
#[inline(always)]
pub fn leaf_owner(
&mut self,
leaf_owner: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.leaf_owner = Some(leaf_owner);
self
}
#[inline(always)]
pub fn leaf_delegate(
&mut self,
leaf_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
) -> &mut Self {
self.instruction.leaf_delegate = leaf_delegate;
self
}
#[inline(always)]
pub fn merkle_tree(
&mut self,
merkle_tree: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.merkle_tree = Some(merkle_tree);
self
}
#[inline(always)]
pub fn core_collection(
&mut self,
core_collection: Option<&'b solana_program::account_info::AccountInfo<'a>>,
) -> &mut Self {
self.instruction.core_collection = core_collection;
self
}
#[inline(always)]
pub fn mpl_core_cpi_signer(
&mut self,
mpl_core_cpi_signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
) -> &mut Self {
self.instruction.mpl_core_cpi_signer = mpl_core_cpi_signer;
self
}
#[inline(always)]
pub fn log_wrapper(
&mut self,
log_wrapper: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.log_wrapper = Some(log_wrapper);
self
}
#[inline(always)]
pub fn compression_program(
&mut self,
compression_program: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.compression_program = Some(compression_program);
self
}
#[inline(always)]
pub fn mpl_core_program(
&mut self,
mpl_core_program: &'b solana_program::account_info::AccountInfo<'a>,
) -> &mut Self {
self.instruction.mpl_core_program = Some(mpl_core_program);
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 root(&mut self, root: [u8; 32]) -> &mut Self {
self.instruction.root = Some(root);
self
}
#[inline(always)]
pub fn data_hash(&mut self, data_hash: [u8; 32]) -> &mut Self {
self.instruction.data_hash = Some(data_hash);
self
}
#[inline(always)]
pub fn creator_hash(&mut self, creator_hash: [u8; 32]) -> &mut Self {
self.instruction.creator_hash = Some(creator_hash);
self
}
#[inline(always)]
pub fn asset_data_hash(&mut self, asset_data_hash: [u8; 32]) -> &mut Self {
self.instruction.asset_data_hash = Some(asset_data_hash);
self
}
#[inline(always)]
pub fn flags(&mut self, flags: u8) -> &mut Self {
self.instruction.flags = Some(flags);
self
}
#[inline(always)]
pub fn nonce(&mut self, nonce: u64) -> &mut Self {
self.instruction.nonce = Some(nonce);
self
}
#[inline(always)]
pub fn index(&mut self, index: u32) -> &mut Self {
self.instruction.index = Some(index);
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 = BurnV2InstructionArgs {
root: self.instruction.root.clone().expect("root is not set"),
data_hash: self
.instruction
.data_hash
.clone()
.expect("data_hash is not set"),
creator_hash: self
.instruction
.creator_hash
.clone()
.expect("creator_hash is not set"),
asset_data_hash: self.instruction.asset_data_hash.clone(),
flags: self.instruction.flags.clone(),
nonce: self.instruction.nonce.clone().expect("nonce is not set"),
index: self.instruction.index.clone().expect("index is not set"),
};
let instruction = BurnV2Cpi {
__program: self.instruction.__program,
tree_config: self
.instruction
.tree_config
.expect("tree_config is not set"),
payer: self.instruction.payer.expect("payer is not set"),
authority: self.instruction.authority,
leaf_owner: self.instruction.leaf_owner.expect("leaf_owner is not set"),
leaf_delegate: self.instruction.leaf_delegate,
merkle_tree: self
.instruction
.merkle_tree
.expect("merkle_tree is not set"),
core_collection: self.instruction.core_collection,
mpl_core_cpi_signer: self.instruction.mpl_core_cpi_signer,
log_wrapper: self
.instruction
.log_wrapper
.expect("log_wrapper is not set"),
compression_program: self
.instruction
.compression_program
.expect("compression_program is not set"),
mpl_core_program: self
.instruction
.mpl_core_program
.expect("mpl_core_program is not set"),
system_program: self
.instruction
.system_program
.expect("system_program is not set"),
__args: args,
};
instruction.invoke_signed_with_remaining_accounts(
signers_seeds,
&self.instruction.__remaining_accounts,
)
}
}
struct BurnV2CpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
tree_config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
leaf_owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
leaf_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>,
merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>,
core_collection: Option<&'b solana_program::account_info::AccountInfo<'a>>,
mpl_core_cpi_signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>,
compression_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
mpl_core_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
root: Option<[u8; 32]>,
data_hash: Option<[u8; 32]>,
creator_hash: Option<[u8; 32]>,
asset_data_hash: Option<[u8; 32]>,
flags: Option<u8>,
nonce: Option<u64>,
index: Option<u32>,
__remaining_accounts: Vec<(
&'b solana_program::account_info::AccountInfo<'a>,
bool,
bool,
)>,
}