suix_queryEvents - Sui

Example code for the suix_queryEvents JSON-RPC method. Complete guide on how to use suix_queryEvents JSON-RPC in GetBlock Web3 documentation.

This method returns events matching specified query criteria on the SUI network. Events are emitted by Move modules during transaction execution and provide powerful tracking of on-chain activities.

Parameters

Parameter
Type
Required
Description
Default/Supported Values

query

object

Yes

Event filter criteria

EventFilter object

cursor

object

No

Paging cursor

EventID object

limit

integer

No

Maximum items per page

Default varies

descending_order

boolean

No

Sort order

false (ascending)

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "method": "suix_queryEvents",
  "params": [
    {"MoveModule": {"package": "0xa395759ca37c6e1ffc179184e98a6f9a2da5d78f6e34b0e5044ed52a6bc0a1bc", "module": "test"}},
    null,
    100,
    false
  ],
  "id": "getblock.io"
}'

Request Sample

Body Parameters

Parameter
Type
Description

result.data

array

Array of matching events

result.data[].id

object

Event identifier

result.data[].packageId

string

Package that emitted event

result.data[].type

string

Event type

result.data[].parsedJson

object

Event data as JSON

result.nextCursor

object

Cursor for pagination

result.hasNextPage

boolean

More results available

Use Cases

  • Event Monitoring: Track smart contract events in real-time for notifications.

  • Analytics: Build event-driven analytics and reporting dashboards.

  • Audit Trails: Create audit logs of contract interactions.

Errors Handling

Error

Invalid Filter

Malformed event filter

Check filter syntax

Invalid Cursor

Malformed cursor object

Use valid cursor from response

SDK Integration

Last updated

Was this helpful?