Struct oasis_runtime_sdk::state::Environment
source · 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 moresource§impl Debug for Environment
impl Debug for Environment
source§impl Default for Environment
impl Default for Environment
source§fn default() -> Environment
fn default() -> Environment
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)