1

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?

Antonio Nardella
  • 1,074
  • 5
  • 17

1 Answers1

1

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.

https://api.shimmer.network/api/indexer/v1/outputs/nft/0x041e76073026afab15dbae86eeb2c7dd6876c463ca39fe03f62fecf1d7b6b268

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

Antonio Nardella
  • 1,074
  • 5
  • 17