How to Get All NFTs for Address

Habeeb Yinka
Habeeb Yinka
Technical Writer
This guide walks you through how to get all NFTs owned by an address with their metadata including traits and attributes, using the GoldRush API!

Non-Fungible Tokens (NFTs) have emerged as a prominent asset class, representing unique digital items ranging from art and collectibles to virtual real estate. As more individuals and businesses engage with NFTs, there arises a need to efficiently track and manage these digital assets. This guide aims to provide a step-by-step approach to retrieving all NFTs owned by a specific address using the GoldRush API.

Quick Start

1

Obtain a GoldRush API Key

Before getting started, you'll need to obtain an API key from GoldRush. Signup for an API key if you haven’t gotten one yet.
2

Installation

Next, you'll need to install the GoldRush SDK in your project environment. The GoldRush SDK provides a convenient interface for interacting with the GoldRush API, simplifying the process of retrieving blockchain data. Simply run:
npm install @covalenthq/client-sdk
3

Endpoint Overview

v1/{chainName}/address/{walletAddress}/balances_nft/
This endpoint facilitates accessing NFT balance information associated with a given wallet address on the specified blockchain network.
Parameters:
chainName: The blockchain network (e.g., eth-mainnet).
walletAddress: The address of the wallet for which you want to retrieve NFTs.
4

Fetching NFTs for Address

To retrieve all NFTs owned by a specific address, you can use the JavaScript code outlined below. This script makes use of the GoldRush API to gather information on all NFTs associated with a given address.
Make sure to replace "Your_Covalent_API_Key" and "wallet_Address" with your actual GoldRush API key and the wallet address respectively.
import { CovalentClient } from "@covalenthq/client-sdk";

const ApiServices = async () => {
const client = new CovalentClient("Covalent_API_Key");

const resp = await client.NftService.getNftsForAddress("eth-mainnet","Wallet_Address");

  console.log(resp.data);

}

ApiServices();




5

Sample Response

Here is a snippet of the API response, which returns all the associated NFTs for the specified address.
{
  "updated_at": "2024-03-28T08:32:44.919786886Z",
  "items": [
    "0":{
      "contract_name": "Async Art",
      "contract_ticker_symbol": "ASYNC-V2",
      "contract_address":"0xb6dae651468e9593e4581705a09c10a76ac1e0c8",
      "supports_erc": ["erc20", "erc165", "erc721"],
      "is_spam": false,
      "balance": "1",
      "balance_24h": "1",
      "type": "nft",
      "floor_price_quote": 33619.15315882571,
      "pretty_floor_price_quote": "$33,619.15",
      "floor_price_native_quote": 10.01842341417462,
      "nft_data": [
        {
          "... 1 item": ""
        }
      ],
      "last_transfered_at": "2021-10-19T20:28:14Z"
    },
    "1":{
      "contract_name": "MetaHeroCore",
      "contract_ticker_symbol": "HERO",
      "contract_address":"0xfb10b1717c92e9cc2d634080c3c337808408d9e1",
      "supports_erc": [
        {
          "... 2 items": ""
        }
      ],
      "is_spam": false,
      "balance": "4",
      "balance_24h": "4",
      "type": "nft",
      "floor_price_quote": 17528.510455476026,
      "pretty_floor_price_quote": "$17,528.51",
      "floor_price_native_quote": 5.305,
      "nft_data": [
        {
          "... 4 items": ""
        }
      ],
      "last_transfered_at": "2023-11-21T18:54:23Z"
    }
},

Use Cases

  • NFT Portfolio Tracker: By leveraging the GoldRush API to retrieve NFT data, developers can build powerful portfolio tracking tools that enable users to monitor their NFT holdings, track asset performance, and gain insights into their digital asset portfolio.

  • Marketplace Integration: Integrating GoldRush's NFT data into online marketplaces allows users to seamlessly view and manage their NFT collections within the platform, enhancing the user experience and facilitating frictionless transactions.

  • NFT Analytics and Insights: Researchers and analysts can utilize GoldRush's rich blockchain data to perform in-depth analysis of NFT markets, track trends, and uncover valuable insights that inform investment decisions and market strategies.

Conclusion

In conclusion, the GoldRush API provides a powerful toolset for retrieving NFT data, enabling developers to build innovative applications and services that enhance the NFT ecosystem. By following the steps outlined in this guide and leveraging the capabilities of the GoldRush API, developers can unlock new possibilities for NFT portfolio management, marketplace integration. Start exploring the world of NFTs today with GoldRush's comprehensive blockchain data infrastructure. Get your API Key today!

Read more