carbon_system_program_decoder/instructions/
allocate_with_seed.rs

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