carbon_token_program_decoder/instructions/
close_account.rs1use carbon_core::{borsh, CarbonDeserialize};
2#[derive(
3 CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
4)]
5#[carbon(discriminator = "0x09")]
6pub struct CloseAccount {}
7
8pub struct CloseAccountAccounts {
9 pub account: solana_pubkey::Pubkey,
10 pub destination: solana_pubkey::Pubkey,
11 pub owner: solana_pubkey::Pubkey,
12 pub remaining_accounts: Vec<solana_instruction::AccountMeta>,
13}
14
15impl carbon_core::deserialize::ArrangeAccounts for CloseAccount {
16 type ArrangedAccounts = CloseAccountAccounts;
17
18 fn arrange_accounts(
19 accounts: &[solana_instruction::AccountMeta],
20 ) -> Option<Self::ArrangedAccounts> {
21 let [account, destination, owner, remaining_accounts @ ..] = accounts else {
22 return None;
23 };
24
25 Some(CloseAccountAccounts {
26 account: account.pubkey,
27 destination: destination.pubkey,
28 owner: owner.pubkey,
29 remaining_accounts: remaining_accounts.to_vec(),
30 })
31 }
32}