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
21fn arrange_accounts(
22        accounts: Vec<solana_sdk::instruction::AccountMeta>,
23    ) -> Option<Self::ArrangedAccounts> {
24        let allocated_account = accounts.get(0)?;
25        let base_account = accounts.get(1)?;
26
27        Some(AllocateWithSeedAccounts {
28            allocated_account: allocated_account.pubkey,
29            base_account: base_account.pubkey,
30        })
31    }
32}