What is the correct way to keep track of NFTs on the Shimmer base layer? Once NFT's are taken off a marketplace like Soonaverse, what the best way to track these?
1 Answer
The indexer is the easiest way. Use the correct query parameters and you can search for whole collections or single nft ids
/api/indexer/v1/outputs/nft/{nftId}
from https://editor.swagger.io/?url=https://raw.githubusercontent.com/iotaledger/tips/main/tips/TIP-0026/indexer-rest-api.yaml
e.g.
The API response above returns the output ID
for that NFT and with that it is possible to request the output
https://api.shimmer.network/api/core/v2/outputs/0x2997478822516ed4a796accd75beaba6608413934579f8f4b0ce18c6a2df07fa0100
Now in Python it is possible to use the following code to get the immutable_metadata of the NFT:
output_data = client.get_output('0x2997478822516ed4a796accd75beaba6608413934579f8f4b0ce18c6a2df07fa0100')
immutable_features = output_data['output']['immutableFeatures']
# get metadata feature
immutable_metadata = [o for o in immutable_features if o['type'] == 2][0]['data']
print(bytes.fromhex(immutable_metadata[2:]).decode('utf-8'))
Credits go to: 0DN, Mersine, Dr.Electron and Thoralf on the IOTA & Shimmer Discord