• Discover
  • Partner with us
  • Chapters
  • Blog

Learn everything about Chiliz

Introduction
Chiliz Network and Its Use Cases
What Are Test Tokens and How to Utilize Them

What Are We Going to Build
Which Technologies Will Be Used
Implementing Frontend I - Creating ENV
Implementing Frontend II - Connect Wallet
Implementing Frontend III - Getting Token Balances
Implementing Frontend IV - Getting Token Metadata
Implementing Frontend V - HTML/CSS Walkthrough
Homework I - Submit your github repository link

What Are We Going to Build
Getting Chiliz Testnet Coins
Deploying NFT Marketplace Using Thirdweb
Implementing Frontend I - Creating ENV
Implementing Frontend II - Fetching Contract Info
Implementing Frontend III - Interacting with NFT Collection
Implementing Frontend IV - Interacting with Marketplace
Implementing Frontend V - List/Delist NFT on Marketplace
Implementing Frontend VI - Buy Listing
Homework II - Submit your github repository link

Submit Your Final Project

Interacting with Smart Contracts Using Thirdweb

In this video, we’ll begin working on smart contract integration using Thirdweb. We’ll cover how to interact with deployed contracts and fetch contract metadata using Thirdweb’s React hooks.

1. Setting Up the useContract Hook

Thirdweb provides pre-built hooks to streamline blockchain interactions. One of the key hooks is useContract, which we’ll use frequently throughout the project.

  • This hook returns:
  • A contract instance
  • A loading state

During the loading phase, we can display a loading bar or a status indicator. Once the contract is loaded, we can perform various operations, starting with fetching contract metadata.

2. Automating Contract Address Management

To avoid hardcoding contract addresses repeatedly, we’ll create a reusable helper function. Here’s how we approach it:

  • Use a getContractAddresses utility that wraps our .env values.
  • This method ensures type safety (we’re working in TypeScript) and prevents runtime errors.

We then create a helper function, such as getMarketplaceContract, which:

  • Retrieves the marketplace address from the environment
  • Uses useContract to return the contract instance and loading state
  • Specifies the contract version, since marketplaces can have multiple versions

We do the same for NFTs with a getNFTContract function. These helpers simplify reuse and minimize redundant code.

3. Creating the Info Page: Viewing Contract Metadata

We set up an InfoPage component where users can view the metadata for both:

  • The Marketplace contract
  • The NFT Collection contract

To do this:

  • Call getMarketplaceContract and getNFTContract to get the contract instances
  • Use the useContractMetadata hook to fetch metadata for each
  • Display loading indicators while the data is being fetched
const { data: marketplaceMetadata, isLoading: marketplaceLoading } = useContractMetadata(marketplaceContract);
const { data: nftMetadata, isLoading: nftLoading } = useContractMetadata(nftContract);

These hooks update in real time, so you don't need to manually manage loading states.

4. Displaying Metadata with Custom UI Components

Using our custom UI components, we render the fetched metadata:

  • Contract name
  • Description
  • Symbol
  • Creator
  • Creation date

If metadata is available, we render the corresponding section. If it’s still loading, we show a message like “Loading contract info…”.

{marketplaceLoading || nftLoading ? (
  <div>Loading contract info...</div>
) : (
  <>
    {marketplaceMetadata && (
      <ContractMetadata title="NFT Marketplace" metadata={marketplaceMetadata} />
    )}
    {nftMetadata && (
      <ContractMetadata title="NFT Collection Metadata" metadata={nftMetadata} />
    )}
  </>
)}

This ensures users always see a responsive UI based on real-time contract state.

5. Final Thoughts and What’s Next

You’ve now set up reusable contract hooks and built an info page to display metadata for your NFT marketplace and collection contracts.

Previous
Next

Lesson discussion

Swap insights and ask questions about “Learn everything about Chiliz”.

Enroll to participate
Start the course to unlock the discussion. Enrolling helps us keep conversations relevant to learners.
WebsiteDiscoverPartner with UsBlogEvents
Discover
CoursesCircleRustSoliditySolanaWeb3 FundamentalsBlockchain Basics
CompanyAbout UsBrand GuidelineFAQsTerms of UsePrivacy PolicyGDPR NoticeCookies
Don't miss any update!

Disclaimer: The information, programs, and events provided on https://risein.com is strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice, nor do we make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://risein.com disclaims any responsibility for financial decisions made by users based on the information provided here.

© 2026 Rise In, All rights reserved