carbon_system_program_decoder/instructions/
create_account.rs

1use carbon_core::{borsh, CarbonDeserialize};
2#[derive(
3    CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
4)]
5#[carbon(discriminator = "0x00")]
6pub struct CreateAccount {
7    pub lamports: u64,
8    pub space: u64,
9    pub onwer: solana_sdk::pubkey::Pubkey,
10}
11
12pub struct CreateAccountAccounts {
13    pub funding_account: solana_sdk::pubkey::Pubkey,
14    pub new_account: solana_sdk::pubkey::Pubkey,
15}
16
17impl carbon_core::deserialize::ArrangeAccounts for CreateAccount {
18    type ArrangedAccounts = CreateAccountAccounts;
19
20    fn arrange_accounts(
21        accounts: &[solana_sdk::instruction::AccountMeta],
22    ) -> Option<Self::ArrangedAccounts> {
23        let [funding_account, new_account, _remaining @ ..] = accounts else {
24            return None;
25        };
26
27        Some(CreateAccountAccounts {
28            funding_account: funding_account.pubkey,
29            new_account: new_account.pubkey,
30        })
31    }
32}