-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(macros): Provide full import paths in light_accounts
macro
#1063
Conversation
d430382
to
e62d138
Compare
1ee22b0
to
d2e0e46
Compare
e62d138
to
2bfc047
Compare
de5d56d
to
1d7e40f
Compare
thanks! Can you adjust the usage in token-escrow to make use of this? same for #1069 |
4205cb6
to
c3cd6fc
Compare
macros/light/src/traits.rs
Outdated
#compressed_sol_pda_field | ||
} | ||
fn get_compression_recipient(&self) -> Option<&UncheckedAccount<'info>> { | ||
fn get_compression_recipient(&self) -> Option<&::anchor_lang::prelude::UncheckedAccount<'info>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change the traits to return AccountInfo<'info>
or Option<AccountInfo<'info>
instead of &UncheckedAccount
and Option<
UncheckedAccount? To use these in the cpi function we will need to unwrap and do
.to_account_info()` to transfer ownership since cpi invocations need to own all data involved and don't work with references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see traits in my registry pr for reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Before this change, using `#[light_accounts]` macro required adding necessary imports manually, e.g. ```rust use account_compression::program::AccountCompression; use light_system_program::program::LightSystemProgram; ``` Which might've been annoying for developers. This change uses full paths for all foregin types used inside macros, so no additional imports are needed.
Before this change, using `#[derive(LightTraits)]` macro required adding necessary imports manually, e.g. ```rust use light_sdk::traits::{InvokeAccounts, SignerAccounts}; ``` Which might've been annoying for developers. This change uses full paths for all foreign types used inside macros, so no additional imports are needed.
Also, remove unnecessary imports.
64e4f0e
to
478f848
Compare
Before this change, using
#[light_accounts]
macro required adding necessary imports manually, e.g.Which might've been annoying for developers.
This change uses full paths for all foregin types used inside macros, so no additional imports are needed.