• 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

Implementing NFT Listing and Cancelation with Thirdweb

In this video, we complete the core logic for our NFT Marketplace application by implementing the functionality for listing NFTs for sale and canceling active listings using Thirdweb’s tools.

1. Overview of Listing and Canceling Cards

Previously, we set up the UI components:

  • SellNFTCard: Allows users to input a price and list an NFT.
  • CancelListingCard: Displays when an NFT is already listed, providing an option to cancel the listing.

In this video, we implement the logic behind both features.

2. Selling an NFT (Listing on the Marketplace)

To list an NFT:

We retrieve the Marketplace and NFT contract using:

getMarketplaceContract()
getNFTContract()
  • NFTs must grant approval to the marketplace to allow it to transfer tokens on the user's behalf. This is essential because the marketplace is a separate contract.

Granting Role to Marketplace

We use Thirdweb’s useGrantRole hook:

const { mutate: grantRole, error: roleError } = useGrantRole(nftContract);

This allows us to assign the admin role to the marketplace address.

Creating the Direct Listing

We then use:

const { mutate: createDirectListing, isLoading: listingLoading, error: listError } = useCreateDirectListing(marketplace);

The listing details are structured using a utility function createListingFromPriceId(price, tokenId) that encapsulates all required listing parameters (except the user-set price and token ID).

Once structured, we execute:

createDirectListing(listing);

3. Handling Errors and Loading States

We manage UI feedback using conditional checks:

  • Display error messages if roleError or listError exist.
  • Show a loading message when listingLoading is true:
{listingLoading && <div className="text-center mt-4">Listing in progress...</div>}

4. Canceling an Active Listing

Canceling a listing is simpler since we’re directly interacting with the marketplace contract.

Using useCancelDirectListing

const { mutate: cancelListing, isLoading, error } = useCancelDirectListing(marketplace);

When the user clicks the cancel button, we execute:

cancelListing({ listingId });

This function is triggered inside a try-catch block to handle any runtime errors.

5. UI State Handling for Canceling

Just like with listing, we handle:

  • Displaying errors if any occur
  • A loading message when the cancellation is in progress:
{isLoading && <div className="text-center mt-4">Canceling listing...</div>}

6. Wrapping Up

With this video, we’ve completed:

  • Full logic for listing NFTs for sale on a marketplace
  • Logic for canceling an active listing
  • Integration with Thirdweb hooks to interact securely and reliably with smart contracts

The NFT Marketplace application is now fully functional, supporting wallet authentication, viewing NFT metadata, dynamic listing controls, and real-time marketplace management.

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