Skip to main content

carbon_token_program_decoder/instructions/
thaw_account.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts};
3/// Thaw a Frozen account using the Mint's freeze_authority (if set).
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
6pub struct ThawAccount {}
7
8#[derive(Debug, Clone, PartialEq)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub struct ThawAccountInstructionAccounts {
11    pub account: solana_pubkey::Pubkey,
12    pub mint: solana_pubkey::Pubkey,
13    pub owner: solana_pubkey::Pubkey,
14    pub remaining: Vec<solana_instruction::AccountMeta>,
15}
16
17impl ThawAccount {
18    pub fn decode(data: &[u8]) -> Option<Self> {
19        if data.is_empty() {
20            return None;
21        }
22        let discriminator = &data[0..1];
23        if discriminator != [11] {
24            return None;
25        }
26
27        let mut data_slice = data;
28
29        data_slice = &data_slice[1..];
30
31        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
32    }
33}
34
35impl ArrangeAccounts for ThawAccount {
36    type ArrangedAccounts = ThawAccountInstructionAccounts;
37
38    fn arrange_accounts(
39        accounts: &[solana_instruction::AccountMeta],
40    ) -> Option<Self::ArrangedAccounts> {
41        let mut iter = accounts.iter();
42
43        let account = next_account(&mut iter)?;
44        let mint = next_account(&mut iter)?;
45        let owner = next_account(&mut iter)?;
46
47        let remaining = iter.as_slice();
48
49        Some(ThawAccountInstructionAccounts {
50            account,
51            mint,
52            owner,
53            remaining: remaining.to_vec(),
54        })
55    }
56}