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