Closed robertistok closed 3 years ago
Also just thought of adding the whole asset URL to the results, would be really usefull if you want to notify a user with the direct link where to buy that asset!
thanks @robertistok ! 💯
That's a great idea! Could be an easy addition. On this note, I also thought it would be useful to return the total number of items that are available for sale. The best would be to use this endpoint for it. Maybe return an object with the following structure:
return {
offers: IOffer[],
stats: { totalForSale: 1856 }
}
This would have the benefit of making it flexible, so we could add more stuff to it later. Although it would not make the script backward compatible
Yeah makes sense to me, if you want you can submit a PR or I can do it some time later. This should do the trick:
const resultsText = document.querySelector(".AssetSearchView--results-count").innerText;
const totalForSale = Number(restultsText.split(" ")[0]);
concerning assetUrl I did add it already in the last update 3.1.0 (offerUrl
)
1721268dbe94220f5dc45e84d866ded3f3cbe228
Instead of getting it from the name, get from the
href
element of the card.In case of the The Sandbox example, the
tokenId
was not present in the card in the same way as in for the Coolcats one.