Module sui::event
Events module. Defines the sui::event::emit function which creates and sends a custom MoveEvent as a part of the effects certificate of the transaction.
Every MoveEvent has the following properties:
- sender
- type signature (T)
- event data (the value of T)
- timestamp (local to a node)
- transaction digest
Example:
module my::marketplace \{
use sui::event;
/* ... */
struct ItemPurchased has copy, drop {
item_id: ID, buyer: address
\}
entry fun buy(/* .... */) \{
/* ... */
event::emit(ItemPurchased { item_id: ..., buyer: .... \})
}
}
use std::address;
use std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::type_name;
use std::vector;
use sui::accumulator;
use sui::accumulator_settlement;
use sui::address;
use sui::bcs;
use sui::dynamic_field;
use sui::hash;
use sui::hex;
use sui::object;
use sui::party;
use sui::transfer;
use sui::tx_context;
use sui::vec_map;
Function emit
Emit a custom Move event, sending the data offchain.
Used for creating custom indexes and tracking onchain activity in a way that suits a specific application the most.
The type T is the main way to index the event, and can contain phantom parameters, eg emit(MyEvent<phantom T>).
public fun emit<T: copy, drop>(event: T)
Function emit_authenticated
Emits a custom Move event which can be authenticated by a light client.
This method emits the authenticated event to the event stream for the Move package that
defines the event type T.
Only the package that defines the type T can emit authenticated events to this stream.
public fun emit_authenticated<T: copy, drop>(event: T)
Function emit_authenticated_impl
fun emit_authenticated_impl<StreamHeadT, T: copy, drop>(accumulator_id: address, stream: address, event: T)