> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hadron.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Recent Swaps

> Returns swap events for a pool, ordered newest first. Cursor-paginated — you can walk the full history of a pool by following `next_cursor`.

## Path Parameters

<ParamField path="address" type="string" required>
  The pool config PDA address.
</ParamField>

## Query Parameters

<ParamField query="limit" default="50" type="integer">
  Page size — number of swaps to return per request. Maximum `200`.
</ParamField>

<ParamField query="cursor" type="string">
  Opaque pagination cursor. Omit on the first request; on subsequent requests, pass the `next_cursor` value from the previous response to fetch the next page. When the server returns `next_cursor: null` (equivalently `has_more: false`), you have reached the end of the pool's history.
</ParamField>

<ParamField query="cluster" default="mainnet-beta" type="string">
  Solana cluster — `mainnet-beta` or `devnet`.
</ParamField>

## Response

<ResponseField name="data" type="array">
  Array of swap events on this page, ordered by most recent first.

  <Expandable title="Swap event">
    <ResponseField name="signature" type="string">
      Solana transaction signature.
    </ResponseField>

    <ResponseField name="timestamp" type="integer">
      Swap timestamp (Unix seconds).
    </ResponseField>

    <ResponseField name="slot" type="integer">
      Solana slot number.
    </ResponseField>

    <ResponseField name="direction" type="string">
      Swap direction — `buy` (Y to X) or `sell` (X to Y).
    </ResponseField>

    <ResponseField name="input_amount" type="integer">
      Raw input token amount.
    </ResponseField>

    <ResponseField name="output_amount" type="integer">
      Raw output token amount.
    </ResponseField>

    <ResponseField name="input_mint" type="string">
      Input token mint address.
    </ResponseField>

    <ResponseField name="output_mint" type="string">
      Output token mint address.
    </ResponseField>

    <ResponseField name="midprice_at_swap" type="number">
      The pool midprice at the time of the swap (raw Q32-decoded value).
    </ResponseField>

    <ResponseField name="execution_price_at_swap" type="number">
      Effective execution price in Y-per-X terms, excluding the protocol fee. Directly comparable to `midprice_at_swap`.
    </ResponseField>

    <ResponseField name="base_spread_factor_at_swap" type="number | null">
      The pool's base spread factor read from the oracle at the time of the swap. `1.0` means no base spread; e.g. `0.9995` means the LP charged ≈5 bps of base spread before any inventory skew. Values above `1.0` indicate the curve was skewed in the trader's favor (the LP gave up base spread to rebalance inventory) — this is the conceptual fee the LP is *still* earning even when `realized_spread_quote_raw` is negative. `null` for swaps recorded before this field was tracked.
    </ResponseField>

    <ResponseField name="vault_x_after" type="integer">
      Vault X balance after the swap.
    </ResponseField>

    <ResponseField name="vault_y_after" type="integer">
      Vault Y balance after the swap.
    </ResponseField>

    <ResponseField name="fees" type="object">
      Fee and execution quality metrics for the swap.

      <Expandable title="Fees">
        <ResponseField name="protocol_fee_quote_raw" type="number">
          Protocol fee in raw Y (quote-side) atoms. For sell swaps (fee paid in X), converted to Y-equivalent using midprice.
        </ResponseField>

        <ResponseField name="protocol_fee_raw" type="number">
          Protocol fee in raw atoms of the **fee token** (the swap's input token — X on a sell, Y on a buy). Unlike `protocol_fee_quote_raw`, this is not midprice-converted.
        </ResponseField>

        <ResponseField name="protocol_fee_mint" type="string">
          Mint of the fee token (equals `input_mint`).
        </ResponseField>

        <ResponseField name="realized_spread_quote_raw" type="number">
          Spread captured by the pool in raw Y (quote-side) atoms. Positive values indicate pool profit; negative values indicate the trade executed better than midprice. For buy swaps this is a Y-equivalent conversion of the X atoms the pool saved.
        </ResponseField>

        <ResponseField name="realized_spread_bps" type="number">
          Spread captured by the pool in basis points of the trade's notional value at midprice. Unit-independent — directly comparable across pools and directions.
        </ResponseField>

        <ResponseField name="protocol_fee_split" type="array | null">
          Per-recipient breakdown of the protocol fee for pools whose fee routes through the **fee-split sidecar**. `null` for pools that use the default (single) fee recipient, and for swaps recorded before this field was tracked.

          Amounts are exact proportional shares of `protocol_fee_raw` (`protocol_fee_raw × ppm / Σ ppm`) — they sum to `protocol_fee_raw`. The split ratio is captured at the swap's slot, so it is exact even if the pool's recipient weights change later.

          <Expandable title="Recipient">
            <ResponseField name="recipient" type="string">
              Recipient wallet address.
            </ResponseField>

            <ResponseField name="ppm" type="integer">
              Recipient's split weight in parts-per-million, as configured on-chain at the time of the swap. The denominator is the sum of all recipients' `ppm` (not a fixed 1,000,000).
            </ResponseField>

            <ResponseField name="amount_raw" type="number">
              Recipient's share of `protocol_fee_raw`, in fee-token atoms.
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="next_cursor" type="string | null">
  Cursor to pass as `?cursor=...` on the next request to fetch the following page. `null` when there are no more swaps (end of history).
</ResponseField>

<ResponseField name="has_more" type="boolean">
  `true` if more swaps are available beyond this page, `false` if this is the last page.
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "data": [
      {
        "signature": "5ZVLukBf3HfmT7d9Emte1fobjhtHsjps5TXtNZboTK3di76NbVUxHsLDFuzcnyhnjYLNnVdJajKg9k5NJCs9CLCi",
        "timestamp": 1773239448,
        "slot": 405713180,
        "direction": "buy",
        "input_amount": 86476334,
        "output_amount": 998378024,
        "input_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "output_mint": "So11111111111111111111111111111111111111112",
        "midprice_at_swap": 0.08647878072224557,
        "execution_price_at_swap": 0.08662,
        "base_spread_factor_at_swap": 0.9995,
        "vault_x_after": 5413038034,
        "vault_y_after": 515256215,
        "fees": {
          "protocol_fee_quote_raw": 0,
          "protocol_fee_raw": 0,
          "protocol_fee_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
          "realized_spread_quote_raw": 142136,
          "realized_spread_bps": 16.44,
          "protocol_fee_split": null
        }
      },
      {
        "signature": "4b76z7T6gqn5aNjvDN3eE4X9dLrdR88DNYomkugjRvExxLRrYAgumaoGbzN8NYPFXvoXaeM9bbmD6P2tp5aTT2Tn",
        "timestamp": 1773239444,
        "slot": 405713171,
        "direction": "sell",
        "input_amount": 1000000000,
        "output_amount": 86347675,
        "input_mint": "So11111111111111111111111111111111111111112",
        "output_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "midprice_at_swap": 0.08649538387544453,
        "execution_price_at_swap": 0.08634768,
        "base_spread_factor_at_swap": 0.9995,
        "vault_x_after": 6411416058,
        "vault_y_after": 428792852,
        "fees": {
          "protocol_fee_quote_raw": 0,
          "protocol_fee_raw": 0,
          "protocol_fee_mint": "So11111111111111111111111111111111111111112",
          "realized_spread_quote_raw": 147709,
          "realized_spread_bps": 17.08,
          "protocol_fee_split": null
        }
      }
    ],
    "next_cursor": "eyJpZCI6ImozZDd4a203...",
    "has_more": true
  }
  ```
</ResponseExample>

<Note>
  For a pool whose protocol fee routes through the fee-split sidecar, the
  `fees` object includes a populated `protocol_fee_split` (shares sum to
  `protocol_fee_raw`):

  ```json theme={null}
  "fees": {
    "protocol_fee_quote_raw": 12500,
    "protocol_fee_raw": 12500,
    "protocol_fee_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "realized_spread_quote_raw": 142136,
    "realized_spread_bps": 16.44,
    "protocol_fee_split": [
      { "recipient": "Rec1", "ppm": 700000, "amount_raw": 8750 },
      { "recipient": "Rec2", "ppm": 300000, "amount_raw": 3750 }
    ]
  }
  ```
</Note>
