This endpoint requires a Growth or Enterprise plan. Learn more.
Returns
Arguments
The commitment levels to subscribe to. When multiple commitment levels are subscribed to, events are emitted at most once per increasing commitment stage per subscriber. If a stronger commitment level is observed first, later weaker updates for the same event are suppressed for a short in-memory window. Preprocessed is supported only for Solana event subscriptions. Preprocessed evaluates pre-execution events and can differ significantly from processed or confirmed output. In particular, preprocessed swaps may use aggregator swaps before it is known how execution will route the underlying swaps, and many preprocessed events may error and never be processed.
See EventCommitmentLevel
Example Response
Usage Guidelines
- Pass
tokenAddressandnetworkIdto stream events for a token across all its liquidity pools - Unlike
onEventsCreated(which subscribes to a single pair), this aggregates swaps from every pool the token trades in - Each event includes
address— the pair contract where the swap occurred — so you can identify which pool it came from - The
eventsarray may contain multiple events per message - Use
eventDisplayTypefor human-readable buy/sell labels andtoken0SwapValueUsd/token1SwapValueUsdfor USD values
Troubleshooting Tips
When should I use onTokenEventsCreated vs onEventsCreated?
When should I use onTokenEventsCreated vs onEventsCreated?
Use
onTokenEventsCreated when you want to monitor all trading activity for a token regardless of which pool it happens in. Use onEventsCreated when you only care about a specific pair (e.g., SOL/USDC on a particular DEX).How do I tell which pool an event came from?
How do I tell which pool an event came from?
Each event includes an
address field — this is the pair contract address where the swap occurred. You can use this to group or filter events by pool.Can I stream events for all tokens on a network?
Can I stream events for all tokens on a network?
Yes. Omit
tokenAddress and pass only networkId to receive all events across the entire network. This requires an enterprise plan with EventFeed features and is extremely high-volume.What event types are included?
What event types are included?
Events include
Swap, Mint, and Burn types. eventDisplayType translates these into user-friendly labels like Buy, Sell, Add Liquidity, and Remove Liquidity.Related Recipes
- Detailed Token Page: Build a comprehensive token detail page with price, holders, trades, and real-time updates
- Events: Build a token swap list with filtering, pagination, and real-time updates