pub struct LazyContext<'a, 'info> { /* private fields */ }Expand description
Runtime-typed view over a native lazy parsing context.
Construction happens inside the runtime’s hopper_lazy_entrypoint!
expansion (LazyContext::from_native); handlers only ever see this
wrapper. Every method delegates to the substrate implementation and
converts at the boundary without re-parsing or copying account data.
Implementations§
Source§impl<'a, 'info> LazyContext<'a, 'info>
impl<'a, 'info> LazyContext<'a, 'info>
Sourcepub fn from_native(inner: &'a mut LazyContext<'info>) -> Self
pub fn from_native(inner: &'a mut LazyContext<'info>) -> Self
Wrap a substrate lazy context. Called by the runtime’s
hopper_lazy_entrypoint! expansion; public so custom entrypoint
plumbing can bridge the same way.
Sourcepub fn instruction_data(&self) -> &[u8]
pub fn instruction_data(&self) -> &[u8]
Instruction data for this invocation. Available at any time, including before any account is consumed.
Sourcepub fn program_id(&self) -> &Address
pub fn program_id(&self) -> &Address
The executing program’s id.
Sourcepub fn total_accounts(&self) -> usize
pub fn total_accounts(&self) -> usize
Total accounts the instruction declared.
Sourcepub fn parsed_count(&self) -> usize
pub fn parsed_count(&self) -> usize
How many accounts have been parsed so far.
Sourcepub fn next_account(&mut self) -> Result<AccountView<'info>, ProgramError>
pub fn next_account(&mut self) -> Result<AccountView<'info>, ProgramError>
Parse and return the next account.
Sourcepub fn next_signer(&mut self) -> Result<AccountView<'info>, ProgramError>
pub fn next_signer(&mut self) -> Result<AccountView<'info>, ProgramError>
Parse the next account and require it to be a signer.
Sourcepub fn next_writable(&mut self) -> Result<AccountView<'info>, ProgramError>
pub fn next_writable(&mut self) -> Result<AccountView<'info>, ProgramError>
Parse the next account and require it to be writable.
Sourcepub fn next_payer(&mut self) -> Result<AccountView<'info>, ProgramError>
pub fn next_payer(&mut self) -> Result<AccountView<'info>, ProgramError>
Parse the next account and require signer + writable (a fee payer shape).
Sourcepub fn next_owned_by(
&mut self,
program: &Address,
) -> Result<AccountView<'info>, ProgramError>
pub fn next_owned_by( &mut self, program: &Address, ) -> Result<AccountView<'info>, ProgramError>
Parse the next account and require its owner to be program.
Sourcepub fn skip(&mut self, n: usize) -> Result<(), ProgramError>
pub fn skip(&mut self, n: usize) -> Result<(), ProgramError>
Skip the next n accounts without exposing them.
Sourcepub fn drain_remaining(&mut self) -> Result<&[AccountView<'info>], ProgramError>
pub fn drain_remaining(&mut self) -> Result<&[AccountView<'info>], ProgramError>
Parse every remaining account and return them as a slice.
Sourcepub fn get(&self, index: usize) -> Option<&AccountView<'info>>
pub fn get(&self, index: usize) -> Option<&AccountView<'info>>
Already-parsed account at index, if it has been consumed.