pub fn try_get_optional_account_info<'a>(
accounts: &'a [AccountInfo<'a>],
index: usize
) -> Result<Option<&'a AccountInfo<'a>>, ProgramError>
Expand description
Convenience function for accessing an AccountInfo
by index
and validating whether the account is present or not.
This relies on the client setting the crate::id()
as the pubkey for
accounts that are not set, which effectively allows us to use positional
optional accounts.