carbon_token_2022_decoder/instructions/
create_native_mint.rs1use carbon_core::account_utils::next_account;
8use carbon_core::borsh;
9use carbon_core::deserialize::ArrangeAccounts;
10use carbon_core::deserialize::CarbonDeserialize;
11use carbon_core::CarbonDeserialize;
12
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
19#[derive(Debug, Clone, borsh::BorshSerialize, CarbonDeserialize, PartialEq)]
20pub struct CreateNativeMint {}
21
22#[derive(Debug, Clone, PartialEq)]
23#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
24pub struct CreateNativeMintInstructionAccounts {
25 pub payer: solana_pubkey::Pubkey,
26 pub native_mint: solana_pubkey::Pubkey,
27 pub system_program: solana_pubkey::Pubkey,
28 pub remaining: Vec<solana_instruction::AccountMeta>,
29}
30
31impl CreateNativeMint {
32 pub fn decode(data: &[u8]) -> Option<Self> {
33 if data.is_empty() {
34 return None;
35 }
36 let discriminator = &data[0..1];
37 if discriminator != [31] {
38 return None;
39 }
40
41 let data_slice = data;
42
43 let data_slice = &data_slice[1..];
44
45 Self::deserialize(data_slice)
46 }
47}
48
49impl ArrangeAccounts for CreateNativeMint {
50 type ArrangedAccounts = CreateNativeMintInstructionAccounts;
51
52 fn arrange_accounts(
53 accounts: &[solana_instruction::AccountMeta],
54 ) -> Option<Self::ArrangedAccounts> {
55 let mut iter = accounts.iter();
56
57 let payer = next_account(&mut iter)?;
58 let native_mint = next_account(&mut iter)?;
59 let system_program = next_account(&mut iter)?;
60
61 let remaining = iter.as_slice();
62
63 Some(CreateNativeMintInstructionAccounts {
64 payer,
65 native_mint,
66 system_program,
67 remaining: remaining.to_vec(),
68 })
69 }
70}