Implement NFTs Card frame.
The design and the task information can be found in this figma file.
Build a REST API Node.js project that parse and returns the NFT metadata for a specific token.
We ask you to build only a single endpoint, but from the implementation, we’re interested in seeing how you’re broadly thinking the problem (scalability, e.g.) and design accordingly.
- Make an endpoint to return NFT metadata (token id, toke name, token attributes) when collection address and token id are given
- If you’re not familiar with NFT metadata, check EIP721/EIP1155 standard. This will also be helpful.
- You should be making a RPC call to read token metadata from NFT contract’s
tokenURI
method, parse it, and return the analyzed metadata (name, description, attributes, etc) - Consider as many possible cases as you can imagine for token URI. There are basically on-chain and off-chain metadata. Basic requirement is that you should support at least 2 cases (among Decentralized storage, base64 encoded on-chain data, and HTTPS URLs)
- On-chain metadata includes
- Off-chain metadata can be anything starts with
http
orhttps
. e.g.
Here's an example of API schema:
Request: [GET] /metadata?collection=0xED5AF388653567Af2F388E6224dC7C4b3241C544&tokenId=323
Response:
{
"success": true,
"data": {
"name": "#2100",
"image": "https://live---metadata-5covpqijaa-uc.a.run.app/images/2100",
"external_url": "https://www.proof.xyz/moonbirds/2100",
"attributes": [
{
"trait_type": "Eyes",
"value": "Open"
},
{
"trait_type": "Headwear",
"value": "Fire"
},
{
"trait_type": "Body",
"value": "Crescent"
},
{
"trait_type": "Feathers",
"value": "Pink"
},
{
"trait_type": "Background",
"value": "Yellow"
},
{
"trait_type": "Beak",
"value": "Long"
}
],
}
}
- Think about metadata caching, so you’re not querying the metadata again that you already queried. Use any caching method as you’re comfortable with (memory, Redis or Database)
- Think about modularization, especially for parsing various kinds of on-chain metadata outlined above.
- Support as many kinds of metadata as you think (Basic requirement is that you should support at least 2 cases.)
- Dockerize the code
- Unit or E2E tests