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