carbon_system_program_decoder/accounts/
mod.rs

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