Subscribing to Avatar events
The Circles SDK let's you subscribe to protocol events. Either filtered for an avatar or as a complete stream. There is also a way to query all past events in a block range.
Subscribe
To subscribe, you need an initialized CirclesData class.
Then call the subscribeToEvents()
method and supply the address of the avatar to subscribe to:
If you want to subscribe to all events, call it without parameter:
Query past events
If your client missed some events, you can query all events for a specific avatar in a block range.
You can omit the last parameter (toBlock
) to query from fromBlock
to the latest block:
Event types
The above methods yield CirclesEvent
s. All events have at least the following base properties:
$event: CirclesEventType
One of the event types listed belowblockNumber: number
In which block the event occurredtimestamp?: number
When the event occurredtransactionIndex: number
The index of the transaction in the blocklogIndex: number
The index of the log entry in the transactiontransactionHash?: string
The transaction hash
Here's a list of all event types. Please refer to the source code for the event properties.
Last updated