Skip to content

Commit c5634cc

Browse files
committed
fix: error could not find in
1 parent 3718d0e commit c5634cc

File tree

6 files changed

+22
-82
lines changed

6 files changed

+22
-82
lines changed

rust/sdk/src/access_control/generated/accounts/group.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55
//! [https://github.com/metaplex-foundation/kinobi]
66
//!
77
8-
#[cfg(feature = "anchor")]
9-
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
10-
#[cfg(not(feature = "anchor"))]
118
use borsh::{BorshDeserialize, BorshSerialize};
129
use solana_program::pubkey::Pubkey;
1310

1411
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15-
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
16-
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
17-
#[derive(Clone, Debug, Eq, PartialEq)]
12+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
1813
pub struct Group {
1914
pub discriminator: u8,
2015
pub bump: u8,
@@ -49,27 +44,10 @@ impl Group {
4944
)
5045
}
5146

52-
pub fn find_pda(id: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) {
47+
pub fn find_pda(id: &Pubkey) -> (Pubkey, u8) {
5348
solana_program::pubkey::Pubkey::find_program_address(
5449
&["group:".as_bytes(), id.as_ref()],
5550
&super::MAGICBLOCK_PERMISSION_PROGRAM_ID,
5651
)
5752
}
58-
59-
#[inline(always)]
60-
pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
61-
let mut data = data;
62-
Self::deserialize(&mut data)
63-
}
64-
}
65-
66-
impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for Group {
67-
type Error = std::io::Error;
68-
69-
fn try_from(
70-
account_info: &solana_program::account_info::AccountInfo<'a>,
71-
) -> Result<Self, Self::Error> {
72-
let mut data: &[u8] = &(*account_info.data).borrow();
73-
Self::deserialize(&mut data)
74-
}
7553
}

rust/sdk/src/access_control/generated/accounts/permission.rs

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55
//! [https://github.com/metaplex-foundation/kinobi]
66
//!
77
8-
#[cfg(feature = "anchor")]
9-
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
10-
#[cfg(not(feature = "anchor"))]
118
use borsh::{BorshDeserialize, BorshSerialize};
129
use solana_program::pubkey::Pubkey;
1310

1411
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15-
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
16-
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
17-
#[derive(Clone, Debug, Eq, PartialEq)]
12+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
1813
pub struct Permission {
1914
pub discriminator: u8,
2015
pub bump: u8,
@@ -38,44 +33,23 @@ impl Permission {
3833
/// Values are positional and appear in the following order:
3934
///
4035
/// 0. `Permission::PREFIX`
41-
/// 1. delegated_account (`Pubkey`)
36+
/// 1. account (`Pubkey`)
4237
pub const PREFIX: &'static [u8] = "permission:".as_bytes();
4338

4439
pub fn create_pda(
45-
delegated_account: Pubkey,
40+
account: Pubkey,
4641
bump: u8,
4742
) -> Result<solana_program::pubkey::Pubkey, solana_program::pubkey::PubkeyError> {
4843
solana_program::pubkey::Pubkey::create_program_address(
49-
&[
50-
"permission:".as_bytes(),
51-
delegated_account.as_ref(),
52-
&[bump],
53-
],
44+
&["permission:".as_bytes(), account.as_ref(), &[bump]],
5445
&super::MAGICBLOCK_PERMISSION_PROGRAM_ID,
5546
)
5647
}
5748

58-
pub fn find_pda(delegated_account: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) {
49+
pub fn find_pda(account: &Pubkey) -> (Pubkey, u8) {
5950
solana_program::pubkey::Pubkey::find_program_address(
60-
&["permission:".as_bytes(), delegated_account.as_ref()],
51+
&["permission:".as_bytes(), account.as_ref()],
6152
&super::MAGICBLOCK_PERMISSION_PROGRAM_ID,
6253
)
6354
}
64-
65-
#[inline(always)]
66-
pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
67-
let mut data = data;
68-
Self::deserialize(&mut data)
69-
}
70-
}
71-
72-
impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for Permission {
73-
type Error = std::io::Error;
74-
75-
fn try_from(
76-
account_info: &solana_program::account_info::AccountInfo<'a>,
77-
) -> Result<Self, Self::Error> {
78-
let mut data: &[u8] = &(*account_info.data).borrow();
79-
Self::deserialize(&mut data)
80-
}
8155
}

rust/sdk/src/access_control/generated/instructions/create_group.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
//! [https://github.com/metaplex-foundation/kinobi]
66
//!
77
8-
#[cfg(feature = "anchor")]
9-
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
10-
#[cfg(not(feature = "anchor"))]
118
use borsh::{BorshDeserialize, BorshSerialize};
129
use solana_program::pubkey::Pubkey;
1310

@@ -60,8 +57,7 @@ impl CreateGroup {
6057
}
6158
}
6259

