In this page, we'll lay the groundwork to start fetching transaction data using Noves APIs. We'll use JavaScript for our examples, so buckle up for some coding fun!

Installing Dependencies

First things first, let's get our environment ready. We're going to need Node.js and a couple of npm packages. If you haven't installed Node.js yet, download it here. You won't be able to run Node. js until you restart your computer.

Once Node.js is installed, open your terminal and run:

npm init -y
npm install axios dotenv

We're using axios for making HTTP requests and dotenv for managing environment variables.

Setting Up Authorization

Next, we need to set up authorization to access the Noves APIs. Follow the steps outlined in the Authorization Guide to obtain your API key.

Once you have your API key, create a .env file in your project root and add your API key:

NOVES_API_KEY=your_api_key_here

Now, let's write a simple script to fetch the list of EVM chains available. This is a good test to ensure our setup is working correctly. Create a file named fetchChains.js and add the following code:

require('dotenv').config();
const axios = require('axios');

const fetchEVMChains = async () => {
  try {
    const response = await axios.get('https://translate.noves.fi/evm/chains', {
      headers: { 'apiKey': `${process.env.NOVES_API_KEY}` }
    });
    console.log('EVM Chains:', response.data);
  } catch (error) {
    console.error('Error fetching EVM chains:', error);
  }
};

fetchEVMChains();

In this script, we're making a request to the Noves API endpoint to get the list of EVM chains. The axios library is used to make the HTTP request, and the API key is sent as apiKey in the request headers.

Testing

To test if everything is set up correctly, run your script:

node fetchChains.js

If everything goes well, you should see a list of EVM chains in your console. This indicates that your setup is correct and you're ready to proceed to the next steps!