Cloning OpenSea NFT Boilerplate Questions

Can you post some code, so i can get better look of what is actually happening?

@taha sure,

<button className="btn btn-primary w-full"  onClick={() => purchase()}>Buy </button>

async function purchase() {

        const tokenDetails = getMarketItem(nftToBuy);
        const itemID = tokenDetails.itemId;
        const tokenPrice = tokenDetails.price;
        const ops = {
            contractAddress: marketAddress,
            functionName: purchaseItemFunction,
            abi: contractABIJson,
            params: {
                nftContract: nftToBuy.token_address,
                itemId: itemID,
            },
            msgValue: tokenPrice,
        };

        await contractProcessor.fetch({
            params: ops,
            onSuccess: () => {
                console.log("success");
                setLoading(false);
                setVisibility(false);
                updateSoldMarketItem();
                succPurchase();
            },
            onError: (error) => {
                setLoading(false);
                failPurchase();
            },
        });
    }

Here i attached the particular code please let me know if you want to see more.

Thank you.

also post the values you are passing, it is Metamask error btw

@taha Thanks for your reply,

tokenDetails :
{
    "objectId": "LBW13UcdOs0hv8f2QcbY7CdK",
    "createdAt": "2022-02-17T05:46:11.892Z",
    "price": "300000000000000000",
    "nftContract": "0x7c47d6062dbbc5aa05cb9cba41e9df0c1fd8e7d0",
    "itemId": "83",
    "sold": false,
    "tokenId": "11",
    "seller": "0xd0ff132b93629a3659c15a9129b5b97890ee9ae7",
    "owner": "0x0000000000000000000000000000000000000000",
    "confirmed": true
}

itemID: 83

tokenPrice: 300000000000000000

ops:

{
    "contractAddress": "0xa3dDf4B68CCda6c9CB35AE1962c60aA5cb226E90",
    "functionName": "createMarketSale",
    "abi": [
        {
            "inputs": [],
            "stateMutability": "nonpayable",
            "type": "constructor"
        },
        {
            "anonymous": false,
            "inputs": [
                {
                    "indexed": true,
                    "internalType": "uint256",
                    "name": "itemId",
                    "type": "uint256"
                },
                {
                    "indexed": true,
                    "internalType": "address",
                    "name": "nftContract",
                    "type": "address"
                },
                {
                    "indexed": true,
                    "internalType": "uint256",
                    "name": "tokenId",
                    "type": "uint256"
                },
                {
                    "indexed": false,
                    "internalType": "address",
                    "name": "seller",
                    "type": "address"
                },
                {
                    "indexed": false,
                    "internalType": "address",
                    "name": "owner",
                    "type": "address"
                },
                {
                    "indexed": false,
                    "internalType": "uint256",
                    "name": "price",
                    "type": "uint256"
                },
                {
                    "indexed": false,
                    "internalType": "bool",
                    "name": "sold",
                    "type": "bool"
                }
            ],
            "name": "MarketItemCreated",
            "type": "event",
            "signature": "0x045dfa01dcba2b36aba1d3dc4a874f4b0c5d2fbeb8d2c4b34a7d88c8d8f929d1"
        },
        {
            "anonymous": false,
            "inputs": [
                {
                    "indexed": true,
                    "internalType": "uint256",
                    "name": "itemId",
                    "type": "uint256"
                },
                {
                    "indexed": false,
                    "internalType": "address",
                    "name": "owner",
                    "type": "address"
                }
            ],
            "name": "MarketItemSold",
            "type": "event",
            "signature": "0x2073b2706c235effb1e3840575370a51749afd8181b4018f93bff955d50792cb"
        },
        {
            "inputs": [
                {
                    "internalType": "address",
                    "name": "nftContract",
                    "type": "address"
                },
                {
                    "internalType": "uint256",
                    "name": "tokenId",
                    "type": "uint256"
                },
                {
                    "internalType": "uint256",
                    "name": "price",
                    "type": "uint256"
                }
            ],
            "name": "createMarketItem",
            "outputs": [],
            "stateMutability": "payable",
            "type": "function",
            "payable": true,
            "signature": "0x58eb2df5"
        },
        {
            "inputs": [
                {
                    "internalType": "address",
                    "name": "nftContract",
                    "type": "address"
                },
                {
                    "internalType": "uint256",
                    "name": "itemId",
                    "type": "uint256"
                }
            ],
            "name": "createMarketSale",
            "outputs": [],
            "stateMutability": "payable",
            "type": "function",
            "payable": true,
            "signature": "0xc23b139e"
        },
        {
            "inputs": [],
            "name": "fetchMarketItems",
            "outputs": [
                {
                    "components": [
                        {
                            "internalType": "uint256",
                            "name": "itemId",
                            "type": "uint256"
                        },
                        {
                            "internalType": "address",
                            "name": "nftContract",
                            "type": "address"
                        },
                        {
                            "internalType": "uint256",
                            "name": "tokenId",
                            "type": "uint256"
                        },
                        {
                            "internalType": "address payable",
                            "name": "seller",
                            "type": "address"
                        },
                        {
                            "internalType": "address payable",
                            "name": "owner",
                            "type": "address"
                        },
                        {
                            "internalType": "uint256",
                            "name": "price",
                            "type": "uint256"
                        },
                        {
                            "internalType": "bool",
                            "name": "sold",
                            "type": "bool"
                        }
                    ],
                    "internalType": "struct marketPlaceBoilerPlate.MarketItem[]",
                    "name": "",
                    "type": "tuple[]"
                }
            ],
            "stateMutability": "view",
            "type": "function",
            "constant": true,
            "signature": "0x0f08efe0"
        },
        {
            "inputs": [],
            "name": "owner",
            "outputs": [
                {
                    "internalType": "address",
                    "name": "",
                    "type": "address"
                }
            ],
            "stateMutability": "view",
            "type": "function",
            "constant": true,
            "signature": "0x8da5cb5b"
        }
    ],
    "params": {
        "nftContract": "0x7c47d6062dbbc5aa05cb9cba41e9df0c1fd8e7d0",
        "itemId": "83"
    },
    "msgValue": "300000000000000000"
}

