carbon_points_decoder/instructions/
create_user_point_account.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 CreateUserPointAccount {}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct CreateUserPointAccountInstructionAccounts {
15    pub user_profile: solana_pubkey::Pubkey,
16    pub funder: solana_pubkey::Pubkey,
17    pub point_category_account: solana_pubkey::Pubkey,
18    pub user_points_account: solana_pubkey::Pubkey,
19    pub system_program: solana_pubkey::Pubkey,
20    pub remaining: Vec<solana_instruction::AccountMeta>,
21}
22
23impl CreateUserPointAccount {
24    pub fn decode(data: &[u8]) -> Option<Self> {
25        if data.len() < 8 {
26            return None;
27        }
28        let discriminator = &data[0..8];
29        if discriminator != &[156, 148, 226, 141, 48, 89, 41, 139] {
30            return None;
31        }
32
33        let data_slice = data;
34
35        let data_slice = &data_slice[8..];
36
37        Self::deserialize(data_slice)
38    }
39}
40
41impl ArrangeAccounts for CreateUserPointAccount {
42    type ArrangedAccounts = CreateUserPointAccountInstructionAccounts;
43
44    fn arrange_accounts(
45        accounts: &[solana_instruction::AccountMeta],
46    ) -> Option<Self::ArrangedAccounts> {
47        let mut iter = accounts.iter();
48
49        let user_profile = next_account(&mut iter)?;
50        let funder = next_account(&mut iter)?;
51        let point_category_account = next_account(&mut iter)?;
52        let user_points_account = next_account(&mut iter)?;
53        let system_program = next_account(&mut iter)?;
54
55        let remaining = iter.as_slice();
56
57        Some(CreateUserPointAccountInstructionAccounts {
58            user_profile,
59            funder,
60            point_category_account,
61            user_points_account,
62            system_program,
63            remaining: remaining.to_vec(),
64        })
65    }
66}