
The user's full NFT collection, with artwork and details, displayed in the 'Collectibles' tab.
View Source Code
Access the complete source code for this wallet on GitHub
Try Live Demo
Interact with the finished wallet app
This guide assumes you have completed the previous guides:
Explore the NFT Collection
See the collectibles feature in action with the live demo below. Click on the “Collectibles” tab to browse the sample wallet’s NFT collection:Fetch NFT Collectibles
Let’s add a new asynchronousgetWalletCollectibles
function to server.js
to fetch a user’s NFT collection using the Collectibles API.
server.js (getWalletCollectibles function)
entries
array within this response, providing comprehensive information including contract addresses, token IDs, chain data, and rich metadata.
The Collectibles API supports pagination using
limit
and offset
query parameters.
For wallets with many NFTs, you can implement logic to fetch subsequent pages using the next_offset
value returned by the API to provide a complete view of the user’s collection.Rich NFT Data and Images
The Sim APIs Collectibles API provides comprehensive NFT data including images, metadata, and collection information directly in the response. The Collectibles API includes:Image URLs
Direct access to NFT artwork via
image_url
fieldMetadata
Rich metadata including attributes, descriptions, and collection details
Collection Information
Names, symbols, and collection-specific data
Acquisition Data
When the NFT was last acquired and sale price information
Token Details
Contract addresses, token IDs, token standards (ERC-721, ERC-1155)
Multichain Support
NFTs from Ethereum, Polygon, Optimism, Base, and other supported chains
Add Collectibles into the Server Route
Next, we update our mainapp.get('/')
route handler in server.js
to call this new function:
server.js (app.get('/') updated for collectibles)
collectibles
array, containing comprehensive blockchain data and image URLs directly from Sim APIs, is passed to the wallet.ejs
template.
Display Collectibles in the Frontend
The final step is to modifyviews/wallet.ejs
to render the fetched collectibles within the “Collectibles” tab.
We will use a grid layout to display NFT images with their collection names and token IDs.
In views/wallet.ejs
, find the section for the “Collectibles” tab (you can search for id="collectibles"
).
It currently contains a placeholder paragraph.
Replace that entire div
with the following EJS:
views/wallet.ejs (Collectibles tab content)
collectibles
array and displays each NFT with its comprehensive metadata directly from Sim APIs.
Each collectible shows the image_url
, the collection_name
or fallback name, and a truncated token_id
for identification.
Restart your server using
node server.js
and navigate to your wallet app in the browser.
When you click on the “Collectibles” tab, and if the wallet has NFTs, you should see the NFT collection displayed with rich visual metadata.