DEV Community

Discussion on: How to Build a Full Stack NFT Marketplace - V2 (2022)

Collapse
 
will_urban profile image
Willian Urban

There is a small bug when buying an item when the tokenId and itemId do not match.

How to reproduce:

1- Go to /create-item, mint an item A with price X, but do not list it.
2- Mint an Item B with price Y, then list it.
3- Go to index and try to buy item B.
Result: "Please submit the asking price in order to complete the purchase".
Expected result:
Purchase successful.

Fix:

1- In index.js on the function loadNFTS add itemId: item.itemId.toNumber(), to the object item.
2- When calling createMarketSale the second argument should be nft.itemId.

As I've finished typing all this I've noticed that it has been fixed in the github repo github.com/dabit3/polygon-ethereum...

Well, at least now you know if you are looking for a solution here

Collapse
 
will_urban profile image
Willian Urban • Edited

If you are going though this tutorial, I've build a slightly more cooler NFT Marketplace based on this blog post that helped me land a job 6 months ago, and for that I thank Nader and several other free content providers.

Granted it was my first time playing with Next, and there are several things I would have done differently, but hey have a look, its not bad:

nft-marketplace-dusky.vercel.app/c...
github.com/UrbanWill/nft-marketplace

Collapse
 
authenticfake profile image
authenticfake

yes correct, the same fix applied!

Collapse
 
fidalmathew profile image
Fidal Mathew

Thank you! Appreciate the help!!