carbon_system_program_decoder/accounts/
mod.rs

1use carbon_core::account::{AccountDecoder, DecodedAccount};
2use solana_sdk::account::ReadableAccount;
3
4use crate::SystemProgramDecoder;
5pub enum SystemProgramAccount {
6    Account(Vec<u8>),
7}
8
9impl<'a> AccountDecoder<'a> for SystemProgramDecoder {
10    type AccountType = SystemProgramAccount;
11
12    fn decode_account(
13        &self,
14        account: &solana_sdk::account::Account,
15    ) -> Option<DecodedAccount<Self::AccountType>> {
16        if account.owner() != &solana_sdk::system_program::id() {
17            return None;
18        }
19
20        Some(DecodedAccount {
21            data: SystemProgramAccount::Account(account.data.clone()),
22            lamports: account.lamports,
23            owner: account.owner,
24            executable: account.executable,
25            rent_epoch: account.rent_epoch,
26        })
27    }
28}