carbon_points_decoder/instructions/
create_user_point_account_with_license.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::CarbonDeserialize;
3use carbon_core::account_utils::next_account;
4use carbon_core::borsh;
5use carbon_core::deserialize::ArrangeAccounts;
6use carbon_core::deserialize::CarbonDeserialize;
7
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[derive(Debug, Clone, borsh::BorshSerialize, CarbonDeserialize, PartialEq, Eq, Hash)]
10pub struct CreateUserPointAccountWithLicense {}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct CreateUserPointAccountWithLicenseInstructionAccounts {
15    pub user_profile: solana_pubkey::Pubkey,
16    pub funder: solana_pubkey::Pubkey,
17    pub category: solana_pubkey::Pubkey,
18    pub user_points_account: solana_pubkey::Pubkey,
19    pub token_account_owner: solana_pubkey::Pubkey,
20    pub user_token_account: solana_pubkey::Pubkey,
21    pub mint_or_vault: solana_pubkey::Pubkey,
22    pub token_program: solana_pubkey::Pubkey,
23    pub system_program: solana_pubkey::Pubkey,
24    pub remaining: Vec<solana_instruction::AccountMeta>,
25}
26
27impl CreateUserPointAccountWithLicense {
28    pub fn decode(data: &[u8]) -> Option<Self> {
29        if data.len() < 8 {
30            return None;
31        }
32        let discriminator = &data[0..8];
33        if discriminator != &[180, 76, 194, 91, 150, 131, 172, 188] {
34            return None;
35        }
36
37        let data_slice = data;
38
39        let data_slice = &data_slice[8..];
40
41        Self::deserialize(data_slice)
42    }
43}
44
45impl ArrangeAccounts for CreateUserPointAccountWithLicense {
46    type ArrangedAccounts = CreateUserPointAccountWithLicenseInstructionAccounts;
47
48    fn arrange_accounts(
49        accounts: &[solana_instruction::AccountMeta],
50    ) -> Option<Self::ArrangedAccounts> {
51        let mut iter = accounts.iter();
52
53        let user_profile = next_account(&mut iter)?;
54        let funder = next_account(&mut iter)?;
55        let category = next_account(&mut iter)?;
56        let user_points_account = next_account(&mut iter)?;
57        let token_account_owner = next_account(&mut iter)?;
58        let user_token_account = next_account(&mut iter)?;
59        let mint_or_vault = next_account(&mut iter)?;
60        let token_program = next_account(&mut iter)?;
61        let system_program = next_account(&mut iter)?;
62
63        let remaining = iter.as_slice();
64
65        Some(CreateUserPointAccountWithLicenseInstructionAccounts {
66            user_profile,
67            funder,
68            category,
69            user_points_account,
70            token_account_owner,
71            user_token_account,
72            mint_or_vault,
73            token_program,
74            system_program,
75            remaining: remaining.to_vec(),
76        })
77    }
78}