carbon_system_program_decoder/accounts/
mod.rs

1use {
2    crate::SystemProgramDecoder,
3    carbon_core::account::{AccountDecoder, DecodedAccount},
4};
5pub enum SystemProgramAccount {
6    Account(Vec<u8>),
7}
8
9impl AccountDecoder<'_> 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.eq(&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}