Notification Events
The SDK is notification based, so from within your game, you will need to have a clean way of responding to each with complementary events. This is to prevent games needing to continuously poll our backend for updates. The SDK is focused around providing data streams for two assets - NFTs and tokens.
Game Actions
BalanceRequested
When a request is made for the user's balance, a BalanceRequested event is triggered.
The handler for this event should respond with balance for the user by using the function SendBalance(receivedEvent, balance)
. The RequestId stored in event will be used for request identification on API-side.
This is an example of the notification that will be sent to the game:
InGameCurrencyDeposit
When the user has exchanged on-chain tokens into in-app currency, the game receives a notification with amount deposited for the current user.
It is up to the game to update the user's in-game currency with the amount provided. The game will need to increment the user's in-game currency by this amount.
This is an example of the notification that will be sent to the game:
NftLinkStatusChanged
When the user links or unlinks an NFT to the game, an NftLinkStatusChanged event is triggered.
This is an example of the notification that will be sent to the game:
InGameCurrencyWithdrawal
This event will be sent to the game when the user starts to exchange in-game currency for on-chain tokens.
The handler for this event should adjust the user balance and respond with a Result
by using the function SendWithdrawResult(receivedEvent, result)
.
For details on how the token withdrawal works, please have a look at this call diagram.
This is an example of the notification that will be sent to the game:
RollbackWithdrawal
This event will be sent to the game when an on-chain transaction fails.
The handler for this event should adjust user balance and respond with Result
by using the function SendRollbackWithdrawResult(receivedEvent, result)
.
This is an example of the notification that will be sent to the game:
Last updated