Skip to main content
Subscribe to account writes when you need updated balances or program state. An owner filter means the program that owns an account, not the wallet that owns tokens inside it. Save the quickstart helper as stream.mts in the same directory. These examples use the same environment variables and dependencies.

Watch one account

accounts.mts

Filter program accounts

This request selects legacy SPL Token accounts for one mint and downloads only their amount field. Pass request to subscribe(request) in place of the previous account filter.
The spelling is datasize, and offsets are strings in this client. Filters within one named account filter are combined; named filters can be used for separate selections.

Decode sliced token amounts

Inside the account handler, decode the eight-byte slice as an unsigned little-endian integer:
The 165-byte size and offsets above describe legacy SPL Token accounts. Token-2022 extensions can change account size. Do not apply this filter to every token program without checking its layout.

Keep state after a disconnect

Store the account address, slot, and write version with each update. Refresh a REST/RPC snapshot after a gap before treating the local cache as current. A wallet-address subscription alone does not cover its separate token accounts.

Transactions

Pump.fun accounts