suix_queryEvents{deprecated} - Sui

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

This method is deprecated

Parameters

ParameterTypeRequiredDescriptionDefault/Supported Values
queryobjectYesEvent filter criteriaEventFilter object
cursorobjectNoPaging cursorEventID object
limitintegerNoMaximum items per pageDefault varies
descending_orderbooleanNoSort orderfalse (ascending)

Request Example

bashcurl --location --request POST 'https://shared.eu-central-1.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"
}'
javascriptimport axios from 'axios';

const data = JSON.stringify({
  "jsonrpc": "2.0",
  "method": "suix_queryEvents",
  "params": [
    {"MoveModule": {"package": "0xa395759ca37c6e1ffc179184e98a6f9a2da5d78f6e34b0e5044ed52a6bc0a1bc", "module": "test"}},
    null,
    100,
    false
  ],
  "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));
pythonimport requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = json.dumps({
  "jsonrpc": "2.0",
  "method": "suix_queryEvents",
  "params": [
    {"MoveModule": {"package": "0xa395759ca37c6e1ffc179184e98a6f9a2da5d78f6e34b0e5044ed52a6bc0a1bc", "module": "test"}},
    null,
    100,
    false
  ],
  "id": "getblock.io"
})

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)
rustuse reqwest::header;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header(header::CONTENT_TYPE, "application/json")
        .body(r#"{
            "jsonrpc": "2.0",
            "method": "suix_queryEvents",
            "params": [
              {"MoveModule": {"package": "0xa395759ca37c6e1ffc179184e98a6f9a2da5d78f6e34b0e5044ed52a6bc0a1bc", "module": "test"}},
              null,
              100,
              false
            ],
            "id": "getblock.io"
          }"#)
        .send()
        .await?;
    
    println!("{}", response.text().await?);
    Ok(())
}

Request Sample

json{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": {
    "data": [
      {
        "id": {"txDigest": "FFwCMgC7FHBLEwfL9JeSeR2EhMAZMykUPVW1kE3HgTMe", "eventSeq": "1"},
        "packageId": "0xb2fd632992b01aa25900867288b63d6255ff8223c12b0fd985c49d5777a0d65a",
        "transactionModule": "test",
        "sender": "0xcceee09f44d558691334ec0aff47af033f57162a2f33056e2585e2c46863ac02",
        "type": "0x3::test::TestEvent",
        "parsedJson": {"value": "example"}
      }
    ],
    "nextCursor": {"txDigest": "FFwCMgC7FHBLEwfL9JeSeR2EhMAZMykUPVW1kE3HgTMe", "eventSeq": "1"},
    "hasNextPage": false
  }
}

Body Parameters

ParameterTypeDescription
result.dataarrayArray of matching events
result.data[].idobjectEvent identifier
result.data[].packageIdstringPackage that emitted event
result.data[].typestringEvent type
result.data[].parsedJsonobjectEvent data as JSON
result.nextCursorobjectCursor for pagination
result.hasNextPagebooleanMore 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 FilterMalformed event filterCheck filter syntax
Invalid CursorMalformed cursor objectUse valid cursor from response

SDK Integration

Sui TypeScript SDK

typescriptimport { SuiClient } from '@mysten/sui/client';
const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });
const events = await client.queryEvents({
  query: { MoveModule: { package: '0x2', module: 'coin' } },
  limit: 100
});
console.log(events);