Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.codex.io/llms.txt

Use this file to discover all available pages before exploring further.

Returns

EventConnection
EventConnection
See EventConnection

Arguments

limit
Int
The maximum number of transactions to return.
query
EventsQueryInput!
required
The query filters to apply to the results. See EventsQueryInput
cursor
String
The cursor to use for pagination.
direction
RankingDirection
The order to receive the token events. Can be DESC (default) or ASC. See RankingDirection

Example

Test this query in the Explorer →
{
  getTokenEvents(
    query: {address: "So11111111111111111111111111111111111111112", networkId: 1399811149}
    limit: 10
  ) {
    items {
      eventDisplayType
      timestamp
      maker
      transactionHash
      token0SwapValueUsd
      token1SwapValueUsd
      data {
        ... on SwapEventData {
          priceUsd
          priceUsdTotal
        }
      }
    }
    cursor
  }
}

Usage Guidelines

  • Pass a token address or pair address to the address field; if you pass a token address, it will automatically find the top pair for that token
  • Use eventDisplayType filter to get only Buy or Sell events (splits swaps into directional trades)
  • Use eventType: Swap to filter for only swap transactions, excluding liquidity events
  • Use maker filter to get transactions for a specific wallet address
  • Use timestamp filter with from and to for historical event lookups
  • Use priceUsdTotal filter to find large trades (e.g., priceUsdTotal: {gte: 10000})
  • Results are ordered by most recent first by default; use direction: ASC for oldest first

Troubleshooting Tips

Use eventDisplayType instead of eventType. While eventType returns Swap for all swaps, eventDisplayType splits them into Buy or Sell based on the direction of the trade relative to the quote token.
Add eventType: Swap to your query filters to exclude liquidity add/remove events. Alternatively, use eventDisplayType: [Buy, Sell] to get only buy and sell events.
Use the timestamp filter with from and to unix timestamps. For example: timestamp: {from: 1704067200, to: 1704153600} for a 24-hour window.
priceUsd is the price per token at the time of the swap. priceUsdTotal is the total USD value of the swap (amountNonLiquidityToken x priceUsd). Use priceUsdTotal for filtering by trade size.
Check the labels field on events. It contains sandwich labels (with types sandwiched, frontrun, backrun) and washtrade labels when detected.
getTokenEvents looks at the top pair when filtering for events, not all pairs. If the missing transactions occurred on a different pair, use listPairsWithMetadataForToken to find the correct pool (filter by volume) and pass that pair address to getTokenEvents.
  • 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