AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.
Start building today!The API credit value for this method is 1 . To learn more about API credits and each method's value, visit the API Credits page.
Parameters:
Commitment - (optional) All fields are strings.
Finalized - the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
Confirmed - the node will query the most recent block that has been voted on by supermajority of the cluster.
Processed - the node will query its most recent block. Note that the block may not be complete.
encoding - encoding for Account data, either "base58" (slow), "base64", "base64+zstd", or "jsonParsed".
filters - filter results using various filter objects; account must meet all filter criteria to be included in results.
Returns:
number - Subscription id (needed to unsubscribe)
Notification Format:
Code Examples:
import solana import asyncio from asyncstdlib import enumerate from solana.rpc.websocket_api import connect from solana.publickey import PublicKey async def main(): async with connect("wss://sample-endpoint-name.network.quiknode.pro/token-goes-here/") as websocket: await websocket.program_subscribe(PublicKey('22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD')) first_resp = await websocket.recv() subscription_id = first_resp.result async for idx, msg in enumerate(websocket): print(msg) asyncio.run(main())
const web3 = require("@solana/web3.js"); (async () => { const publicKey = new web3.PublicKey( "22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD" ); const solanaConnection = new web3.Connection("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/", { wsEndpoint: "wss://sample-endpoint-name.network.quiknode.pro/token-goes-here/", }); solanaConnection.onProgramAccountChange( publicKey, (updatedProgramInfo, context) => console.log("Updated program info: ", updatedProgramInfo), "confirmed" ); })();
wscat -c wss://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ # wait for connection { "jsonrpc": "2.0", "id": 1, "method": "programSubscribe", "params": [ "11111111111111111111111111111111", { "encoding": "base64", "commitment": "finalized" } ] }