use carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct UnverifySizedCollectionItem {}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct UnverifySizedCollectionItemInstructionAccounts {
pub metadata: solana_pubkey::Pubkey,
pub collection_authority: solana_pubkey::Pubkey,
pub payer: solana_pubkey::Pubkey,
pub collection_mint: solana_pubkey::Pubkey,
pub collection: solana_pubkey::Pubkey,
pub collection_master_edition_account: solana_pubkey::Pubkey,
pub collection_authority_record: Option<solana_pubkey::Pubkey>,
pub remaining: Vec<solana_instruction::AccountMeta>,
}
impl UnverifySizedCollectionItem {
pub fn decode(data: &[u8]) -> Option<Self> {
if data.is_empty() {
return None;
}
let discriminator = &data[0..1];
if discriminator != [31] {
return None;
}
let mut data_slice = data;
data_slice = &data_slice[1..];
borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
}
}
impl ArrangeAccounts for UnverifySizedCollectionItem {
type ArrangedAccounts = UnverifySizedCollectionItemInstructionAccounts;
fn arrange_accounts(
accounts: &[solana_instruction::AccountMeta],
) -> Option<Self::ArrangedAccounts> {
let mut iter = accounts.iter();
let metadata = next_account(&mut iter)?;
let collection_authority = next_account(&mut iter)?;
let payer = next_account(&mut iter)?;
let collection_mint = next_account(&mut iter)?;
let collection = next_account(&mut iter)?;
let collection_master_edition_account = next_account(&mut iter)?;
let collection_authority_record = next_account(&mut iter);
let remaining = iter.as_slice();
Some(UnverifySizedCollectionItemInstructionAccounts {
metadata,
collection_authority,
payer,
collection_mint,
collection,
collection_master_edition_account,
collection_authority_record,
remaining: remaining.to_vec(),
})
}
}