Cloning OpenSea NFT Boilerplate Questions

@Skanus, you will probably need to write setApprovalForAll from the NFT collections smart contract which gives an operator (i.e. your marketplace smart contract) permission to transfer tokens of the senders (i.e. you) behalf. See open zeppelin docs if you want more info :slight_smile:

This is also something you may add to the boilerplate, if you notice the marketplace smart contract not having approval for a specific users NFTs, you could prompt them to setApproval in the dApp.

Hey @lion33,

You have to make sure that the NFT has been put up for sale on the marketplace first and currently it seems you are attempting to purchase the 3rd item put up for sale (itemId) on the marketplace, so make sure that that the NFT contract address is correct/same as the 3rd item you put up for sale :slight_smile:

@Ioulaum Really like your passion to the project!! This is probably due to some of the indexing issues still, which are being worked don’t worry :wink: can’t give an ETA, but solutions are being considered.

Can anyone help me out with a deployment issue? I’m working with a web dev to get everything setup with github and we are getting a provider error. The app works fine in localhost and also if i manually drop the build folder onto my server.

Is there anything needed to be installed on the actual server? (VPS)

seems to be an issue with pushing it to github/server? Any help would be great! Thanks

Hello, does anyone maybe have a solution or tips to approve the market contract to transfer a user’s NFTs?

I have tried using
IERC721(nftContract).setApprovalForAll(address(this), true);

It does not allow the caller to set approval (for obvious reasons). In this case, it recognises the marketplace contract as the caller and not the user trying to list the item. When using Remix it works because as the user, I can manually call the function.

Any help would be appreciated :blush:

i am really curious about smartcontract you uploaded works like the picture?
(https://github.com/ethereum-boilerplate/ethereum-nft-marketplace-boilerplate/blob/main/src/contracts/marketplaceBoilerplate.sol)

anyone can do it with the code???

i have struggled since 2 weeks ago. please help me!!!
when i tried to resell nfts from my collection and pay for fee and then Metamask said
“# Revert ERC721: transfer caller is not owner nor approved”

@lion33 I’ll check if there is some other problem, but the boilerplate should work fine as long as you have approved to marketplace to transfer the users NFTs.

In addition to that and as a note to you @itsybitsycyber, will try and get back to you shortly with a way to set the approval in a more automated fashion :+1:

what do you mean that i approve to marketplace to transfer users’ NFTs?
and how??

I’m having issues here.

"Cannot read property ‘toString’ of undefined

Help!

See the Open Zeppelin Docs: https://docs.openzeppelin.com/contracts/2.x/api/token/erc721#IERC721-setApprovalForAll-address-bool-

But you can try this out by finding the NFT collection on the networks block explorer, then choosing to write the contract and finding setApprovalForAll as shown in the images below. Ofc you may integrate this functionality into the dApp itself as mentioned in a couple of posts earlier, but will give you updates in the coming days.

Hey @Code_shinobi, you will have to be a bit more specific :sweat_smile:
When do you get this error?

@IAmJaysWay
I got it when I tried using the hex notation to name my images. Here’s the error:

content: data.toString (“base64”)

Typeerror: Cannot read property “toString” of undefined.

PS: If anyone else is having the issue, I fixed it by renaming my images (1 to n), and incrementing my for loop from 1 to (n+1)

Where n is your total number of images. Hope this helps

btw, just for reference, I tested my proxy idea in the current updated version of the boilerplate, and overall it ends up performing faster with all the images showing.

src/components/NFTBalance.jsx

  const handleChange = (e) => {
    setAmount(e.target.value);
  };

  // Start Change
  if (NFTBalances?.result) {
    NFTBalances.result.forEach(element => {
    if (element.token_uri.indexOf('workaround-proxy') < 0) {
      element.token_uri = `https://workaround-proxy.herokuapp.com/${element.token_uri}`
    }
  });
  }
  // End Change
  
  console.log("NFTBalances", NFTBalances);
  return (
    <>
      <div style={styles.NFTs}>

So, some sort of proxy / caching layer may well be a good intermediate solution.

I’m also thinking of routing the NFT images received through a CDN so they’re more stable and don’t run into request limitations on origin server.

@itsybitsycyber,

I added an approval button in the NFT balance tab, which should allow a user to give the market place permission to transfer the users NFTs. It should be updated on the “ethereum-nft-marketplace-boilerplate” repository on GitHub, if you wanna have a look for yourself, but here is the general idea:

const contractProcessor = useWeb3ExecuteFunction();
  async function approveAll(nft) {
    setLoading(true);  
    const ops = {
      contractAddress: nft.token_address,
      functionName: "setApprovalForAll",
      abi: [{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"}],
      params: {
        operator: marketAddress,
        approved: true
      },
    };

    await contractProcessor.fetch({
      params: ops,
      onSuccess: () => {
        console.log("Approval Received");
        setLoading(false);
        setVisibility(false);
        succApprove();
      },
      onError: (error) => {
        setLoading(false);
        failApprove();
      },
    });
  }

I tested it out by authenticating with a new user and it seemed to work good allowing me set approval and after that list the NFT :+1:

@lion33, @Skanus you might also find this helpful…

1 Like

Cool @Ioulaum , I’ll give it a go and maybe add a comment to the boilerplate if people want to use something like this as a solution for now :slight_smile:

1 Like

Hi, I followed the video I Cloned OpenSea in 2 Hours - Building a Cross-Chain NFT Marketplace, everything its working fine but on Polygon and Polygon Mumbai Testnet NFTs are not showing:

Polygon:


Mumbai:
Eth Mainnet:

All NFTs are minted on opensea, on Eth they are bought from official collections and on Polygon and Mumbai I minted them myself using testnet.opensea.

How or where can I mint a nft that follows the metadata standards and which are the metadata standards? If you could help me with a link to a tutorial or documentation on how to mint nfts with this specific metadata standards on Moralis I would be so happy.
Any information is helpful.

Thank you for your time!

Great to hear you enjoyed the tutorial @paultaran!

There is most likely no error in the metadata if you have minted the NFTs on OpenSea. There are currently a few kinks Moralis is solving with indexing of the NFTs, that are causing some NFT images to not show. In the meanwhile as a workaround you can look at something like what @Ioulaum has done (see earlier in this thread) with using a proxy to get all images to show:

yep, you’re right, i did it, cause in another way i cant sell anything, the problem is when i try to re-sell the same nft that i bought before, its weird because if i go to the collection contract nd get the owner of these token i got the correct address, nd if i try to approve these address got the error : “ERC721: approval to current owner”.

edit: i got the issue, when i sell an nft, the aproval for the marketplace is seted to false, so if i try to sell it again, i cant do it, i need to set the approval to true for the marketplace after sell any nft

Still its not working, I guess its because of minting using testnet.opensea. This is the token_uri: https://testnets-api.opensea.io/api/v2/metadata/mumbai/0x2953399124F0cBB46d2CbACD8A89cF0599974963/0xaf4d633677a6f00a686edc7cfd7baa64241ac03f000000000000040000000001 and its not working even if you test it in browser, although there are some token_uri that are working but the image doesn’t show on the nft markeptlace. I even tested minting on polygon using main opensea site but it doesn’t work. Do you know any other place to mint an nft or a tutorial of building a mint NFT site on polygon using Moralis or a way to fix it?

Thank you!

You can always create your own collection store the metadata on ipfs and deploy a smart contract to mint the NFTs. This tutorial on Moralis youtube channel should have everything you need to get going :slight_smile:
https://www.youtube.com/watch?v=VglTdr0n5ZQ