nft-api-javascript-scripts
nft-api-javascript-scripts copied to clipboard
api
// alchemy-nft-api/fetch-script.js import fetch from 'node-fetch';
// Setup request options: var requestOptions = { method: 'GET', redirect: 'follow' };
// Replace with your Alchemy API key:
const apiKey = "demo";
const baseURL = https://eth-mainnet.alchemyapi.io/v2/${apiKey}/getNFTs/;
// Replace with the wallet address you want to query:
const ownerAddr = "0xDCbfdF33A543b1990B8c0A8EF938EB2E40389036";
const fetchURL = ${baseURL}?owner=${ownerAddr};
// Make the request and print the formatted response: fetch(fetchURL, requestOptions) .then(response => response.json()) .then(response => JSON.stringify(response, null, 2)) .then(result => console.log(result)) .catch(error => console.log('error', error));