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: .... })
}
}
```move
- [Function `emit`](#sui_event_emit)
## Function `emit` \{#sui_event_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 <a href="../sui/event#sui_event_emit">emit</a>(MyEvent<<b>phantom</b> T>).
<pre><code><b>public</b> <b>fun</b> <a href="../sui/event#sui_event_emit">emit</a><T: <b>copy</b>, drop>(<a href="../sui/event#sui_event">event</a>: T)
</code></pre>
<details>
<summary>Implementation</summary>
<pre><code><b>public</b> <b>native</b> <b>fun</b> <a href="../sui/event#sui_event_emit">emit</a><T: <b>copy</b> + drop>(<a href="../sui/event#sui_event">event</a>: T);
</code></pre>
</details>