Returns swap events for the user

POSThttps://api.1inch.com/history/v2.0/history/{address}/events/swaps
Supported on:
EthereumBaseBNB ChainOptimismPolygonSonicUnichainRobinhood ChainArbitrumAvalancheCronosZKsyncGnosisHyperEVMArcMonad

Parameters

address
* string path

Request Body

HistorySwapFilterRootDto object
filter
*HistorySwapFilterDto object
chain_ids
* array
items
string
token_address_from
*UnifiedTokenAddress object
token_address_to
*UnifiedTokenAddress object
limit
number
to_time_ms
object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const axios = require('axios');

async function httpCall() {
  const url =
    'https://api.1inch.com/history/v2.0/history/{address}/events/swaps';

  const config = {
    headers: {
      Authorization: `Bearer ${API_KEY}`,
    },
    params: {},
    paramsSerializer: {
      indexes: null,
    },
  };
  const body = {
    filter: {
      chain_ids: ['string'],
      token_address_from: {},
      token_address_to: {},
      limit: 0,
      to_time_ms: null,
    },
  };

  try {
    const response = await axios.post(url, body, config);
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
}

Returns

array
items
HistoryEventResponseDto object
item
* object
cache_counter
* number
JSON
1
2
3
4
5
6
7
[
  {
    "item": null,
    "cache_counter": 0
  }
]

Did you find what you need?