carbon_points_store_decoder/instructions/
create_redemption_config.rs

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