Trait oasis_runtime_sdk::context::TxContext
source · pub trait TxContext: Context {
// Required methods
fn tx_index(&self) -> usize;
fn tx_size(&self) -> u32;
fn tx_auth_info(&self) -> &AuthInfo;
fn tx_call_format(&self) -> CallFormat;
fn is_read_only(&self) -> bool;
fn is_internal(&self) -> bool;
fn internal(self) -> Self;
fn tx_value<V: Any>(&mut self, key: &'static str) -> ContextValue<'_, V>;
fn emit_message(
&mut self,
msg: Message,
hook: MessageEventHookInvocation
) -> Result<(), Error>;
fn emit_unconditional_event<E: Event>(&mut self, event: E);
// Provided method
fn tx_caller_address(&self) -> Address { ... }
}
Expand description
Runtime SDK transaction context.
Required Methods§
sourcefn tx_auth_info(&self) -> &AuthInfo
fn tx_auth_info(&self) -> &AuthInfo
Transaction authentication information.
sourcefn tx_call_format(&self) -> CallFormat
fn tx_call_format(&self) -> CallFormat
The transaction’s call format.
sourcefn is_read_only(&self) -> bool
fn is_read_only(&self) -> bool
Whether the call is read-only and must not make any storage modifications.
sourcefn is_internal(&self) -> bool
fn is_internal(&self) -> bool
Whether the transaction is internally generated (e.g. by another module in the SDK as a subcall to a different module).
sourcefn internal(self) -> Self
fn internal(self) -> Self
Mark this context as part of an internally generated transaction (e.g. a subcall).
sourcefn tx_value<V: Any>(&mut self, key: &'static str) -> ContextValue<'_, V>
fn tx_value<V: Any>(&mut self, key: &'static str) -> ContextValue<'_, V>
Fetches an entry pointing to a value associated with the transaction.
sourcefn emit_message(
&mut self,
msg: Message,
hook: MessageEventHookInvocation
) -> Result<(), Error>
fn emit_message( &mut self, msg: Message, hook: MessageEventHookInvocation ) -> Result<(), Error>
Emit a consensus message.
sourcefn emit_unconditional_event<E: Event>(&mut self, event: E)
fn emit_unconditional_event<E: Event>(&mut self, event: E)
Similar as emit_event
but the event will persist even in case the transaction that owns
this context fails.
Provided Methods§
sourcefn tx_caller_address(&self) -> Address
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.