Moralis.Cloud.define(âgetOfferDetailsâ, async (request) => {
const query = new Moralis.Query(âArtworkForSaleâ);
query.select(âofferIdâ, âtokenIdâ, âtokenAddressâ, âpriceâ, âisSoldâ, âartwork.currentOwnerâ, âartwork.creatorâ, âartwork.coverâ, âartwork.nameâ, âartwork.fileTypeâ, âartwork.likesâ, âartwork.activeâ, âartwork.royaltyâ, âartwork.unlockableContentâ, âartwork.likersâ);
const queryResults = await query.find({useMasterKey: true});
const results = [];
for (let i = 0; i < queryResults.length; ++i) {
results.push({
  "offerId": queryResults[i].get.offerId,
  "tokenId": queryResults[i].get.tokenId,
  "tokenAddress": queryResults[i].get.tokenAddress,
  "price": queryResults[i].get.price,
  "isSold": queryResults[i].get.isSold,
  "owner": queryResults[i].get.artwork.attributes.currentOwner,
  "creator": queryResults[i].get.artwork.attributes.creator,
  "cover": queryResults[i].get.artwork.attributes.cover,
  "name": queryResults[i].get.artwork.attributes.name,
  "fileType": queryResults[i].get.artwork.attributes.fileType,
  "likes": queryResults[i].get.artwork.attributes.likes,
  "active": queryResults[i].get.artwork.attributes.active,
  "royalty": queryResults[i].get.artwork.attributes.royalty,
  "unlockableContent": queryResults[i].get.artwork.attributes.unlockableContent,
  "likers": queryResults[i].get.artwork.attributes.likers
});
}
return results;
});