Solana
blockSubscribe10 kredi
Subscribes to notifications when a new block reaches confirmed or finalized commitment (WebSocket; unstable, needs a node with block subscription enabled).
Parametreler
| Ad | Tür | Açıklama |
|---|---|---|
| filter | string | Object | "all" for every block, or { mentionsAccountOrProgram: <pubkey> } for blocks with a transaction mentioning that address. |
| config | Object | Optional 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. (isteğe bağlı) |
Dönüş değeri
Tür
integer
Subscription id (integer). Pass it to blockUnsubscribe; notifications arrive as blockNotification messages.
Kod örnekleri
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}]}