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 Wallet Address

Solana Logo

Looking for swaps by wallet address on Solana?

Access swaps by wallet address data using our powerful Solana API

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

Get all swap related transactions (buy, sell)

PATH PARAMS
addressstringrequired
The wallet address token-transactions are to be retrieved for.
QUERY PARAMS
chainstring
The chain to query
tokenAddressstring
The token address to get transaction for (optional)
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'
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/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/swaps?chain=eth&order=DESC', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
{
"cursor": "string",
"page": 1,
"pageSize": 100,
"result": [
{
"transactionHash": "0x2339c3c92317e94672cdb6e39d69e042d5e67f2b59f0f0a74118b330ae0a3b6a",
"transactionIndex": 15,
"transactionType": "sell",
"baseQuotePrice": "26.339942637915532257",
"entity": "",
"entityLogo": "",
"blockTimestamp": "2024-12-05T08:12:11.000Z",
"blockNumber": "",
"subCategory": "partialSell",
"walletAddress": "0xa172577031eafd8b03dce022533863fe988159cd",
"walletAddressLabel": "",
"pairAddress": "0xe6ff8b9a37b0fab776134636d9981aa778c4e718",
"pairLabel": "WBTC/WETH",
"exchangeName": "Uniswap v3",
"exchangeAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
"exchangeLogo": "https://entities-logos.s3.us-east-1.amazonaws.com/uniswap.png",
"baseToken": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"quoteToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"bought": {
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"amount": "3.827024226435305903",
"usdPrice": 3873.6908509932464,
"usdAmount": 14824.70873247195,
"symbol": "WETH",
"logo": "https://logo.moralis.io/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_018112a9229b4bf1bf0d042beb7c2c55.png",
"name": "Wrapped Ether",
"tokenType": "token1"
},
"sold": {
"address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"amount": "-0.14521667",
"usdPrice": 102032.79481218032,
"usdAmount": -14816.862693418101,
"symbol": "WBTC",
"logo": "https://logo.moralis.io/0x1_0x2260fac5e5542a773aa44fbcfedf7c193bc2c599_3d45c7efabf4bff37f5d92817940bddb.png",
"name": "Wrapped BTC",
"tokenType": "token0"
},
"totalValueUsd": 14816.862693418101
}
]
}