pub struct TransactionContext { /* private fields */ }
Expand description

Loaded transaction shared between runtime and programs.

This context is valid for the entire duration of a transaction being processed.

Implementations§

source§

impl TransactionContext

source

pub fn new( transaction_accounts: Vec<TransactionAccount>, rent: Option<Rent>, instruction_context_capacity: usize, number_of_instructions_at_transaction_level: usize ) -> Self

Constructs a new TransactionContext

source

pub fn deconstruct_without_keys( self ) -> Result<Vec<AccountSharedData>, InstructionError>

Used in mock_process_instruction

source

pub fn is_early_verification_of_account_modifications_enabled(&self) -> bool

Returns true if enable_early_verification_of_account_modifications is active

source

pub fn get_number_of_accounts(&self) -> usize

Returns the total number of accounts loaded in this Transaction

source

pub fn get_key_of_account_at_index( &self, index_in_transaction: usize ) -> Result<&Pubkey, InstructionError>

Searches for an account by its key

source

pub fn get_keys_of_accounts(&self) -> &[Pubkey]

Returns the keys for the accounts loaded in this Transaction

source

pub fn get_account_at_index( &self, index_in_transaction: usize ) -> Result<&RefCell<AccountSharedData>, InstructionError>

Searches for an account by its key

source

pub fn find_index_of_account(&self, pubkey: &Pubkey) -> Option<usize>

Searches for an account by its key

source

pub fn find_index_of_program_account(&self, pubkey: &Pubkey) -> Option<usize>

Searches for a program account by its key

source

pub fn get_instruction_context_at( &self, level: usize ) -> Result<&InstructionContext, InstructionError>

Gets an InstructionContext by its nesting level in the stack

source

pub fn get_instruction_context_capacity(&self) -> usize

Gets the max height of the InstructionContext stack

source

pub fn get_instruction_context_stack_height(&self) -> usize

Gets instruction stack height, top-level instructions are height solana_sdk::instruction::TRANSACTION_LEVEL_STACK_HEIGHT

source

pub fn get_current_instruction_context( &self ) -> Result<&InstructionContext, InstructionError>

Returns the current InstructionContext

source

pub fn push( &mut self, program_accounts: &[usize], instruction_accounts: &[InstructionAccount], instruction_data: &[u8] ) -> Result<(), InstructionError>

Pushes a new InstructionContext

source

pub fn pop(&mut self) -> Result<(), InstructionError>

Pops the current InstructionContext

source

pub fn get_return_data(&self) -> (&Pubkey, &[u8])

Gets the return data of the current InstructionContext or any above

source

pub fn set_return_data( &mut self, program_id: Pubkey, data: Vec<u8> ) -> Result<(), InstructionError>

Set the return data of the current InstructionContext

source

pub fn get_instruction_trace(&self) -> &InstructionTrace

Returns instruction trace

source

pub fn accounts_resize_delta(&self) -> Result<i64, InstructionError>

Returns the accounts resize delta

Trait Implementations§

source§

impl Debug for TransactionContext

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<TransactionContext> for ExecutionRecord

Used by the bank in the runtime to write back the processed accounts and recorded instructions

source§

fn from(context: TransactionContext) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V