Subscriptions
Managing Stratus Subscription
Subscriptions empower developers to receive real-time updates triggered by smart contract events or internal loyalty actions. These notifications can either be sent to a webhook endpoint or used to automatically invoke functions.
Blockchain Events
Blockchain events notify you whenever a smart contract emits an event or a function is called. Because these events closely track on-chain state (typically lagging by only one block), they are ideal for applications that need near real-time updates.
-
Add Contract to Admin Account: Start by adding the desired smart contract to your admin panel.
-
Select Event: Once added, choose “EVENT” from the subscription options. All available events for the contract will be populated automatically, allowing you to select the specific event you wish to monitor.
Blockchain Function Events
The subscription process for smart contract function events is nearly identical to that for blockchain events:
-
Add Contract to Admin Panel: Ensure the contract is registered in your admin panel.
-
Select Function: Choose “FUNCTION” after adding the contract. All smart contract functions will be listed automatically so you can subscribe to the one you require.
Snag Events
Snag events allow subscriptions to internal platform actions, triggering webhooks or function invocations when a specific action occurs. These events relate to loyalty account activities and may have a slight delay (up to 30 seconds) after the action is recorded in the Snag database.
LoyaltyTransactionEntry
This event is triggered every time a user’s account balance is updated.
Sample JSON:
UserMetadata
Emitted when a user’s profile is created or updated (e.g., when a Twitter handle is added or a username is changed).
Sample JSON:
UserTokenActivity
This event is emitted each time a token-related activity is registered.
Sample JSON: