How to render badges
Disclaimer: we are under development, expect changes in the model in the future, we are migrating to the V2 of our contracts. We also plan to launch an SDK for making the integration easy but it's still under development. If you want to collaborate with us feel free to contact us on discord
Note: we store the information under IPFS, that means that every ipfs hash that you will see on this tutorial has to be converted to urls to fetch the info from it. We recommend using one of the following gateways.
For example with PinataCloud:
Original ipfs hash: QmZnKDwa7rkJEraPKVuDHSeQGCKuamG8WyxpNfZ9jm9qye
Hash converted with gateway:
1) First to have to obtain the metadata of the badge that you want to render:
2) Once you have the metadata it will look like this:
3) Now you need to fetch the general information of the badge from the `badgeType.metadataURL` from IPFS, it will have a format like this:
4) From here you can take "name" and "description"
5) The image should be taken from the badge evidenceMetadatUrl (is an ipfs hash, you need to fetch it first):
6) Then you can access using the image value
7) Now you have two methods to render it:
Using the TheBadge-UI-Library: https://github.com/thebadge/thebadge-ui-library
Rendering the image using custom HTML.
Last updated