tensor_marketplace/generated/accounts/
bid_ta.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/kinobi-so/kinobi>
6//!
7
8use borsh::BorshDeserialize;
9use borsh::BorshSerialize;
10use solana_program::pubkey::Pubkey;
11
12#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct BidTa {
15    pub discriminator: [u8; 8],
16}
17
18impl BidTa {
19    pub const LEN: usize = 8;
20
21    /// Prefix values used to generate a PDA for this account.
22    ///
23    /// Values are positional and appear in the following order:
24    ///
25    ///   0. `BidTa::PREFIX`
26    ///   1. mint (`Pubkey`)
27    pub const PREFIX: &'static [u8] = "nft_escrow".as_bytes();
28
29    pub fn create_pda(
30        mint: Pubkey,
31        bump: u8,
32    ) -> Result<solana_program::pubkey::Pubkey, solana_program::pubkey::PubkeyError> {
33        solana_program::pubkey::Pubkey::create_program_address(
34            &["nft_escrow".as_bytes(), mint.as_ref(), &[bump]],
35            &crate::TENSOR_MARKETPLACE_ID,
36        )
37    }
38
39    pub fn find_pda(mint: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) {
40        solana_program::pubkey::Pubkey::find_program_address(
41            &["nft_escrow".as_bytes(), mint.as_ref()],
42            &crate::TENSOR_MARKETPLACE_ID,
43        )
44    }
45
46    #[inline(always)]
47    pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
48        let mut data = data;
49        Self::deserialize(&mut data)
50    }
51}
52
53impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for BidTa {
54    type Error = std::io::Error;
55
56    fn try_from(
57        account_info: &solana_program::account_info::AccountInfo<'a>,
58    ) -> Result<Self, Self::Error> {
59        let mut data: &[u8] = &(*account_info.data).borrow();
60        Self::deserialize(&mut data)
61    }
62}
63
64#[cfg(feature = "anchor")]
65impl anchor_lang::AccountDeserialize for BidTa {
66    fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
67        Ok(Self::deserialize(buf)?)
68    }
69}
70
71#[cfg(feature = "anchor")]
72impl anchor_lang::AccountSerialize for BidTa {}
73
74#[cfg(feature = "anchor")]
75impl anchor_lang::Owner for BidTa {
76    fn owner() -> Pubkey {
77        crate::TENSOR_MARKETPLACE_ID
78    }
79}
80
81#[cfg(feature = "anchor-idl-build")]
82impl anchor_lang::IdlBuild for BidTa {}
83
84#[cfg(feature = "anchor-idl-build")]
85impl anchor_lang::Discriminator for BidTa {
86    const DISCRIMINATOR: [u8; 8] = [0; 8];
87}