Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 1.79 KB

block-generation-notification.md

File metadata and controls

73 lines (56 loc) · 1.79 KB
description
Subscribe to this topic to receive notifications about Loopring L2 block.

Block Generation Notification

Rules

  • Topic name: blockgen
  • ApiKey requred: No

Parameters

This topic has an optional flag: verbose, which indicates the response has more info about the blocks or just the block id. Once the user gets the block id notification, they can also call getBlock REST API to get the details.

Parameter Required Note
verbose N Default is false, so only block Id returns

Sub:

{
  "op": "sub",
  "sequence": 30006,
  "unsubscribeAll": false,
  "topics": [
    {
      "topic": "blockgen"
    }
  ]
}

Response:

{
  "op" : "sub",
  "sequence" : 30006,
  "topics" : [ {
    "topic" : "blockgen"
  } ],
  "result" : {
    "status" : "OK"
  }
}

Notification example

{
    "topic": {
        "topic:": "blockgen"
    },
    "ts":1584717910000,
    "data": {
    [
      {"blockid": 1},
      {"blockid": 2},
    ]
    }
}

Data Model

Notification

FieldTypeNoteRequired
topicJSONTopic and parametersY
tsintegerNotification timestamp (milliseconds)Y
data[BlockResp]Block generation messages, a list of BlockResp, refer to getBlock API for data formatY