carbon_crafting_decoder/accounts/
crafting_process.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::CarbonDeserialize;
3use carbon_core::borsh;
4use carbon_core::deserialize::CarbonDeserialize;
5use solana_pubkey::Pubkey;
6
7use crate::types::ProcessStatus;
8
9/// This account represents crafting in progress
10
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12#[derive(Debug, Clone, borsh::BorshSerialize, CarbonDeserialize, PartialEq)]
13pub struct CraftingProcess {
14    /// The data version of this account.
15    pub version: u8,
16    /// the crafting id
17    pub crafting_id: u64,
18    /// the owner/authority of this crafting process
19    pub authority: Pubkey,
20    /// the recipe
21    pub recipe: Pubkey,
22    /// the crafting facility
23    pub crafting_facility: Pubkey,
24    /// used to check if expected inputs have been supplied
25    pub inputs_checksum: [u8; 16],
26    /// used to check if expected outputs have been claimed
27    pub outputs_checksum: [u8; 16],
28    /// Quantity of outputs to craft
29    pub quantity: u64,
30    /// The status of this crafting process
31    pub status: ProcessStatus,
32    /// the start timestamp
33    pub start_time: i64,
34    /// the end timestamp
35    pub end_time: i64,
36    /// Whether or not to deny permission-less claiming.  True when > 0
37    pub deny_permissionless_claiming: u8,
38    /// Whether or not to local time supplied by the location.  True when > 0
39    pub use_local_time: u8,
40    /// bump for PDA
41    pub bump: u8,
42}
43
44impl CraftingProcess {
45    pub fn decode(data: &[u8]) -> Option<Self> {
46        if data.len() < 8 {
47            return None;
48        }
49        let discriminator = &data[0..8];
50        if discriminator != &[105, 184, 5, 105, 175, 112, 13, 169] {
51            return None;
52        }
53
54        let data_slice = data;
55
56        let data_slice = &data_slice[8..];
57
58        Self::deserialize(data_slice)
59    }
60}