Skip to main content

Query Events

Alpha Software

The IOTA SDK is currently in alpha. APIs, interfaces, and behavior may change without notice between releases. It is not yet recommended for production use.

This guide shows you how to query events emitted by a Move package using the IOTA SDK's GraphQL client.

Prerequisites

  • The IOTA SDK installed for your target language
  • The fully qualified event type you want to query (<package>::<module>::<EventName>)

Steps

1. Initialize the GraphQL Client

Create a client connected to the IOTA Testnet.

crates/iota-sdk/examples/package_events.rs
loading...

2. Query Events by Event Type

Query events matching an event filter with the fully qualified event type, using a pagination filter to limit the number of results.

crates/iota-sdk/examples/package_events.rs
loading...

3. Iterate Over the Events

Print the type, sender, module, and JSON payload of each returned event.

crates/iota-sdk/examples/package_events.rs
loading...

Expected Output

Type: 0x<package-id>::registry::NameRecordAddedEvent
Sender: 0x<sender-address>
Module: registry
JSON: {"domain":...}
...

Full Example

crates/iota-sdk/examples/package_events.rs
loading...