carbon_system_program_decoder/instructions/
allocate.rs

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