63-
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
64-
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
60+
#[derive(BorshSerialize, BorshDeserialize)]
6561
pub struct CreateGroupInstructionData {
6662
discriminator: u8,
6763
}
@@ -72,10 +68,8 @@ impl CreateGroupInstructionData {
7268
}
7369
}
7470

75-
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
76-
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
71+
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
7772
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
78-
#[derive(Clone, Debug, Eq, PartialEq)]
7973
pub struct CreateGroupInstructionArgs {
8074
pub id: Pubkey,
8175
pub members: Vec<Pubkey>,

rust/sdk/src/access_control/generated/instructions/create_permission.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
//! [https://github.com/metaplex-foundation/kinobi]
66
//!
77
8-
#[cfg(feature = "anchor")]
9-
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
10-
#[cfg(not(feature = "anchor"))]
118
use borsh::{BorshDeserialize, BorshSerialize};
129

1310
use super::BorshCompatibility;
@@ -65,8 +62,7 @@ impl CreatePermission {
6562
}
6663
}
6764

68-
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
69-
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
65+
#[derive(BorshSerialize, BorshDeserialize)]
7066
pub struct CreatePermissionInstructionData {
7167
discriminator: u8,
7268
}

rust/sdk/src/access_control/generated/instructions/update_permission.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
//! [https://github.com/metaplex-foundation/kinobi]
66
//!
77
8-
#[cfg(feature = "anchor")]
9-
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize};
10-
#[cfg(not(feature = "anchor"))]
118
use borsh::{BorshDeserialize, BorshSerialize};
129

1310
use super::BorshCompatibility;
@@ -54,8 +51,7 @@ impl UpdatePermission {
5451
}
5552
}
5653

57-
#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))]
58-
#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))]
54+
#[derive(BorshSerialize, BorshDeserialize)]
5955
pub struct UpdatePermissionInstructionData {
6056
discriminator: u8,
6157
}

rust/sdk/src/access_control/mod.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#[allow(deprecated, clippy::all)]
22
pub mod generated;
33

4+
// Re-export the commonly used types
45
pub use generated::BorshCompatibility;
5-
6-
use generated::accounts::{Group, Permission};
7-
use generated::instructions::CreateGroupInstructionArgs;
8-
pub use generated::programs::MAGICBLOCK_PERMISSION_PROGRAM_ID;
9-
pub use generated::*;
10-
11-
use generated::instructions::{
12-
CreateGroupInstructionData, CreatePermissionInstructionData, UpdatePermissionInstructionData,
6+
pub use generated::instructions::{
7+
CreateGroup, CreateGroupBuilder, CreateGroupCpi, CreateGroupCpiBuilder, CreateGroupCpiAccounts,
8+
CreateGroupInstructionArgs, CreateGroupInstructionData, CreatePermission, CreatePermissionBuilder,
9+
CreatePermissionCpi, CreatePermissionCpiBuilder, CreatePermissionCpiAccounts,
10+
CreatePermissionInstructionData, UpdatePermission, UpdatePermissionBuilder, UpdatePermissionCpi,
11+
UpdatePermissionCpiBuilder, UpdatePermissionCpiAccounts, UpdatePermissionInstructionData,
1312
};
13+
pub use generated::accounts::{Group, Permission};
14+
pub use generated::errors;
15+
pub use generated::programs::MAGICBLOCK_PERMISSION_PROGRAM_ID;
1416

1517
impl Group {
1618
pub const LEN: usize = 1 + 1 + 4 + 32 * 32;

0 commit comments

Comments
 (0)