Cloning OpenSea NFT Boilerplate Questions

Hey @Koolguy69 and @ric006,

Are all of the NFTs not showing or is it only specific ones? You could try and use the web 3 api on the Moralis admin dashboard to see if you get metadata or the token_uri for your specific NFTs, in order to make sure it is not a limiting factor on that side, not your frontend.

Hey @legaltechlawyer,

Are you able to complete a listing using the contract directly in e.g. Remix? One thing, if you have just followed along the tutorial is you may need to approve smart contract address with your NFT collection using the setApprovalForAll, this is updated in the completed boiler plate project if you want to have a look :slight_smile: https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate

hey bro appreciate your response,

i now realised 2 nfts its showing because it was a blank .png,
but the rest are not showing, i even updated the metadata to the way the hidden.png are, direct ipfs link. i have attached an image below:

the ones i have marked are the nfts. the first 2 are showing the correct image but after that the rest are not showing the image, the ipfs directory does exist and can image can be seen in the browser, but the boilerplate when even right click checking image link its the data/base64 image

items marked 1,2,4,5 are identical structures so i cant seem to find why the images wont load for 4 and 5

@IAmJaysWay hey bro i managed to fix it thanks a lot! looks like there was a conflict somewhere so i did a new moralis server and new ipfs folders and new smart contract and it is working now!! thanks a lot bro!

i have one more question though if you dont mind to help, how can i make it so that in nftbalances it shows only nfts from my collection? is there some code somewhere or can you guide me on where to start please

Great to hear it worked!

I don’t quite follow your follow up question though… Do you mean you wish to hide NFTs that may be in your wallet but not apart of the collections the marketplace is set up with?

yessir exactly thats what i mean. my collection tokens have symbol MMHERO and different name is there a way to see only NFTs with this attribute?

also brother i ran into another issue, i cant seem to figure out how to access the metadata of my nfts, i see this code here:

<Meta title={nft.name} description={nft.token_address} />

want it to be something like this in description
nft?.attributes but it wont display anything

Ok we were on the same page after all :slight_smile:

You can filter the account.getNFTs() web3 API call with the parameter token_addresses which takes as an argument an array of the the nft contract addresses (in string format) you wish to search for. For example if you would like to search for your nft balances but only look at NFTs from the shared Opensea contract you would change the web 3 API call in the useNFTBalance.js file to:

useMoralisWeb3ApiCall(account.getNFTs, { chain: chainId, …options, token_addresses[“0x495f947276749Ce646f68AC8c248420045cb7b5e”] })

and as for the data you want to display on the cards, check out the output of of the getNFTs call here: https://docs.moralis.io/moralis-server/web3-sdk/account#getnfts, nft?.metadata?.attributes should do the trick for you and then mapping through the different traits?

thanks a lot boss! highly appreciate this… god bless you!

1 Like

Nope. Still stuck on it. I’m wondering if its a problem with the deployment of my test NFT. I’m trying to see if I can get someone to send me their test NFT to see if it’s work

Hi, I am following the video and have a problem at around 35mn. My explore page loads fine with the different collections. But, if I reload the page I get the following error.
TypeError: NFTCollections is undefined
NFTTokenIds
src/components/NFTTokenIds.jsx:74

<div style={styles.NFTs}>
        {NFTTokenIds && inputValue !== "market" && 
          NFTTokenIds.map((nft, index) => (
           <Card // This is line 74
              hoverable
              actions={[
                <Tooltip title="View On Blockexplorer">

1.git clone https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate.git
2.cd ethereum-nft-marketplace-boilerplate
3.yarn
4.yarn start
Then I go to localhost:3000 and I get:
NoMoralisContextProviderError: Make sure to only call useMoralis within a
https://gyazo.com/d660695b60ea28e5c79637ef6ef4d4ad

how did you fix the NoMoralisContextProviderError?
any help is greatly appreciated

@IAmJaysWay I’m having the same problem. When I try executing directly in remix, I get this error

Hey @Ollie, do you mean that currently you can not even load the explore page or the collections pages? One thing I notice is you are using "market", rather than "explore" is this by choice? :slight_smile:

Anyone? I don’t why I can’t get this app working either local or deployed to vercel/heroku etc.

It only works from the deploy to gitpod from the repository.

Thanks

@dawveed,

Have you provided your Moralis serverURL and AppID in the .env file? Also make sure that you have your marketplace contract ABI and address pasted into the MoralisDappProvider.js file :+1:

@Code_shinobi, you could try deploying this NFT contract and mint a few NFTs, it should definitely work, otherwise there is probably something funky with you contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;

import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";


contract NFT is ERC721URIStorage {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    address contractAddress;
    address public owner;


    constructor(address marketplaceAddress) ERC721("Collection Name", "Ticker") {
        contractAddress = marketplaceAddress;
        owner = msg.sender;
    }

    function createToken(string memory tokenURI) public returns (uint) {
        require(msg.sender == owner, "Only owner is allowed to createTokens");
        _tokenIds.increment();
        uint256 newItemId = _tokenIds.current();

        _mint(msg.sender, newItemId);
        _setTokenURI(newItemId, tokenURI);
        setApprovalForAll(contractAddress, true);
        return newItemId;
    }
}

Hi again, thanks so much for your help so far!

I am currently testing the listing functionality, and changes in the Moralis Dashboard database can be seen from the Moralis server when an NFT in “Your Collection” was listed. However, I find that no CreatedMarketItems instances are added. Would there be any idea as to why this might be happening?

@ZeusExMachina, have you created the sync event on your Moralis server as shown in the video tutorial (46:30-49:30). This should listen to any listing events that happen on your smart contract and update you Moralis DB accordingly :slight_smile:

Also if you are using the final code (as opposed to following along the tutorial), you will still have to create that sync event on Moralis DB, but make the tableName/class name MaketItems due to changes in the final code :+1:

@IAmJaysWay

Sorry to disturb but I’m not sure where I’m supposed to put the link to the ipfs metadata in this code. I’m new to solidity.