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

# xrpl.dex_swaps

> The 'xrpl.dex_swaps' table is a unified view of all token exchanges on the XRP Ledger DEX, combining AMM pool swaps and order-book offer executions.

export const TableSample = ({tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

## Table Description

A unified view of all token exchanges on the XRP Ledger DEX, combining AMM pool swaps and order-book offer executions into a single table for cross-venue trade analytics. Each row represents one trade execution, with the execution venue identified by fulfilled\_by (AMM for pool swaps, OfferCreate or Payment for order-book fills). Token amounts are expressed in human-readable units (XRP in XRP, issued currencies in their native denomination). Columns specific to a venue are null for rows from the other venue.

## Column Descriptions

| **Column**                               | **type**  | **Description**                                                                                                                        |
| ---------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **offer\_id**                            | bigint    | Surrogate key for the order-book offer execution record; null for AMM swaps.                                                           |
| **swap\_id**                             | bigint    | Surrogate key for the AMM pool swap record; null for order-book trades.                                                                |
| **pool\_id**                             | bigint    | Surrogate key for the AMM pool that fulfilled the swap; null for order-book trades.                                                    |
| **pool\_address**                        | string    | On-ledger account address of the AMM pool that executed the swap; null for order-book trades.                                          |
| **transaction\_id**                      | bigint    | Internal surrogate key for the on-ledger transaction that triggered this trade.                                                        |
| **transaction\_hash**                    | string    | Cryptographic hash of the XRP Ledger transaction, usable for direct ledger lookup.                                                     |
| **node\_index**                          | integer   | Position of this trade within the transaction's AffectedNodes list, distinguishing multiple fills in a single transaction.             |
| **transaction\_type**                    | string    | XRPL transaction type that generated this trade (e.g. OfferCreate, Payment, AMMSwap).                                                  |
| **transaction\_result**                  | string    | XRPL engine result code for the transaction (e.g. tesSUCCESS); only successful trades are included in this view.                       |
| **memo**                                 | string    | Decoded MemoData from the first memo attached to the transaction, often used by apps to tag orders with routing or platform metadata.  |
| **transaction\_fee**                     | varchar   | Network fee paid by the submitter for this transaction, denominated in XRP. Stored as a string; cast to a numeric type for arithmetic. |
| **account\_id**                          | bigint    | Internal surrogate key for the wallet that submitted the transaction.                                                                  |
| **account\_address**                     | string    | XRP Ledger account address of the wallet that submitted the transaction.                                                               |
| **destination\_id**                      | bigint    | Internal surrogate key for the destination account specified in the transaction, if any; typically the recipient in a Payment.         |
| **destination\_address**                 | string    | XRP Ledger account address of the transaction destination (e.g. payment recipient); null if no destination was specified.              |
| **base\_token\_id**                      | bigint    | Surrogate key of the base token in the trading pair; the base token is the one whose currency code comes first alphabetically.         |
| **base\_token**                          | string    | Human-readable currency code of the base token (e.g. XRP, USD, BTC).                                                                   |
| **base\_token\_issuer**                  | string    | XRP Ledger account address of the entity that issued the base token; null for XRP, which has no issuer.                                |
| **counter\_token\_id**                   | bigint    | Surrogate key of the counter (quote) token in the trading pair.                                                                        |
| **counter\_token**                       | string    | Human-readable currency code of the counter token (e.g. XRP, USD, EUR).                                                                |
| **counter\_token\_issuer**               | string    | XRP Ledger account address of the entity that issued the counter token; null for XRP.                                                  |
| **base\_token\_amount**                  | double    | Amount of the base token exchanged in this trade, in human-readable units (XRP in XRP, not drops).                                     |
| **counter\_token\_amount**               | double    | Amount of the counter token exchanged in this trade, in human-readable units.                                                          |
| **price**                                | double    | Trade price expressed as counter\_token\_amount divided by base\_token\_amount.                                                        |
| **base\_receiver\_id**                   | bigint    | Internal surrogate key of the account that received the base token in this trade.                                                      |
| **base\_receiver**                       | string    | XRP Ledger address of the account that received the base token in this trade.                                                          |
| **counter\_receiver\_id**                | bigint    | Internal surrogate key of the account that received the counter token in this trade.                                                   |
| **counter\_receiver**                    | string    | XRP Ledger address of the account that received the counter token in this trade.                                                       |
| **fulfilled\_by**                        | string    | Execution venue: AMM for AMM pool swaps, or the triggering transaction type (OfferCreate or Payment) for order-book fills.             |
| **amm\_base\_token\_balance\_before**    | double    | AMM pool balance of the base token immediately before this swap; null for order-book trades.                                           |
| **amm\_base\_token\_balance\_after**     | double    | AMM pool balance of the base token immediately after this swap; null for order-book trades.                                            |
| **amm\_base\_token\_balance\_delta**     | double    | Change in the AMM pool's base token balance from this swap; negative when the pool sold base token, null for order-book trades.        |
| **amm\_counter\_token\_balance\_before** | double    | AMM pool balance of the counter token immediately before this swap; null for order-book trades.                                        |
| **amm\_counter\_token\_balance\_after**  | double    | AMM pool balance of the counter token immediately after this swap; null for order-book trades.                                         |
| **amm\_counter\_token\_balance\_delta**  | double    | Change in the AMM pool's counter token balance from this swap; negative when the pool sold counter token, null for order-book trades.  |
| **timestamp**                            | timestamp | UTC timestamp of the ledger close in which this trade was confirmed.                                                                   |
| **date**                                 | date      | Calendar date (UTC) of the ledger close, used for daily partitioning and time-series analysis.                                         |

## Table Sample

<TableSample tableSchema="xrpl" tableName="dex_swaps" />
