carbon_profile_faction_decoder/accounts/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::PROGRAM_ID;
3use crate::ProfileFactionDecoder;
4
5pub mod profile_faction_account;
6
7#[derive(Debug, Clone, PartialEq)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
10pub enum ProfileFactionAccount {
11    ProfileFactionAccount(Box<profile_faction_account::ProfileFactionAccount>),
12}
13
14impl<'a> carbon_core::account::AccountDecoder<'a> for ProfileFactionDecoder {
15    type AccountType = ProfileFactionAccount;
16
17    fn decode_account(
18        &self,
19        account: &'a solana_account::Account,
20    ) -> Option<carbon_core::account::DecodedAccount<Self::AccountType>> {
21        if account.owner != PROGRAM_ID {
22            return None;
23        }
24
25        let data = account.data.as_slice();
26
27        {
28            if let Some(decoded) = profile_faction_account::ProfileFactionAccount::decode(data) {
29                return Some(carbon_core::account::DecodedAccount {
30                    lamports: account.lamports,
31                    data: ProfileFactionAccount::ProfileFactionAccount(Box::new(decoded)),
32                    owner: account.owner,
33                    executable: account.executable,
34                    rent_epoch: account.rent_epoch,
35                });
36            }
37        }
38
39        None
40    }
41}