pub struct Environment { /* private fields */ }
Expand description
Information about the execution environment.
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn is_check_only(&self) -> bool
pub fn is_check_only(&self) -> bool
Whether the execution mode is such that only checks should be performed.
Sourcepub fn is_pre_schedule(&self) -> bool
pub fn is_pre_schedule(&self) -> bool
Whether the execution mode is Mode::PreSchedule
.
Sourcepub fn is_simulation(&self) -> bool
pub fn is_simulation(&self) -> bool
Whether the execution mode is Mode::Simulate
.
Sourcepub fn is_execute(&self) -> bool
pub fn is_execute(&self) -> bool
Whether the execution mode is Mode::Execute
.
Sourcepub fn is_transaction(&self) -> bool
pub fn is_transaction(&self) -> bool
Whether there is an active transaction in the current environment.
Sourcepub fn tx_index(&self) -> usize
pub fn tx_index(&self) -> usize
An active transaction’s index (order) within the block.
§Panics
This method will panic if called outside a transaction environment.
Sourcepub fn tx_size(&self) -> u32
pub fn tx_size(&self) -> u32
An active transaction’s size in bytes.
§Panics
This method will panic if called outside a transaction environment.
Sourcepub fn tx_auth_info(&self) -> &AuthInfo
pub fn tx_auth_info(&self) -> &AuthInfo
An active transaction’s authentication information.
§Panics
This method will panic if called outside a transaction environment.
Sourcepub fn tx_call_format(&self) -> CallFormat
pub fn tx_call_format(&self) -> CallFormat
An active transaction’s call format.
§Panics
This method will panic if called outside a transaction environment.
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
An active transaction’s read only flag.
§Panics
This method will panic if called outside a transaction environment.
Sourcepub fn is_internal(&self) -> bool
pub fn is_internal(&self) -> bool
Whether the current execution environment is part of an internal subcall.
Sourcepub fn tx_caller_address(&self) -> Address
pub fn tx_caller_address(&self) -> Address
Authenticated address of the caller.
In case there are multiple signers of a transaction, this will return the address corresponding to the first signer. If there are no signers, it returns the default address.
§Panics
This method will panic if called outside a transaction environment.
Sourcepub fn tx_caller_public_key(&self) -> Option<PublicKey>
pub fn tx_caller_public_key(&self) -> Option<PublicKey>
Authenticated caller public key if available.
In case there are multiple signers of a transaction, this will return the public key
corresponding to the first signer. If there are no signers or if the address specification
does not represent a single public key, it returns None
.
§Panics
This method will panic if called outside a transaction environment.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more