Skip to main content

Event

type Event​

An event emitted during the successful execution of a transaction.

This mirrors the core chain [`iota_sdk::types::Event`] one-to-one: every field is required and the type round-trips through BCS/JSON. For events returned by the GraphQL `events` query — which may originate from system transactions and therefore lack a sender or emitting module — see [`GraphQLEvent`](crate::graphql::query_types::GraphQLEvent).

BCS​

The BCS serialized form of this type is specified in [`bcs-schema.abnf`](https://github.com/iotaledger/iota-rust-sdk/blob/develop/crates/iota-sdk-types/bcs-schema.abnf\).

type Event struct {
// Package id of the top-level function invoked by a MoveCall command which triggered this
// event to be emitted.
PackageId *ObjectId
// Module name of the top-level function invoked by a MoveCall command which triggered this
// event to be emitted.
Module string
// Address of the account that sent the transaction where this event was emitted.
Sender *Address
// The type of the event emitted
StructTag string
// BCS serialized bytes of the event
Contents []byte
}

func EventFromBcs​

func EventFromBcs(bcs []byte) (Event, error)

Create this type from BCS encoded bytes.

func EventFromJson​

func EventFromJson(json string) (Event, error)

Create this type from a JSON encoded string.

func (*Event) Destroy​

func (r *Event) Destroy()

func (Event) ToBcs​

func (_self Event) ToBcs() ([]byte, error)

Convert this type to BCS encoded bytes.

func (Event) ToDisplayString​

func (_self Event) ToDisplayString() (string, error)

Render this type as human-readable text.

The layout is meant for reading and can change between releases. Use the JSON or BCS conversions for output that gets parsed.

func (Event) ToJson​

func (_self Event) ToJson() (string, error)

Convert this type to a JSON encoded string.