API ReferenceWallet APIGet Wallet Token SwapsGet Swaps by Wallet AddressVersion: 2.2Get Swaps by Wallet AddressLooking for swaps by wallet address on Solana?Access swaps by wallet address data using our powerful Solana APIExplore Solana APIGEThttps://deep-index.moralis.io/api/v2.2/wallets/:address/swapsGet all swap related transactions (buy, sell)PATH PARAMSaddressstringrequiredThe wallet address token-transactions are to be retrieved for.QUERY PARAMSchainstringThe chain to queryeth0x1sepolia0xaa36a7holesky0x4268polygon0x89polygon amoy0x13882bsc0x38bsc testnet0x61avalanche0xa86afantom0xfapalm0x2a15c308dcronos0x19arbitrum0xa4b1gnosis0x64gnosis testnet0x27d8chiliz0x15b38chiliz testnet0x15b32base0x2105base sepolia0x14a34optimism0xalinea0xe708linea sepolia0xe705moonbeam0x504moonriver0x505moonbase0x507flow0x2ebflow-testnet0x221ronin0x7e4ronin-testnet0x7e5lisk0x46flisk-sepolia0x106atokenAddressstringThe token address to get transaction for (optional)cursorstringThe cursor returned in the previous response (used for getting the next page)limitnumberThe number of results to returnfromBlockstringThe minimum block number from which to get the token transactionsProvide the param 'fromBlock' or 'fromDate'If 'fromDate' and 'fromBlock' are provided, 'fromBlock' will be used.toBlockstringThe block number up to which you want to get the token transactions fromfromDatestringThe 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.toDatestringThe 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.orderstringThe order of the result, in ascending (ASC) or descending (DESC)ASCDESCtransactionTypesstringArray of transaction types. Allowed values are 'buy', 'sell'Responses200 Returns swap transactions by wallet address.objectAPI KEYTest Live APINode.jsPythoncURLGoPHP// Dependencies to install:// $ npm install node-fetch --save// add "type": "module" to package.jsonimport 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));# Dependencies to install:# $ python -m pip install requestsimport requestsurl = "https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/swaps?chain=eth&order=DESC"headers = { "Accept": "application/json", "X-API-Key": "YOUR_API_KEY"}response = requests.request("GET", url, headers=headers)print(response.text)curl --request GET \ --url 'https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/swaps?chain=eth&order=DESC' \ --header 'accept: application/json' \ --header 'X-API-Key: YOUR_API_KEY' package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/swaps?chain=eth&order=DESC" req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Accept", "application/json") req.Header.Add("X-API-Key", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}<?php// Dependencies to install:// $ composer require guzzlehttp/guzzlerequire_once('vendor/autoload.php');$client = new \GuzzleHttp\Client();$response = $client->request('GET', 'https://deep-index.moralis.io/api/v2.2/wallets/0xcB1C1FdE09f811B294172696404e88E658659905/swaps?chain=eth&order=DESC', [ 'headers' => [ 'Accept' => 'application/json', 'X-API-Key' => 'YOUR_API_KEY', ],]);echo $response->getBody();Response Example200 Returns swap transactions by wallet address.{ "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 } ]}