mpl_core/generated/accounts/
asset_signer.rs1#[cfg(feature = "anchor")]
9use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
10#[cfg(not(feature = "anchor"))]
11use borsh::{BorshDeserialize, BorshSerialize};
12use kaigan::types::RemainderVec;
13use solana_program::pubkey::Pubkey;
14
15#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
16#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
17#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
18#[derive(Clone, Debug, Eq, PartialEq)]
19pub struct AssetSigner {
20 pub data: RemainderVec<u8>,
21}
22
23impl AssetSigner {
24 pub const LEN: usize = 0;
25
26 pub const PREFIX: &'static [u8] = "mpl-core-execute".as_bytes();
33
34 pub fn create_pda(
35 asset: Pubkey,
36 bump: u8,
37 ) -> Result<solana_program::pubkey::Pubkey, solana_program::pubkey::PubkeyError> {
38 solana_program::pubkey::Pubkey::create_program_address(
39 &["mpl-core-execute".as_bytes(), asset.as_ref(), &[bump]],
40 &crate::MPL_CORE_ID,
41 )
42 }
43
44 pub fn find_pda(asset: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) {
45 solana_program::pubkey::Pubkey::find_program_address(
46 &["mpl-core-execute".as_bytes(), asset.as_ref()],
47 &crate::MPL_CORE_ID,
48 )
49 }
50
51 #[inline(always)]
52 pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
53 let mut data = data;
54 Self::deserialize(&mut data)
55 }
56}
57
58impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for AssetSigner {
59 type Error = std::io::Error;
60
61 fn try_from(
62 account_info: &solana_program::account_info::AccountInfo<'a>,
63 ) -> Result<Self, Self::Error> {
64 let mut data: &[u8] = &(*account_info.data).borrow();
65 Self::deserialize(&mut data)
66 }
67}