What is really weird is that I donât even have the name of the collection displayedâŠ
The name of the collection is also coming from ItemImages
so if you donât have this then it wonât show either.
Have you changed anything significant in either NFTBalance.jsx or NFTMarketTransaction.jsx? As I understand it, the instructions on the page here are all thatâs needed where it should work when you go to list an NFT.
I will be working on some examples; issue right now is finding a collection that is relatively small to start with.
My collections.js file
export const networkCollections = {
"0x38": [
//Add Your Collections here
{
image:
"https://gdurl.com/g8RK",
name: "BETTA NFTs",
addrs: "0x9aAEf5A3054a3765dcc3A6ec8b39D6f217eBefda",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/8225e86fd7564996b11ab807added84e_zipped.png",
name: "Pancake Bunnies",
addrs: "0xDf7952B35f24aCF7fC0487D01c8d5690a60DBa07",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/983952c6dadb4f73b97e8c2ff76a8627_zipped.png",
name: "AgeOfGods",
addrs: "0x198D33FB8f75aC6a7CB968962c743F09C486cCA6",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/31e440a3bf814360a0d2a67ee2e34a1a_zipped.png",
name: "Firo Punks",
addrs: "0x603Fc574E33322056235dB7CCfbA5fC80Fb829c6",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/1e7d917dac9f4d0cb60dea08832ea5bf_zipped.png",
name: "Prometheus-GodNFT",
addrs: "0xd34Eb2d530245a60C6151B6cfa6D247Ee92668c7",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/46592a4e7e8142fd97886d9e4773fa6a_zipped.jpeg",
name: "MOBOX MOMOverse Avatar",
addrs: "0x24fADCEfd2117719C4078C08b352b22C74542418",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/e2c9704144ac4d0e8781c2101b617718_zipped.jpeg",
name: "WonderfulDay Tiger NFT",
addrs: "0x4f914EE31cb44D04c3CE8FCCd6573d9aF36C8780",
},
{
image:
"https://public.nftstatic.com/static/nft/zipped/e0c6aa7ee73348bd994cdbfb0ffa1d17_zipped.jpeg",
name: "Coow NFT",
addrs: "0xbE596dD10FEd6e27b5d62a0A32d1dc6D24DFBcC9",
},
],
};
export const getCollectionsByChain = (chain) => networkCollections[chain];
Sorry, last night the fatigue won lolâŠ
Yes I changed some style elements, but thatâs all.
I tried again with the original code and I have the same thing displayed⊠even after a new listingâŠ
And still no ItemImages in the dashboardâŠ
Is there another example than the tutorial. A marketplace deployed on the net for example that I can look at the difference with mine and correct my mistakes �
Try adding a console.log("running addItemImage")
to your addItemImage() function in NFTBalance.jsx to see if it runs when you list an NFT for sale - you should also be seeing a message of âsuccessâ.
Also change the itemImage.save() to:
itemImage.save().then(
(item) => {
// Execute any logic that should take place after the object is saved.
alert("New object created with objectId: " + item.id);
},
(error) => {
// Execute any logic that should take place if the save fails.
// error is a Moralis.Error with an error code and message.
alert("Failed to create new object, with error code: " + error.message);
}
);
The code is good like this�
function addItemImage() {
const itemImage = new ItemImage();
itemImage.set("image", nftToSend.image);
itemImage.set("nftContract", nftToSend.token_address);
itemImage.set("tokenId", nftToSend.token_id);
itemImage.set("name", nftToSend.name);
itemImage.save().then(
(item) => {
// Execute any logic that should take place after the object is saved.
alert("New object created with objectId: " + item.id);
},
(error) => {
// Execute any logic that should take place if the save fails.
// error is a Moralis.Error with an error code and message.
alert("Failed to create new object, with error code: " + error.message);
}
);
}
Yes if there are no errors, just run it. Try to console.log at each stage of the process to see what is happening or not. And then try another NFT listing.
Did the listener errors start as soon as you put in the new save() code or were they there before?
Try updating/restarting your server and reauthenticating (disconnecting/connecting) your user/wallet.
Click the POST ItemImages 400 error, what error do you get under âResponseâ (from the Network tab)?
Did you get the ItemImages Class created?
Try creating ItemImages manually from your Moralis server dashboard (Browser +) and try another listing.
For whatever reason itâs not creating automatically for you. E.g. in NFTBalance.jsx, I can do this and it just creates it normally:
const ItemImage = Moralis.Object.extend('ItemImages');
async function create() {
const itemImage = new ItemImage();
itemImage.set('image', 'create');
itemImage.save();
}
create();
If that doesnât work, create a new server with a new contract sync and use these settings in your existing project and try again.
I am also not sure where those listener errors have come from, apparently they may be browser/extension related. Try disabling any extensions you have except for MetaMask.