Fetch Single Page

Now that our setup is ready, let's start by fetching a single page of transaction data for a specific account. We'll use the /txs endpoint.

Preparing the Fetch Function

We'll write a JavaScript function to fetch transactions for a specific EVM chain and account address.

In your project, create a new file named fetchTransactions.js and add the following code:

const axios = require('axios');

const fetchAccountTransactions = async (chain, accountAddress, startTime, endTime) => {
  try {
    const response = await axios.get(`https://translate.noves.fi/evm/${chain}/txs/${accountAddress}`, {
      headers: { 'apiKey': `${process.env.NOVES_API_KEY}` },
      params: {
        startTimestamp: startTime,
        endTimestamp: endTime
    console.log('Transactions:', response.data);
  } catch (error) {
    console.error('Error fetching transactions:', error);
const chain = 'eth'; // Replace with the desired chain
const accountAddress = '0x....'; // Replace with the desired account address
const startTime = 1640995200; // Start timestamp for January 1, 2022
const endTime = 1672531199; // End timestamp for December 31, 2022

fetchAccountTransactions(chain, accountAddress, startTime, endTime);

In this function, chain and accountAddress are the parameters that you'll provide to fetch transactions for a specific account on a particular chain.

We're also including optional parameters startTime and endTime, to filter the results for a given time range. In this example, we're asking for transactions that occurred in 2022.

Running the Script

Finally, run the script using Node.js:

node fetchTransactions.js

If all goes well, you'll see the transaction data printed in your console.

That's it for fetching a single page of transactions! Next, we'll explore how to handle multiple pages to retrieve a complete transaction history.