core_preview/generated/accounts/
base_collection_v1.rs

1//! This code was AUTOGENERATED using the kinobi library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun kinobi to update it.
4//!
5//! [https://github.com/metaplex-foundation/kinobi]
6//!
7
8use crate::generated::types::Key;
9use borsh::BorshDeserialize;
10use borsh::BorshSerialize;
11use solana_program::pubkey::Pubkey;
12
13#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
14#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15pub struct BaseCollectionV1 {
16    pub key: Key,
17    #[cfg_attr(
18        feature = "serde",
19        serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
20    )]
21    pub update_authority: Pubkey,
22    pub name: String,
23    pub uri: String,
24    pub num_minted: u32,
25    pub current_size: u32,
26}
27
28impl BaseCollectionV1 {
29    #[inline(always)]
30    pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
31        let mut data = data;
32        Self::deserialize(&mut data)
33    }
34}
35
36impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for BaseCollectionV1 {
37    type Error = std::io::Error;
38
39    fn try_from(
40        account_info: &solana_program::account_info::AccountInfo<'a>,
41    ) -> Result<Self, Self::Error> {
42        let mut data: &[u8] = &(*account_info.data).borrow();
43        Self::deserialize(&mut data)
44    }
45}