Displaying NFT Holdings with GoldRush's NFT Endpoints
Introduction
Non-fungible tokens (NFTs) have rapidly gained popularity in recent years, emerging as a new way to represent digital assets, such as art, collectibles, and virtual real estate. Each NFT is unique and indivisible, making them different from cryptocurrencies like Bitcoin or Ethereum. As the NFT market continues to grow, so does the opportunity for developers to access and display NFT holdings within their applications.
GoldRush's NFT endpoints provide a powerful and efficient solution for developers looking to display NFT holdings. The GoldRush API offers comprehensive NFT data across various blockchain networks, simplifying the process of creating visual representations of NFTs in a wallet. This guide will show you how to utilize GoldRush's NFT endpoints to create visual representations of NFT holdings in a wallet!
(Est time to follow along: 10 mins)
Prerequisite
Basic familiarity with Node.js
Fetching data using APIs
Use Cases for Developers
NFTs are extremely versatile, so there are multiple use cases for displaying NFT holdings. Here are some popular ones:
Wallets: Developers can create web applications that allow users to view and manage their NFT holdings more efficiently. By displaying NFT holdings, users can track their assets, evaluate their portfolios, and make informed decisions about buying, selling, or trading NFTs.
NFT marketplaces: Displaying NFT holdings is essential for NFT marketplaces where users can buy, sell and trade digital assets. Developers can create visually appealing and interactive platforms that showcase NFTs in an organized manner, making it easy for users to browse, search, and filter through available items.
Gaming and metaverse: For games or virtual worlds that utilize NFTs as in-game assets, developers can display players' NFT holdings as part of their inventory or character profile. This allows players to manage their digital assets, trade with other players, and understand the value of their in-game items.
Social media: Developers can create widgets or plugins that enable users to showcase their NFT collections on social media platforms or personal websites. This can help NFT collectors share their acquisitions, foster discussions, and gain exposure in the community. One popular use case here is the profile picture (PFP), where users display their NFTs as their avatars on social media platforms.
Creator portfolios: Developers can build websites for artists and creators that display their NFT artwork, providing an online gallery to showcase their creations, share their stories, and potentially sell or promote their work.
And more!
GoldRush's Core Rendering Endpoints
The term "Core Rendering" refers to the primary purpose of these endpoints, which is to fetch and display NFT data. These endpoints allow developers to render NFT holdings, including detailed metadata, images, and other relevant information, within their applications. Under the NFT umbrella, there are also Ownership & Token Gating endpoints and coming soon market data endpoints.
What makes GoldRush’s NFT endpoints unique?
Rich metadata: Each endpoint response contains a wealth of information about the NFT, such as contract details, token information, external data, and image URLs in various sizes. This level of detail is often unavailable in alternate APIs, especially standard RPC responses.
Standardized format: The API response follows a consistent JSON structure, which simplifies parsing and integration into applications. Other APIs can vary in terms of response structure, making it more challenging for developers to work with.
Caching and optimization: The API response indicates whether the asset and image data are cached, ensuring faster and more reliable access to off-chain data. This is because GoldRush has downloaded the NFT metadata, assets and other related information and cached them on our side for the best developer experience. Check out our data coverage here.
User-friendly: The GoldRush API is designed to be easily understood by developers, with descriptive field names and a clear organization of data.
Cross-chain compatibility: The GoldRush API can be used across different blockchain networks, providing a unified way to access NFT data from various chains. This makes it much more efficient than RPCs, which are often chain-specific, requiring developers to adapt their code for each blockchain they want to support.
Fetching NFT Data from GoldRush
1
Sign up or sign in
2
Find the API Reference
3
Find the right NFT endpoint
4
Construct your API call
chainName
(e.g. eth-mainnet
) and walletAddress
parameters. For this example, let’s render the NFTs held by the demo.eth
address on Ethereum. Once the parameters are specified, we can hit Run.Parsing and Displaying NFT Data
To render this user's NFT holdings, you can loop through the items in the API response and extract the relevant information for each NFT. Here's a simple example using Node.js:
1
jsdom
and node-fetch
packages using npm:2
This script will create and display HTML elements for each NFT in the response data, and output the resulting HTML to the console. Note that this approach is typically used for server-side rendering or testing, rather than serving the HTML directly to a client.
Here is an example of how you can display NFT information on a webpage using HTML, CSS, and JavaScript:
1
2
3
4
5
The appearance of this preview is quite basic as no styling has been applied. To improve the design, you can add CSS styles to the HTML file.
Conclusion
In summary, NFTs have become a significant part of the digital asset landscape, with numerous use cases for developers to display and interact with NFT holdings. GoldRush's NFT endpoints offer a comprehensive and efficient solution for developers looking to showcase NFT holdings in their applications, providing rich metadata and standardized API responses across various blockchain networks. By following this guide, developers can leverage GoldRush's API to create visually appealing and interactive applications that unlock the potential of NFTs and contribute to the growth and maturation of the NFT ecosystem.