- Struct
TxContext
- Struct
ModuleUpgradeFlag
- Constants
- Function
sender
- Function
sequence_number
- Function
max_gas_amount
- Function
fresh_address
- Function
derive_id
- Function
tx_hash
- Function
add_attribute_via_system
- Function
get_attribute
- Function
contains_attribute
- Function
tx_meta
- Function
tx_gas_payment_account
- Function
tx_result
- Function
is_system_call
- Function
set_module_upgrade_flag
- Function
drop
use 0x1::hash;
use 0x1::option;
use 0x1::string;
use 0x1::vector;
use 0x2::bcs;
use 0x2::copyable_any;
use 0x2::core_addresses;
use 0x2::simple_map;
use 0x2::tx_meta;
use 0x2::tx_result;
use 0x2::type_info;
Information about the transaction currently being executed.
struct TxContext
struct ModuleUpgradeFlag has copy, drop, store
const ErrorInvalidContext: u64 = 1;
Return the address of the user that signed the current transaction
public fun sender(): address
Return the sequence number of the current transaction
public fun sequence_number(): u64
Return the max gas to be used
public fun max_gas_amount(): u64
Generate a new unique address,
public fun fresh_address(): address
Return the hash of the current transaction
Add a value to the context map via system reserved address
public fun add_attribute_via_system<T: copy, drop, store>(system: &signer, value: T)
Get attribute value from the context map
public fun get_attribute<T: copy, drop, store>(): option::Option<T>
Check if the key is in the context map
public fun contains_attribute<T: copy, drop, store>(): bool
Get the transaction meta data The TxMeta is writed by the VM before the transaction execution. The meta data is only available when executing or validating a transaction, otherwise abort(eg. readonly function call).
public fun tx_meta(): tx_meta::TxMeta
Get the gas payment account of the transaction Currently, the gas payment account is the sender of the transaction. In the future, the gas payment account may be different from the sender.
public fun tx_gas_payment_account(): address
The result is only available in the post_execute
function.
public fun tx_result(): tx_result::TxResult
Check if the current transaction is a system call The system call is a special transaction initiated by the system.
public fun is_system_call(): bool
public(friend) fun set_module_upgrade_flag(is_upgrade: bool)
public fun drop(self: tx_context::TxContext)