Initial fix

This commit is contained in:
2024-08-21 16:55:26 -05:00
parent 50e9abe5d2
commit 41affeae6e
2 changed files with 36 additions and 16 deletions

@ -40,16 +40,26 @@ async function getAssetInfo(assetId) {
const data = res.data.data;
const assetInfo = data[0];
let isFree, forSale;
if (assetInfo.fiatProduct) {
const quantity = assetInfo.fiatProduct.purchasePrice.quantity;
isFree = quantity.significand === 0 && quantity.exponent === 0;
forSale = assetInfo.fiatProduct.published && assetInfo.fiatProduct.purchasable;
}
else {
isFree = assetInfo.product.price === 0;
forSale = assetInfo.product.isForSaleOrIsPublicDomain;
}
console.log(assetInfo);
return {
status: res.status,
id: assetId,
name: assetInfo.asset.name,
typeId: assetInfo.asset.typeId,
creatorId: assetInfo.creator.id,
price: assetInfo.product.price,
productId: assetInfo.product.productId,
forSale: assetInfo.product.isForSaleOrIsPublicDomain
isFree: isFree,
forSale: forSale
};
}