Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 3.23 KB

account-notification.md

File metadata and controls

55 lines (35 loc) · 3.23 KB
description
Subscribe to this topic to receive notifications about user balance update.

Account Notification

Rules

  • Topic name: account
  • ApiKey requred: Yes

Parameters

This topic has an optional flag: v3, which indicates the response is for v3 which has also include NFT info. if the flag is false or absent, the response is just like before.

ParameterNoteRequired
accountId(Optional) not required as apiKey also link to an accountN
v3(Optional) If it's a v3 sub which contains NFT info, default is false for compatible with previous sub topicN

Notification example

{
    "topic": {
        "topic:": "account"
    },
    "ts":1584717910000,
    "data": {
        "accountId":1,
        "totalAmount": "24439253519655",
        "tokenId": 2,
        "amountLocked": "0"
    }
}

Data Model

Notification

If v3 is true:

FieldTypeNoteRequired
topicJSONTopic and parametersY
tsintegerNotification timestamp (milliseconds)Y
dataBalanceV3User's new balances (NFT info included)Y

Otherwise:

FieldTypeNoteRequired
topicJSONTopic and parametersY
tsintegerNotification timestamp (milliseconds)Y
dataBalanceUser's new balancesY

BalanceV3

FieldTypeNoteRequired
accountIdintegerAccount IDY
tokenIdintegerToken IDY
totalstringTotal token balanceY
lockedstringToken balance locked by ordersY
nftIdstring(Optional)NFT ID if it's NFT tokenN
nftDatastring(Optional)NFT hash data if it's NFT tokenN
tokenAddressstring(Optional)NFT token address if it's NFT tokenN

Balance

FieldTypeNoteRequired
accountIdintegerAccount IDY
tokenIdintegerToken IDY
totalAmountstringTotal token balanceY
amountLockedstringToken balance locked by ordersY