op_context
You can only use system namespace op_context
in an operation or a function called from an operation, but not in a query.
- Functions
op_context.block_height -> integer
op_context.last_block_time -> integer
op_context.op_index -> integer
op_context.exists -> boolean
op_context.get_signers() -> list<byte_array>
op_context.is_signer(public_key: byte_array) -> boolean
op_context.get_all_operations() -> list<gtx_operation>
op_context.get_current_operation() -> gtx_operation
op_context.emit_event
op_context.transaction -> transaction
Functions
op_context.block_height -> integer
Provides the height of the block currently being built.
Parameters:
- None
Returns:
integer
: The height of the block being built.
op_context.last_block_time -> integer
Returns the timestamp of the last block in milliseconds.
Parameters:
- None
Returns:
integer
: The timestamp of the last block, or -1 if there is no last block.
op_context.op_index -> integer
Indicates the index of the operation being executed within the transaction.
Parameters:
- None
Returns:
integer
: The index of the operation being executed.
op_context.exists -> boolean
Indicates whether the code is being called from an operation.
Parameters:
- None
Returns:
boolean
:true
if the code is being called from an operation,false
otherwise.
op_context.get_signers() -> list<byte_array>
Returns a list of pubkeys representing the signers of the current transaction.
Parameters:
- None
Returns:
list<byte_array>
: A list of pubkeys of the signers.
op_context.is_signer(public_key: byte_array) -> boolean
Checks if the provided public key is one of the signers of the current transaction.
Parameters:
public_key
: The public key to check.
Returns:
boolean
:true
if the public key is a signer,false
otherwise.
op_context.get_all_operations() -> list<gtx_operation>
Returns a list of all operations within the current transaction.
Parameters:
- None
Returns:
list<gtx_operation>
: A list of all operations in the transaction.
op_context.get_current_operation() -> gtx_operation
Retrieves the current operation efficiently.
Parameters:
- None
Returns:
gtx_operation
: The current operation object.
op_context.emit_event
Facilitates communication from Rell code to Postchain components.
Parameters:
type
: Represents the type of event processor to invoke.data
: Contains the value to pass to the event processor.
Returns:
- None
op_context.transaction -> transaction
Represents the transaction currently being built.
Parameters:
- None
Returns:
transaction
: The transaction object.
You must not use op_context.transaction.block
because, except block_height
, its attributes are null, so reading them gives a run-time error.