slotsUpdatesSubscribe RPC 方法

订阅以接收来自 validator 的通知,了解每个 slot 的各种更新

此订阅不稳定。此订阅的格式可能会在未来发生变化,并且可能并不总是受支持。

{
"jsonrpc": "2.0",
"id": 1,
"method": "slotsUpdatesSubscribe"
}

params

None

result

Response
{
"jsonrpc": "2.0",
"result": 0,
"id": 1
}
integer

订阅 ID(用于取消订阅)

通知格式

通知将是一个包含以下字段的对象:

  • err: <string|undefined> - 错误信息。仅当更新类型为 "dead" 时存在。
  • parent: <u64|undefined> - 父 slot。仅当更新类型为 "createdBank" 时存在。
  • slot: <u64> - 新更新的 slot
  • stats: <object|undefined> - 错误信息。仅当更新类型为 "frozen" 时存在。一个包含以下字段的对象:
    • maxTransactionsPerEntry: <u64>,
    • numFailedTransactions: <u64>,
    • numSuccessfulTransactions: <u64>,
    • numTransactionEntries: <u64>,
  • timestamp: <i64> - 更新的 Unix 时间戳(以毫秒为单位)
  • type: <string> - 更新类型之一:
    • "firstShredReceived"
    • "completed"
    • "createdBank"
    • "frozen"
    • "dead"
    • "optimisticConfirmation"
    • "root"
{
"jsonrpc": "2.0",
"method": "slotsUpdatesNotification",
"params": {
"result": {
"parent": 75,
"slot": 76,
"timestamp": 1625081266243,
"type": "optimisticConfirmation"
},
"subscription": 0
}
}

Is this page helpful?