pub struct PinoContext<'a> {
pub iter: &'a mut Iter<'a, AccountInfo>,
/* private fields */
}Fields§
§iter: &'a mut Iter<'a, AccountInfo>Implementations§
Source§impl<'a> PinoContext<'a>
impl<'a> PinoContext<'a>
pub fn new(iter: &'a mut Iter<'a, AccountInfo>) -> Self
Sourcepub fn next<T: PinoAccount>(&mut self) -> Result<T, ProgramError>
pub fn next<T: PinoAccount>(&mut self) -> Result<T, ProgramError>
Pull the next AccountInfo and load as T
Sourcepub fn next_mut<T: PinoAccount>(
&mut self,
) -> Result<(T, &'a AccountInfo), ProgramError>
pub fn next_mut<T: PinoAccount>( &mut self, ) -> Result<(T, &'a AccountInfo), ProgramError>
Pull the next AccountInfo and load_mut as T and return the AccountInfo alongside for save
Sourcepub fn get_validated_account(&self, index: usize) -> Option<&'a AccountInfo>
pub fn get_validated_account(&self, index: usize) -> Option<&'a AccountInfo>
Get a validated account that has already been checked for common requirements
This method allows caching of validated accounts to avoid redundant validations such as signature checks, owner checks, etc.
Sourcepub fn set_validated_account(&mut self, index: usize, account: &'a AccountInfo)
pub fn set_validated_account(&mut self, index: usize, account: &'a AccountInfo)
Store a validated account in the cache
This method should be called after validating an account’s requirements such as signature checks, owner checks, etc.
Sourcepub fn validate_signer(
&mut self,
index: usize,
) -> Result<&'a AccountInfo, ProgramError>
pub fn validate_signer( &mut self, index: usize, ) -> Result<&'a AccountInfo, ProgramError>
Validate that an account is a signer and cache it
This method checks if the account is a signer and caches it for future use to avoid redundant signature validations.
Sourcepub fn validate_owner(
&mut self,
index: usize,
program_id: &Pubkey,
) -> Result<&'a AccountInfo, ProgramError>
pub fn validate_owner( &mut self, index: usize, program_id: &Pubkey, ) -> Result<&'a AccountInfo, ProgramError>
Validate that an account is owned by a specific program and cache it
This method checks if the account is owned by the specified program ID and caches it for future use to avoid redundant owner validations.
Sourcepub fn validate_signer_and_owner(
&mut self,
index: usize,
program_id: &Pubkey,
) -> Result<&'a AccountInfo, ProgramError>
pub fn validate_signer_and_owner( &mut self, index: usize, program_id: &Pubkey, ) -> Result<&'a AccountInfo, ProgramError>
Validate that an account is a signer and owned by a specific program, then cache it
This method combines signature and owner validation and caches the result to avoid redundant validations.