Account updates
Receive an update when a matching Solana account changes, without polling getAccountInfo.
Subscribe to an account
import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc"; const client = new Client("https://geyser.sol.openinfra.sh:443", process.env.OPENINFRA_API_KEY!);await client.connect(); const stream = await client.subscribe({ accounts: { watched_account: { account: ["MFv2hWf31Z9kbCa1snEPdcgp7krqKMpCwv4CZKE1FaW"], owner: [], filters: [], nonemptyTxnSignature: false, }, }, commitment: CommitmentLevel.CONFIRMED, slots: {}, transactions: {}, transactionsStatus: {}, blocks: {}, blocksMeta: {}, entry: {}, accountsDataSlice: [],}); stream.on("data", (update) => { if (!update.account) return; const { account, slot } = update.account; console.log("slot", slot, "— lamports:", account.lamports); // account.data contains the raw account bytes.});Request a data slice
Use accountsDataSlice when you only need known byte ranges, such as an Anchor discriminator:
const stream = await client.subscribe({ accounts: { discriminator_only: { account: ["YourAccountAddress"], owner: [], filters: [], nonemptyTxnSignature: false, }, }, accountsDataSlice: [{ offset: "0", length: "8" }], commitment: CommitmentLevel.CONFIRMED, slots: {}, transactions: {}, transactionsStatus: {}, blocks: {}, blocksMeta: {}, entry: {},});Update causes
Account notifications can reflect changes to lamports, owner, executable status, or account data at the requested commitment.