I’m working for a coin and i’m doing a merch store nft marketplace. Basically i’m trying to mint a certain amount of a nft(t-shirt with 500 stock, for example). I tried adding a collection_id to the nft but i can’t get it to show up on EthNFTOwners so i can query the collection_id from that table. I tried using an event and another table but i’m having issues transfering ownership in that table. I saw that you have an amount attribute in EthNFTOwners, but how do i use that in contract + frontend?
Im trying to understand what you need.
You need total supply of your newly minted NFT?
Is it ERC721 or ERC1155?
If you do many ERC721s and need to connect them into a collection - it’s wrong way of doing it.
Better to use ERC1155 and have the ERC1155 contract hold all items in same collection.
Not total supply, i mint my nfts in bulk after inputting the quantity that i want. For example, i have 500 tshirts i wanna sell. I create the tshirt nft with metadata and a given quantity. The createItem function receives that quantity and mints the number of tshirt nfts that i inputted. The problem is that they have different tokenIds and i need to have them associated with each other. I didn’t find a way to use the amount attribute in EthNFTOwners and i was unable to add a collectionId variable to the EthNFTOwners table to identify that particular colection and stock of tshirts. So i created another table with a event fired on item creation that gives it the collectionId. And then i query the items from that table to display to the user, but i created an owner attribute that i can’t get to change on sale. I even tried adding a beforeTokenTransfer function override and adding a query in the itemSold event to change the owner in the table i have created. But it didn’t work.
You need to use ERC1155 so each type of t-shirt has same token_id
Here is how I would do it:
- Launch ERC1155
- In ERC1155 each
token_idcan have many items inside of it
- Each t-shirt gets a new
token_idand can have
- Moralis tracks all owners for this by default and you can easily filter by
Thank you very much, i’ll look into this and i’ll let you know of the results. One more question, should i only use erc1155 for items with x amount or should i use it for truly unique 1 of a kind items as well instead of erc721?
I would use it for unique too and set amount to 1
And then when you sell, you can sell just a certain number of that amount right? Can this also be used for shared ownership?
You can transfer certain amount of each token correct
Each token_id can have many owners as each token_id has many tokens and they can have different owners
Thank you for your support Ivan, i’ll follow up with some feedback after i try this