Cloning OpenSea NFT Boilerplate Questions

You can try adding the live query or subscriptions to fetch the data from CreatedMarketItem as soon as the database is updated.

But you mentioned it is only fetching 100 rows from the database, so I guess there should be some other reason for this.
When querying from the database it should fetch all the data unless there are any filters applied.

Here is the code: https://github.com/MubashirWaheed/ethereum-nft-marketplace-boilerplate/tree/royalty-feature/src
code in the royalty branch
I am trying to fix the nfts on the polygon mainnet and aliens-4 collection in the explore tab

You said “querying data from database should fetch all data” even if there are 1000s of rows?

did you found any bug in my code?

No, Didn’t find any mistakes in your code.

It looks like we need to pass a .limit function to get all the data. By default, rows are limited to 100, as per the docs

you need to update the useMoralisQuery in this way to get fetch all the 1000 rows.

const queryMarketItems = useMoralisQuery("CreatedMarketItem", query =>
  query.limit(1000))
1 Like

IT IS WORKING. THANK YOU SO MUCH. I was so stressed. Can you tell me what is the upper limit for query.limit(1000) number?

Tested just now querying 1230 rows with a limit as 10000. It retuned all the data.
image.

I guess there is no upper limit.

1 Like

You are the best. THANKS

Are you able to help me add these elements to my project? I copied the boilerplate & edited it but id like to add these as well, & im sure most others would as well. I need at least 1 or 2 done before I launch, but would like to have 3 done as well. Any help would be appreciated!

Hey guys I’m looking for the market place contract for remix but I cant find the one that he has in the video. Any assistance is appreciated.

That contract is here.

What have you done so far in your Explore page component? You can post a screenshot.

For items, you can use the total from your collection. You can get it from the API with getAllTokenIds.

For owners one way is to count all unique addresses from all Transfer events on the collection contract, similar to the process here. The API currently doesn’t have that available.

Floor price you could query all your market items from your table to get the first result based on ascending price.

I’m not sure what total volume would be, number of sales? If so you could use the total number of MarketItemSold events from the marketplace contract.

And then to add all of this data to your component to display it, you can use grids. As the boilerplate uses Ant Design, you can use their grid too.

For a search bar, you can read this and implement it similar to the filter code based on the syncing code example I posted. So you add a search input, add a handler which filters results based on what is entered in it, and then display these results.

For low to high, implement a select element as in the picture using similar code in the syncing example. But because you wanted all NFTs shown, it will have some conflicts because not all of them will have prices.

2 Likes

Thank you for all the advice. Ive got the contracts active & the collections uploaded. I customized the boilerplate & made the explore tab the marketplace tab. I only have the default functions from the boiler plate setup. Everything works but I just want to be able to filter everything the collections & display those elements. This is only my 2nd web3 project & im working alone so im just struggling to figure out how to make the front-end interact with the smart contracts.

1 Like

Hey guys I’m stuck on adding the smart contract ABI to my server. I keep getting the error message “Invalid ABI Please Verify” Any help

You can post your ABI here. It should be in the same format like this where it’s only the part that’s relevant to the event/topic you want to sync:

{
  "anonymous": false,
  "inputs": [
    {
      "indexed": true,
      "name": "from",
      "type": "address"
    },
    {
      "indexed": true,
      "name": "to",
      "type": "address"
    },
    {
      "indexed": false,
      "name": "tokenId",
      "type": "uint256"
    }
  ],
  "name": "Transfer",
  "type": "event"
}

In that case, what do you want to work on first? It would be easiest to start with the stats and get them displayed.

Here it is

{
“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”
},

Ok no problem, we can start with the stats & get them displayed.

Get rid of the comma at the end and it should work.

1 Like

That worked perfectly, Thank you!

When adding my ABI as a string in MoralisDappProvider.js I’m getting this error message " Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength"…

I’ve done a google search for this issue and change the max Token length to 2000000, but this still doesn’t work.