Skip to content

Commit

Permalink
comments patch#1
Browse files Browse the repository at this point in the history
  • Loading branch information
mgild committed Dec 19, 2024
1 parent fc75abf commit bd2ab15
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
23 changes: 0 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ borsh = "0.10.3"
bytemuck = "1"
solana-program = "2"
thiserror = "1"
shrinkwraprs = "0.3.0"
31 changes: 28 additions & 3 deletions lang/src/address_lookup_table_program.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::prelude::*;
use crate::solana_program::address_lookup_table;
use solana_program::pubkey::Pubkey;
use solana_program::address_lookup_table::state::AddressLookupTable as SolanaAddressLookupTable;
use solana_program::pubkey::Pubkey;
use std::ops::{Deref, DerefMut};

#[derive(Debug, Clone)]
pub struct AddressLookupTable;
Expand All @@ -11,8 +12,8 @@ impl anchor_lang::Id for AddressLookupTable {
}
}

#[derive(Clone, shrinkwraprs::Shrinkwrap)]
pub struct AddressLookupTableAccount<'info>(pub SolanaAddressLookupTable<'info>);
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AddressLookupTableAccount<'info>(SolanaAddressLookupTable<'info>);

impl AccountSerialize for AddressLookupTableAccount<'_> {}

Expand All @@ -32,8 +33,32 @@ impl<'info> AccountDeserialize for AddressLookupTableAccount<'info> {
}
}

impl<'info> Deref for AddressLookupTableAccount<'info> {
type Target = SolanaAddressLookupTable<'info>;

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<'info> DerefMut for AddressLookupTableAccount<'info> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

impl Owner for AddressLookupTableAccount<'_> {
fn owner() -> Pubkey {
address_lookup_table::program::ID
}
}

#[cfg(feature = "idl-build")]
mod idl_build {
use super::*;

impl crate::IdlBuild for AddressLookupTableAccount<'_> {}
impl crate::Discriminator for AddressLookupTableAccount<'_> {
const DISCRIMINATOR: &'static [u8] = &[];
}
}
3 changes: 2 additions & 1 deletion lang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ pub mod event;
pub mod idl;
pub mod system_program;
mod vec;
pub mod address_lookup_table_program;
mod address_lookup_table_program;

#[cfg(feature = "lazy-account")]
mod lazy;

pub use crate::address_lookup_table_program::*;
pub use crate::bpf_upgradeable_state::*;
pub use anchor_attribute_access_control::access_control;
pub use anchor_attribute_account::{account, declare_id, pubkey, zero_copy};
Expand Down

0 comments on commit bd2ab15

Please sign in to comment.