Is it due to Moralis 1.0?
no, it is not related to moralis v1, can you try again now?
No.
Issue is still persisiting, API is throwing 400 for some reason.
yes, it is still not working as expected
Any timestamp by when it can be fixed?
All this functionality is working with your old server itβs only issue with parse server
what you mean with working with old server?
for me it doesnβt work with a moralis server now, unless I used web3api with uploadFolder
same issue not working with parse server
What happens?
Can you use web3api uploadFolder function?
No how to use this I am using the previous code and geeting issue from yesterday no what to change please check I have provided the code
async function uploadArtToIPFS() {
try {
await nft.saveIPFS();
console.log(nft);
let nftPath = nft.ipfs();
console.log(nftPath);
uploadMetaDataToIPFS(nftPath);
} catch (err) {
console.log(err);
alert("Error saving art to ipfs");
$('#saveToIPFSBtn').prop('disabled', false);
$('#saveToIPFSBtn').html("Upload and Mint");
}
};
async function uploadMetaDataToIPFS(nftPath) {
$(β#saveToIPFSBtnβ).html(`Uploading metadata to IPFS
<span class="sr-only">Loading...</span>
</div>`);
try {
let allEmojiRegEx = /\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/g;
const metadata = {
name: $('#title').val().replace(allEmojiRegEx, ''),
description: $('#descriptionInput').val().replace(allEmojiRegEx, ''),
image: nftPath
}
console.log(metadata);
const nftMetadata = new Moralis.File("nft-metadata.json", { base64: btoa(JSON.stringify(metadata)) });
console.log(nftMetadata);
await nftMetadata.saveIPFS();
console.log(nftMetadata);
let nftMetadataPath = nftMetadata.ipfs();
console.log(nftMetadataPath);
mint(nftMetadataPath, nftPath);
} catch (err) {
console.log(err);
alert("Error saving metadata to ipfs");
$('#saveToIPFSBtn').prop('disabled', false);
$('#saveToIPFSBtn').html("Upload and Mint");
}
};
Can you try to look on how to post code on forum?
It is not readable in current form that is posted.
async function uploadArtToIPFS() {
try {
await nft.saveIPFS();
console.log(nft);
let nftPath = nft.ipfs();
console.log(nftPath);
uploadMetaDataToIPFS(nftPath);
} catch (err) {
console.log(err);
alert("Error saving art to ipfs");
$('#saveToIPFSBtn').prop('disabled', false);
$('#saveToIPFSBtn').html("Upload and Mint");
}
};
async function uploadMetaDataToIPFS(nftPath) {
$('#saveToIPFSBtn').html(`Uploading metadata to IPFS <div class="spinner-border spinner-border-sm text-light" role="status">
<span class="sr-only">Loading...</span>
</div>`);
try {
let allEmojiRegEx = /\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/g;
const metadata = {
name: $('#title').val().replace(allEmojiRegEx, ''),
description: $('#descriptionInput').val().replace(allEmojiRegEx, ''),
image: nftPath
}
console.log(metadata);
const nftMetadata = new Moralis.File("nft-metadata.json", { base64: btoa(JSON.stringify(metadata)) });
console.log(nftMetadata);
await nftMetadata.saveIPFS();
console.log(nftMetadata);
let nftMetadataPath = nftMetadata.ipfs();
console.log(nftMetadataPath);
mint(nftMetadataPath, nftPath);
} catch (err) {
console.log(err);
alert("Error saving metadata to ipfs");
$('#saveToIPFSBtn').prop('disabled', false);
$('#saveToIPFSBtn').html("Upload and Mint");
}
};
With a self hosted parse server you ca. create a cloud function that receives a buffer in base64 and uploads it to IPFS.
You can use uploadFolder function in that cloud function
can you share the cloud function code of upload Folder
uploadFolder is a function in web3api, you can test it directly in the docs interface too
[quote="Waqar-7, post:20, topic:21450"]
can you share the cloud function code of upload Folder
[/quote]
Parse.Cloud.define("getArtwork", async (params) => {
const query = new Parse.Query("Artwork");
const queryResults = await query.find();
const results = [];
for (let i = 0; i < queryResults.length; ++i) {
results.push({
"cover": queryResults[i].attributes.cover,
"path": queryResults[i].attributes.path,
"tokenId": queryResults[i].attributes.nftId,
"tokenAddress": queryResults[i].attributes.tokenAddress,
"name": queryResults[i].attributes.name,
"description": queryResults[i].attributes.description,
"additionalInfo": queryResults[i].attributes.additionalInfo,
"unlockableContent": queryResults[i].attributes.unlockableContent,
"creator": queryResults[i].attributes.creator,
"fileType": queryResults[i].attributes.fileType,
"royalty": queryResults[i].attributes.royalty,
"active": queryResults[i].attributes.active,
"likes": queryResults[i].attributes.likes,
"currentOwner": queryResults[i].attributes.currentOwner,
"likers": queryResults[i].attributes.likers,
"encouragements": queryResults[i].attributes.encouragements,
"encouragers": queryResults[i].attributes.encouragers
});
}
return results;
});
this is the uploadFolder web3api function: