carbon_bubblegum_decoder/instructions/
set_tree_delegate.rs1use carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts};
3#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
5pub struct SetTreeDelegate {}
6
7#[derive(Debug, Clone, PartialEq)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct SetTreeDelegateInstructionAccounts {
10 pub tree_authority: solana_pubkey::Pubkey,
11 pub tree_creator: solana_pubkey::Pubkey,
12 pub new_tree_delegate: solana_pubkey::Pubkey,
13 pub merkle_tree: solana_pubkey::Pubkey,
14 pub system_program: solana_pubkey::Pubkey,
15 pub remaining: Vec<solana_instruction::AccountMeta>,
16}
17
18impl SetTreeDelegate {
19 pub fn decode(data: &[u8]) -> Option<Self> {
20 if data.len() < 8 {
21 return None;
22 }
23 let discriminator = &data[0..8];
24 if discriminator != [253, 118, 66, 37, 190, 49, 154, 102] {
25 return None;
26 }
27
28 let mut data_slice = data;
29
30 data_slice = &data_slice[8..];
31
32 borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
33 }
34}
35
36impl ArrangeAccounts for SetTreeDelegate {
37 type ArrangedAccounts = SetTreeDelegateInstructionAccounts;
38
39 fn arrange_accounts(
40 accounts: &[solana_instruction::AccountMeta],
41 ) -> Option<Self::ArrangedAccounts> {
42 let mut iter = accounts.iter();
43
44 let tree_authority = next_account(&mut iter)?;
45 let tree_creator = next_account(&mut iter)?;
46 let new_tree_delegate = next_account(&mut iter)?;
47 let merkle_tree = next_account(&mut iter)?;
48 let system_program = next_account(&mut iter)?;
49
50 let remaining = iter.as_slice();
51
52 Some(SetTreeDelegateInstructionAccounts {
53 tree_authority,
54 tree_creator,
55 new_tree_delegate,
56 merkle_tree,
57 system_program,
58 remaining: remaining.to_vec(),
59 })
60 }
61}