Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

Get Swaps by Pair Address

Solana Logo

Looking for swaps by pair address on Solana?

Access swaps by pair address data using our powerful Solana API

Explore Solana API
GEThttps://deep-index.moralis.io/api/v2.2/pairs/:address/swaps

Get all swap related transactions (buy, sell, add liquidity & remove liquidity)

PATH PARAMS
addressstringrequired
The pair address token-transactions are to be retrieved for.
QUERY PARAMS
chainstring
The chain to query
cursorstring
The cursor returned in the previous response (used for getting the next page)
limitnumber
The number of results to return
fromBlockstring

The minimum block number from which to get the token transactions

  • Provide the param 'fromBlock' or 'fromDate'
  • If 'fromDate' and 'fromBlock' are provided, 'fromBlock' will be used.
toBlockstring
The block number up to which you want to get the token transactions from
fromDatestring

The starting date (format in seconds or datestring accepted by momentjs)

  • Provide the param 'fromBlock' or 'fromDate'
  • If 'fromDate' and 'fromBlock' are provided, 'fromBlock' will be used.
toDatestring

The ending date (format in seconds or datestring accepted by momentjs)

  • Provide the param 'toBlock' or 'toDate'
  • If 'toDate' and 'toBlock' are provided, 'toBlock' will be used.
orderstring
The order of the result, in ascending (ASC) or descending (DESC)
transactionTypesstring
Array of transaction types. Allowed values are 'buy', 'sell', 'addLiquidity', 'removeLiquidity'.
Responses
API KEY
// Dependencies to install:
// $ npm install node-fetch --save
// add "type": "module" to package.json

import fetch from 'node-fetch';

const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
};

fetch('https://deep-index.moralis.io/api/v2.2/pairs/0xcbcdf9626bc03e24f779434178a73a0b4bad62ed/swaps?chain=eth&order=DESC', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
{
"page": 1,
"cursor": "string",
"pageSize": 100,
"exchangeAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
"exchangeLogo": "https://entities-logos.s3.us-east-1.amazonaws.com/uniswap.png",
"exchangeName": "Uniswap v3",
"pairAddress": "0xcbcdf9626bc03e24f779434178a73a0b4bad62ed",
"pairLabel": "WBTC/WETH",
"tokenAddress": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"baseToken": {
"address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"name": "Wrapped BTC",
"symbol": "WBTC",
"logo": "https://logo.moralis.io/0x1_0x2260fac5e5542a773aa44fbcfedf7c193bc2c599_3d45c7efabf4bff37f5d92817940bddb.png",
"decimals": "8"
},
"quoteToken": {
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"name": "Wrapped Ether",
"symbol": "WETH",
"logo": "https://logo.moralis.io/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_018112a9229b4bf1bf0d042beb7c2c55.png",
"decimals": "18"
},
"result": [
{
"transactionHash": "0x9cb8f18d9aedd7d215186bc423f8f726e74f06acc6e63207b21f628e09c1124f",
"transactionIndex": "",
"transactionType": "buy",
"blockTimestamp": "2024-12-04T13:36:59.000Z",
"blockNumber": "",
"walletAddress": "0x206bb16d50890aa69a6c723fd18cc8438bfdfca8",
"subCategory": "newPosition",
"baseTokenAmount": "0.14668467",
"quoteTokenAmount": "-3.787990094781687594",
"baseTokenPriceUsd": "95248.957482020033763352",
"quoteTokenPriceUsd": "3699.329804324900700000",
"baseQuotePrice": "25.747625251110109537",
"totalValueUsd": 13971.56189609414
}
]
}