Token Events

Live-streamed transactions for a specific token pair.

ℹī¸

This endpoint is available on Codex Growth and Enterprise Plans

Endpoint: onEventsCreated

Method: POST

Arguments

NameTypeDescription
addressString

The pair contract address.

idString

The ID of the pair (address:networkId).

networkIdInt

The networkId to use when getting all events per network

quoteTokenQuoteToken

The token of interest within the pair. Can be token0 or token1.

Response

NameTypeDescription
addressString!The contract address of the pair.
events[Event]!A list of transactions for the token.
idString!The ID of the event (address:networkId). For example, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2:1.
networkIdInt!The network ID that the token is deployed on.
quoteTokenQuoteTokenThe token of interest within the pair. Can be token0 or token1.

Example

Query

subscription OnEventsCreated($id: String) {
  onEventsCreated(id: $id) {
    events {
      address
      baseTokenPrice
      blockHash
      blockNumber
      eventDisplayType
      eventType
      logIndex
      id
      liquidityToken
      maker
      networkId
      timestamp
      token0SwapValueUsd
      token0ValueBase
      token1SwapValueUsd
      token1ValueBase
      transactionHash
      transactionIndex
      data {
        ... on MintEventData {
          amount0
          amount1
          amount0Shifted
          amount1Shifted
          tickLower
          tickUpper
          type
        }
        ... on BurnEventData {
          amount0
          amount1
          amount0Shifted
          amount1Shifted
          tickLower
          tickUpper
          type
        }
        ... on SwapEventData {
          amount0
          amount0In
          amount0Out
          amount1
          amount1In
          amount1Out
          amountNonLiquidityToken
          priceBaseToken
          priceBaseTokenTotal
          priceUsd
          priceUsdTotal
          tick
          type
        }
      }
    }
    address
    id
    networkId
  }
}

Response

{
  "id": "bnb-events",
  "type": "data",
  "payload": {
    "data": {
      "onCreateEvents": {
        "events": [
          {
            "address": "0x58f876857a02d6762e0101bb5c46a8c1ed44dc16",
            "baseTokenPrice": "31972701807.9466497574162141128109855658367",
            "blockHash": "0x55fee589883ec6973e414c598d4ff1f1a20262fe644f0dbffcd74804bcbe4ed6",
            "blockNumber": 22721106,
            "eventDisplayType": "Buy",
            "eventType": "Swap",
            "logIndex": 78,
            "id": "0x58f876857a02d6762e0101bb5c46a8c1ed44dc16:56",
            "liquidityToken": "0xe9e7cea3dedca5984780bafc599bd69add087d56",
            "maker": "0x22d8ef6ad425a69c96101fc887e8c62107ffa18d",
            "networkId": 56,
            "timestamp": 1667430845,
            "token0SwapValueUsd": "320.52828969536842982056163964498858966528",
            "token0ValueBase": "1",
            "token1SwapValueUsd": "1.000000000000000000000000000000000000009336889735795103553757695237861949830656",
            "token1ValueBase": "0.003127668115152705578714756116897770214",
            "transactionHash": "0xcbc1d5830e29808a32860c526e83a87b358d304a1bc0ddac76686a709f74a90c",
            "transactionIndex": 29,
            "data": {
              "amount0": null,
              "amount0In": "0",
              "amount0Out": "42055278366282752",
              "amount1": null,
              "amount1In": "13479906447407238672",
              "amount1Out": "0",
              "amountNonLiquidityToken": "0.042055278366282752",
              "priceBaseToken": "1.0025061116846333514935379137040190924557",
              "priceBaseTokenTotal": "0.042055278366282752",
              "priceUsd": "320.52828969536842982056163964498858966528",
              "priceUsdTotal": "13.47990644740723867200000000000000000000000097903751725056",
              "tick": null,
              "type": "Swap"
            }
          }
        ]
      }
    }
  }
}

👋

Join our Discord

Ask questions, share what you're working on and request new features đŸ‘Ŧ👭