> ## 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.

# onEventLabelCreated

> Live-streamed event labels for a token.

<div data-generated>
  ## GraphQL

  ```
  type Subscription {
    # Requires a Growth or Enterprise plan.
    onEventLabelCreated(
      id: String
    ): EventLabel
  }

  type FrontRunLabelData {
    index: Int
    token0DrainedAmount: String!
    token1DrainedAmount: String!
  }

  type SandwichedLabelData {
    token0DrainedAmount: String
    token1DrainedAmount: String
  }

  union EventLabelData = FrontRunLabelData | SandwichedLabelData

  enum EventLabelType {
    FrontRun
    Sandwiched
  }

  type EventLabel {
    data: EventLabelData!
    id: String!
    label: EventLabelType!
    logIndex: Int!
    networkId: Int!
    timestamp: Int!
    transactionIndex: Int!
    transactionHash: String!
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```graphql theme={null}
subscription {
  onEventLabelCreated(id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1") {
    id
    label
    networkId
    timestamp
    transactionHash
    data {
      ... on FrontRunLabelData {
        index
        token0DrainedAmount
        token1DrainedAmount
      }
      ... on SandwichedLabelData {
        sandwichedToken0Drained: token0DrainedAmount
        sandwichedToken1Drained: token1DrainedAmount
      }
    }
  }
}
```
