How to Get Chain Collections Using the GoldRush API

Habeeb Yinka
Habeeb Yinka
Technical Writer
This is a step-by-step guide on how to get NFT chain collections from different chains.

Introduction

Chain collections offer a revolutionary way to manage and engage with digital assets across various blockchains. This guide will take you through the steps to set up and use chain collections with the GoldRush API.

Why is There a Need for the Chain Collections Endpoint?

The Chain Collections endpoint is designed to provide a comprehensive overview of NFT collections on specified blockchains. This endpoint allows users to query and retrieve summary metadata for all collections on a given chain, making it easier to understand and navigate the various NFTs available. It is an essential tool for developers and users who need to access and organize NFT data efficiently. By offering a repository of collection data, this endpoint facilitates the discovery and analysis of NFTs, helping users to make informed decisions and build robust applications.

Importance of Cached NFT Metadata

  • Enhanced Performance and Reliability: Cached NFT metadata significantly improves the overall performance and reliability of NFT applications. By storing essential metadata locally, applications can access critical information more quickly, leading to faster load times and smoother user experiences.

  • Efficient Data Retrieval: Storing NFT metadata allows developers to access valuable information without the need for repeated queries to the blockchain. This optimization streamlines data retrieval processes and reduces the computational resources required to access NFT information.

Quick Start

1

Getting a GoldRush API Key

First things first, you’ll need a GoldRush API key. Here’s how to get it:
1. Head to the GoldRush website.
2. Create an account here.
3. Go to the API section and generate your API key.
2

Installation (Project Initiation)

Kick off your project by installing the GoldRush SDK. Use this command to add the SDK
npm install @covalenthq/sdk
3

Endpoint Overview

To fetch chain collections, use the following code from the GoldRush TypeScript SDK:
Remember to replace "Your_API_Key_Here" with your actual API key
import { CovalentClient } from "@covalenthq/client-sdk";

const ApiServices = async () => {
    const client = new CovalentClient("YOUR_API_KEY");
    try {
 for await (const resp of   client.NftService.getChainCollections("ethmainnet",{"pageSize": 5}))         {
            console.log(resp);
        }
    } catch (error) {
        console.log(error.message);
    }
}


4

Endpoint Response

Here is a sample response for what this API returns. This endpoint provides detailed information about NFT collections on the Ethereum mainnet.
{
    "updated_at": "2024-05-22T16:53:09.630852424Z",
    "chain_id":  1,
    "chain_name":  "eth-mainnet",
    "items": [
        "0": {
            "contract_address": "0x68aea268f92b715e073d2f5170039faa4b94a47b",
            "contract_name":  "Fantasy Islands - Sandbox ",
            "is_spam":   false,
            "token_total_supply": 1,
            "cached_metadata_count": 1,
            "cached_asset_count": 1,
            "last_scraped_at" : "2022-09-08T16:09:14Z",
    },

    "1": {
        "contract_address":  "0x22c36bfdcef207f9c0cc941936eff94d4246d14a",
         "contract_name": null,
         "is_spam": false,
         "token_total_supply": 3,
         "cached_metadata_count" :  3,
          "cached_asset_count": 3,
          "last_scraped_at" : "2022-09-08T17:33:02Z",
    },
    "2": {
         "contract_address": "0xb840ec0db3b9ab7b920710d6fc21a9d206f994aa",
         "contract_name": "CyberHunter",
         "is_spam": false,
         "token_total_supply": 3000,
         "cached_metadata_count": 2742,
         "cached_asset_count" : 2739,
         "last_scraped_at": "2022-09-09T07:39:59Z",
     },
    "3": {
        "contract_address": "0xac8f8011aeba4c157fa06a8de8511ebc1a3ba1f1",
        "contract_name":  "Ether Terrestrial",
        "is_spam": false,
        "token_total_supply": 4096,
        "cached_metadata_count": 299,
        "cached_asset_count":  299,
        "last_scraped_at":  "2022-09-09T17:24:13Z",
    },
    "4": {
        "contract_address": "0xdb8f52d04f9156dd2167d2503a5a2ceef3125b09",
        "contract_name": "Soul Cafe",
        "is_spam": false,
        "token_total_supply" : 3333,
        "cached_metadata_count" :  3333,
        "cached_asset_count" : 3333,
        "last_scraped_at": 
        "2022-09-13T14:53:47Z",
    },
    ],
    "pagination"
    : 
                  { ... 4 items }

Use Cases

Digital Art Marketplace

Chain collections empower the creation of digital art NFT marketplaces, thus enabling users to have access to trade NFTs across different blockchains seamlessly. This endpoint facilitates the easier display of collections of NFTs created by artists and creators.

Gaming & Gamification

In gaming, chain collections can be used by gaming platforms and decentralized applications (dApps) to showcase collections of gaming-related NFTs.

Virtual Real Estate 

Chain collections can be employed by virtual real estate platforms to showcase collections of NFTs representing virtual land parcels, buildings, and properties within virtual worlds.

Conclusion

NFT Chain collections present a powerful method to manage and interact with digital assets spanning multiple blockchains. By following this guide and utilizing teh GoldRush API, you can unlock the full potential of your digital assets in a variety of innovative applications. Get your API key today!

Read more