Module util

Source
Expand description

Utility functions

Functionsยง

get_block_target
Everyone can call this. Will return runtime configured block target.
get_block_target_ ๐Ÿ”’ โš 
get_blockchain_time
Everyone can call this. Will return current blockchain timestamp.
get_blockchain_time_ ๐Ÿ”’ โš 
get_call_index
Only deploy(), metadata() and exec() can call this. Will return runtime configured verifying block height.
get_call_index_ ๐Ÿ”’ โš 
get_last_block_height
Only exec() can call this. Will return last block height.
get_last_block_height_ ๐Ÿ”’ โš 
get_object_bytes
Internal function, get raw bytes from the objects store
get_object_bytes_ ๐Ÿ”’ โš 
get_object_size
Internal function, get bytes size for an object in the store
get_object_size_ ๐Ÿ”’ โš 
get_tx
Only metadata() and exec() can call this. Will return transaction bytes by provided hash.
get_tx_ ๐Ÿ”’ โš 
get_tx_hash
Only deploy(), metadata() and exec() can call this. Will return runtime configured transaction hash.
get_tx_hash_ ๐Ÿ”’ โš 
get_tx_location
Only metadata() and exec() can call this. Will return transaction location by provided hash.
get_tx_location_ ๐Ÿ”’ โš 
get_verifying_block_height
Everyone can call this. Will return runtime configured verifying block height.
get_verifying_block_height_ ๐Ÿ”’ โš 
parse_ret ๐Ÿ”’
Auxiliary function to parse db_get return value. If either of these functions returns a negative integer error code, convert it into a ContractError.
parse_retval_u32 ๐Ÿ”’
set_return_data
Calls the set_return_data WASM function. Returns Ok(()) on success. Otherwise, convert the i64 error code into a ContractError.
set_return_data_ ๐Ÿ”’ โš