Struct light_sdk::context::LightContext
source · pub struct LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps,
U: LightAccounts,{
pub anchor_context: Context<'a, 'b, 'c, 'info, T>,
pub light_accounts: U,
}Expand description
Provides non-argument inputs to the program, including light accounts and regular accounts.
§Example
ⓘ
pub fn set_data(ctx: Context<SetData>, age: u64, other_data: u32) -> Result<()> {
// Set account data like this
(*ctx.accounts.my_account).age = age;
(*ctx.accounts.my_account).other_data = other_data;
// or like this
let my_account = &mut ctx.account.my_account;
my_account.age = age;
my_account.other_data = other_data;
Ok(())
}Fields§
§anchor_context: Context<'a, 'b, 'c, 'info, T>Context provided by Anchor.
light_accounts: UImplementations§
source§impl<'a, 'b, 'c, 'info, T, U> LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps + InvokeAccounts<'info> + InvokeCpiAccounts<'info> + InvokeCpiContextAccount<'info> + LightSystemAccount<'info> + SignerAccounts<'info>,
U: LightAccounts,
impl<'a, 'b, 'c, 'info, T, U> LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps + InvokeAccounts<'info> + InvokeCpiAccounts<'info> + InvokeCpiContextAccount<'info> + LightSystemAccount<'info> + SignerAccounts<'info>,
U: LightAccounts,
pub fn new( anchor_context: Context<'a, 'b, 'c, 'info, T>, inputs: Vec<Vec<u8>>, merkle_context: PackedMerkleContext, merkle_tree_root_index: u16, address_merkle_context: PackedAddressMerkleContext, address_merkle_tree_root_index: u16, ) -> Result<Self>
pub fn verify(&mut self, proof: CompressedProof) -> Result<()>
Trait Implementations§
source§impl<'a, 'b, 'c, 'info, T, U> Deref for LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps,
U: LightAccounts,
impl<'a, 'b, 'c, 'info, T, U> Deref for LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps,
U: LightAccounts,
source§impl<'a, 'b, 'c, 'info, T, U> DerefMut for LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps,
U: LightAccounts,
impl<'a, 'b, 'c, 'info, T, U> DerefMut for LightContext<'a, 'b, 'c, 'info, T, U>where
T: Bumps,
U: LightAccounts,
Auto Trait Implementations§
impl<'a, 'b, 'c, 'info, T, U> Freeze for LightContext<'a, 'b, 'c, 'info, T, U>
impl<'a, 'b, 'c, 'info, T, U> !RefUnwindSafe for LightContext<'a, 'b, 'c, 'info, T, U>
impl<'a, 'b, 'c, 'info, T, U> !Send for LightContext<'a, 'b, 'c, 'info, T, U>
impl<'a, 'b, 'c, 'info, T, U> !Sync for LightContext<'a, 'b, 'c, 'info, T, U>
impl<'a, 'b, 'c, 'info, T, U> Unpin for LightContext<'a, 'b, 'c, 'info, T, U>
impl<'a, 'b, 'c, 'info, T, U> !UnwindSafe for LightContext<'a, 'b, 'c, 'info, T, U>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more