pub struct AccountKeys<'a> { /* private fields */ }
Expand description
Collection of static and dynamically loaded keys used to load accounts during transaction processing.
Implementations§
Source§impl<'a> AccountKeys<'a>
impl<'a> AccountKeys<'a>
pub fn new( static_keys: &'a [Pubkey], dynamic_keys: Option<&'a LoadedAddresses>, ) -> Self
Sourcepub fn get(&self, index: usize) -> Option<&'a Pubkey>
pub fn get(&self, index: usize) -> Option<&'a Pubkey>
Returns the address of the account at the specified index of the list of message account keys constructed from static keys, followed by dynamically loaded writable addresses, and lastly the list of dynamically loaded readonly addresses.
Sourcepub fn iter(&self) -> impl Iterator<Item = &'a Pubkey> + Clone
pub fn iter(&self) -> impl Iterator<Item = &'a Pubkey> + Clone
Iterator for the addresses of the loaded accounts for a message
Sourcepub fn compile_instructions(
&self,
instructions: &[Instruction],
) -> Vec<CompiledInstruction>
pub fn compile_instructions( &self, instructions: &[Instruction], ) -> Vec<CompiledInstruction>
Compile instructions using the order of account keys to determine compiled instruction account indexes.
§Panics
Panics when compiling fails. See AccountKeys::try_compile_instructions
for a full description of failure scenarios.
Sourcepub fn try_compile_instructions(
&self,
instructions: &[Instruction],
) -> Result<Vec<CompiledInstruction>, CompileError>
pub fn try_compile_instructions( &self, instructions: &[Instruction], ) -> Result<Vec<CompiledInstruction>, CompileError>
Compile instructions using the order of account keys to determine compiled instruction account indexes.
§Errors
Compilation will fail if any instructions
use account keys which are not
present in this account key collection.
Compilation will fail if any instructions
use account keys which are located
at an index which cannot be cast to a u8
without overflow.
Trait Implementations§
Source§impl<'a> Clone for AccountKeys<'a>
impl<'a> Clone for AccountKeys<'a>
Source§fn clone(&self) -> AccountKeys<'a>
fn clone(&self) -> AccountKeys<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more