Skip to main content

carbon_boop_decoder/instructions/
remove_operators.rs

1//! This code was AUTOGENERATED using the Codama library.
2use {
3    carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts},
4    solana_pubkey::Pubkey,
5};
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
8pub struct RemoveOperators {
9    pub operators: Vec<Pubkey>,
10}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct RemoveOperatorsInstructionAccounts {
15    pub config: solana_pubkey::Pubkey,
16    pub authority: solana_pubkey::Pubkey,
17    pub system_program: solana_pubkey::Pubkey,
18    pub remaining: Vec<solana_instruction::AccountMeta>,
19}
20
21impl RemoveOperators {
22    pub fn decode(data: &[u8]) -> Option<Self> {
23        if data.len() < 8 {
24            return None;
25        }
26        let discriminator = &data[0..8];
27        if discriminator != [42, 20, 89, 83, 222, 37, 4, 109] {
28            return None;
29        }
30
31        let mut data_slice = data;
32
33        data_slice = &data_slice[8..];
34
35        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
36    }
37}
38
39impl ArrangeAccounts for RemoveOperators {
40    type ArrangedAccounts = RemoveOperatorsInstructionAccounts;
41
42    fn arrange_accounts(
43        accounts: &[solana_instruction::AccountMeta],
44    ) -> Option<Self::ArrangedAccounts> {
45        let mut iter = accounts.iter();
46
47        let config = next_account(&mut iter)?;
48        let authority = next_account(&mut iter)?;
49        let system_program = next_account(&mut iter)?;
50
51        let remaining = iter.as_slice();
52
53        Some(RemoveOperatorsInstructionAccounts {
54            config,
55            authority,
56            system_program,
57            remaining: remaining.to_vec(),
58        })
59    }
60}