voteSubscribe RPC Method
The Solana Kit example uses
createSolanaRpcSubscriptions_UNSTABLE because the Kit API for vote subscriptions is currently experimental and the implementation may change. The voteSubscribe method itself is fully supported by the Quicknode WebSocket API.Parameters
This method does not accept any parameters
Returns
result
integer
Loading...
voteNotification
object
Loading...
votePubkey
string
Loading...
slots
array
Loading...
hash
string
Loading...
timestamp
integer|null
Loading...
signature
string
Loading...
Request
1import { createSolanaRpcSubscriptions_UNSTABLE } from '@solana/kit';23const rpcSubscriptions = createSolanaRpcSubscriptions_UNSTABLE('');45async function main() {6const abortController = new AbortController();78const votesNotification = await rpcSubscriptions9.voteNotifications()10.subscribe({ abortSignal: abortController.signal });1112try {13for await (const notification of votesNotification) {14console.log('hash:', notification.hash);15console.log('votePubkey:', notification.votePubkey);16console.log('slots:', notification.slots);17}18} catch (e) {19console.error(e);20} finally {21abortController.abort();22console.log('Unsubscribed from vote notifications');23}24}2526main();27
1import { createSolanaRpcSubscriptions_UNSTABLE } from '@solana/kit';23const rpcSubscriptions = createSolanaRpcSubscriptions_UNSTABLE('');45async function main() {6const abortController = new AbortController();78const votesNotification = await rpcSubscriptions9.voteNotifications()10.subscribe({ abortSignal: abortController.signal });1112try {13for await (const notification of votesNotification) {14console.log('hash:', notification.hash);15console.log('votePubkey:', notification.votePubkey);16console.log('slots:', notification.slots);17}18} catch (e) {19console.error(e);20} finally {21abortController.abort();22console.log('Unsubscribed from vote notifications');23}24}2526main();27
Response
1{2"jsonrpc": "2.0",3"result": 0,4"id": 15}
1{2"jsonrpc": "2.0",3"result": 0,4"id": 15}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free