SubscribeEvents - Sui

SubscribeEvents. Streams new events in real time, with optional filters.

SubscribeEvents - sui [Value: 20CU]
Server-streaming subscription. Streams events as they are emitted, optionally filtered by sender, emitting module or event type.
gRPC: sui.rpc.v2.SubscriptionService/SubscribeEvents
Use cases

Use cases

  • React to protocol events
  • Track DEX swaps in real time
  • Stream staking events
Constraints

Constraints

  • Starts at the current tip
  • No resumption, replay with ListEvents
  • Runs until cancelled
Get started
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
grpcurl \
  -H "x-drpc-key: {API-KEY}" \
  -H "x-drpc-chain: sui" \
  -d '{
  "filter": {
    "terms": [
      { "literals": [ { "event_type": { "event_type": "0x3::validator::StakingRequestEvent" } } ] }
    ]
  }
}' \
  grpc.drpc.live:443 \
  sui.rpc.v2.SubscriptionService/SubscribeEvents
Copy
Response
200
{
  "watermark": {
    "cursor": "AAAAAA+FNWkAAAAAAAAAAAAAAAA=",
    "checkpoint": "260411497",
    "cursor_position": { "checkpoint": "260411497" }
  }
}
{
  "event": {
    "package_id": "0x0000000000000000000000000000000000000000000000000000000000000003",
    "module": "sui_system",
    "sender": "0x94096a6a54129234237759c66e6ef1037224fb3102a0ae29d33b490281c8e4d5",
    "event_type": "0x3::validator::StakingRequestEvent",
    "json": {
      "amount": "1000000000",
      "epoch": "1084",
      "staker_address": "0x94096a6a54129234237759c66e6ef1037224fb3102a0ae29d33b490281c8e4d5"
    },
    "checkpoint": "260411520",
    "transaction_digest": "J4NvV5iQZQFm1xKPYv9ffDCCPW6cZ4yFKsCqFUiDX5L4",
    "transaction_index": "11",
    "event_index": 0
  },
  "watermark": {
    "cursor": "AAAAAA+FNYAAAAAAAAAACwAAAAA=",
    "checkpoint": "260411519",
    "cursor_position": { "checkpoint": "260411520", "transaction_index": "11", "event_index": 0 }
  }
}
...
Copy

Request params

Parametersobject
object
read_maskstring
Optional. google.protobuf.FieldMask with the fields to return, as comma-separated paths. Defaults to `event_type`. Use `*` to return all fields.
filterobject
Optional. Filter in disjunctive normal form: `terms` (OR) of `literals` (AND). Each literal sets one predicate: `sender`, `emit_module`, `event_type` or `event_stream_head`, and optional `negated`.

Response

200
An unbounded stream of frames. The first frame of a filtered stream is progress-only and sets the start position.

Response params

object
eventobject
One matching event. Not set on progress-only frames.
object
package_idstring
Package id of the top-level function invoked by the `MoveCall` that triggered the event.
modulestring
Module of the top-level function invoked by the `MoveCall` that triggered the event.
senderstring
Address of the account that sent the transaction that emitted the event.
event_typestring
Type of the event.
contentsobject
BCS-serialized event bytes.
jsonobject
JSON rendering of the event contents.
checkpointstring
Checkpoint that includes the emitting transaction. Set when the event is delivered on its own, as in ListEvents and SubscribeEvents.
transaction_digeststring
Digest of the transaction that emitted the event.
transaction_indexstring
Position of the emitting transaction within its checkpoint.
event_indexinteger
Index of the event within the transaction's events.
watermarkobject
Progress watermark, present on every frame.
object
cursorstring
Opaque resume cursor (bytes, base64), set on every watermark. Pass it back unchanged as `options.after` (ascending) or `options.before` (descending) to resume.
checkpointstring
Inclusive boundary checkpoint the scan has fully covered. Unset until the first checkpoint is fully covered.
cursor_positionobject
Resume point in ledger coordinates: `checkpoint`, `transaction_index`, `event_index`. Set by servers that support it.