sui_getEvents - Sui

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

This method returns transaction events for a specified transaction digest on the SUI network. Events are emitted during transaction execution by Move modules and contain important information about state changes, transfers, and other on-chain activities.

Parameters

Parameter
Type
Required
Description

transaction_digest

TransactionDigest

Yes

The transaction digest to query

Request Example

curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "sui_getEvents",
  "params": ["11a72GCQ5hGNpWGh2QhQkkusTEGS6EDqifJqxr7nSYX"]
}'

Response Example

response.json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "id": {
        "txDigest": "11a72GCQ5hGNpWGh2QhQkkusTEGS6EDqifJqxr7nSYX",
        "eventSeq": "0"
      },
      "packageId": "0xc54ab30a3d9adc07c1429c4d6bbecaf9457c9af77a91f631760853934d383634",
      "transactionModule": "test_module",
      "sender": "0xbcf7c32655009a61f1de0eae420a2e4ae1bb772ab2dd5d5a7dfa949c0ef06908",
      "type": "0x9::test::TestEvent",
      "parsedJson": {
        "test": "example value"
      }
    }
  ],
  "id": "getblock.io"
}

Response Parameters

Parameter
Type
Description

id

object

Event identifier (txDigest + eventSeq)

packageId

string

Package that emitted the event

transactionModule

string

Module that emitted the event

sender

string

Transaction sender

type

string

Event type

parsedJson

object

Parsed event data

Use Cases

  • Track transaction outcomes via events

  • Monitor smart contract activities

  • Build transaction history views

  • Debug transaction execution

Error Handling

Error Code
Description

-32602

Invalid params - malformed digest

-32603

Internal error - node issues

SDK Integration

Last updated

Was this helpful?