文档
定价GitHub控制台

Solana

blockSubscribe10 额度

Subscribes to notifications when a new block reaches confirmed or finalized commitment (WebSocket; unstable, needs a node with block subscription enabled).

网络: solana

参数

名称类型描述
filterstring | Object"all" for every block, or { mentionsAccountOrProgram: <pubkey> } for blocks with a transaction mentioning that address.
configObjectOptional configuration object. commitment: confirmed | finalized (default finalized; processed is not accepted); encoding: base64 | base58 | json | jsonParsed (default base64); transactionDetails: full | accounts | signatures | none (default full); maxSupportedTransactionVersion: number; showRewards: boolean. (可选)

返回值

类型

integer

Subscription id (integer). Pass it to blockUnsubscribe; notifications arrive as blockNotification messages.

代码示例

wscat -c wss://holy-burned-sky-solana-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7
> {"jsonrpc":"2.0","id":1,"method":"blockSubscribe","params":[{"mentionsAccountOrProgram":"LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op"},{"commitment":"confirmed","encoding":"base64","transactionDetails":"full","maxSupportedTransactionVersion":0,"showRewards":true}]}