In MM edit the suggested gas fees when prompted to confirm transaction. Increase the priority fee and gas fee incrementally until you no longer get a message saying that the price is too low for the network conditions

Anyone know why I get the “There was a problem listing your NFT” error if I try to list an NFT for sale with a length greater than 4 digits?

if I want to list for 999 MATIC it works but if I increase to anything like 1000+ it throws the error

Does this have to do with the marketplace smart contract or the boilerplate jsx?

Thanks in advance

Hi, I just setup the complete version of the boilerplate.

I’m testing it with the Ropsten network. I’m having two issues:

  1. When I go to “Your Collection”, I’m able to see the NFTs I have but also the message “Unable to fetch all NFT metadata… We are searching for a solution, please try again later!”
  2. When I click on the image to “Approve”, it goes thru with no problem, and then when I click to list the NFT, I get the message shown in the image. It doesn’t give me any error in the console, so I don’t know what could be going on.

Thanks in advance.

1 Like

@beagle Thanks for the reply where I can change the gas fees in the NFT boilerplate, please let me know.

Thank you.

yarn format man :raised_hands:

hello and thanks for the reply.
can you elaborate PLZ? on the video he says to install yarn.
I look what yarn format does didn’t find anything.

Hello, following the video makes me able to make it run correctly… but one thing i do not understand is what is the market address, how to get this ? thanks for your help

Hey everyone! I’m having an issue with call my smart contract. When listing NFT to the market place.
I have upload my sc with Remix IDE to Polygon mainnet. But after call a contractProcessor.fetch i have this error.
"execution reverted: ERC721: transfer caller is not owner nor approved"
I’m using the marketplaceBoilerplate.sol

Hi, having some trouble loading NFT collections using the code from useNFTTokenIds.js, specifically

const {
    fetch: getNFTTokenIds,
    data,
    error,
    isLoading,
} = useMoralisWeb3ApiCall(Moralis.Web3API.token.getAllTokenIds, options);

is able to fetch data, but when importing it into my own project with react-moralis 1.3.2 (not 0.2.8 like in the repo), I can’t fetch the data. However, the following works

const data = await Moralis.Web3API.token.getAllTokenIds(options);

How do I get the useMoralisWeb3ApiCall to work with the line directly above? I tried and it doesn’t work.

Just realised my problem. Just simply need to call getNFTTokenIds() to fetch the data… should’ve read the docs more closely!

Hi everyone,

I have two servers in moralis dashboard how can I use both servers in one react app? let me know if any other options.

I use one server for the marketplace and another one for NFT minting.

Please help me to resolve this thank you.

Hi @jeevaTrippy,

Why 2 servers?
You have to double a lot of functionallity / functions (like MoralisDappProvider and all depending on this) and set their context to either the one or the other server.
Maybe better / easier to create 2 apps and run them simultaneously at different ports?

Hi I am following this project using Rinkeby test net. Will the Pixel Show and Test Mages nfts will show on the test net because I am getting this page.

When I use the Mumbai chain it works as expected and shows all the nfts of pixel Show collection

How can I use this menu guys, I can’t load the assets for the transfer.

While trying to launch the server using the finished document and following all the steps I ran into this problem. This is after he localhost:3000 page loaded right after I used “yarn start”

Does anyone know how to fix it since I don’t understand what it is trying to communicate.

That is just the template. In the video he never plans on using because instead of transferring NFT’s to one another he wanted people to buy NFT’s off of one and other. If you actually wanted the transfer to work you would have to write some .sol and .jsx code. What the code is? I dont know