carbon_system_program_decoder/instructions/
allocate_with_seed.rs

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