carbon_system_program_decoder/instructions/
create_account.rs

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