List of all the Non fungible token created for an ESDT

Viewed 233

Here's my workflow:

  1. I will create a NFT brand (by the way is a NFT brand just an ESDT?)
  2. I want to perform an action for all the NFT under that brand.

So how do I get a list of all the NFT that has been created under my brand?

To go even further, how do I get it programmatically (using the rust SDK)? And how do I send egld to those addresses in the most effective way?

1 Answers

A nft brand is part of the esdt specification, but it is not the same as a fungible token, which are also commonly referred to as just ESDTs.

To get a list of all NFT you can use the following api. Use the token identifier (example: TEST-424242) you received upon creation of the brand to fill the collection parameter and you will receive all the nfts you created.

There is no easy way to retrieve the nft data inside a smart contract without knowing the address that holds the nft first. See the function get_esdt_token_data.

So to achieve what you want you will probably have to create a register function inside your smart contract that takes the caller address and the nft the caller provided and store that mapping in the smart contracts storage. That way you can retrieve it later to send the egld to the owners.

To send the egld you would want to use direct function in the send api. Or the direct_egld, which unfortunately isn't documented, but it is basically the same as the direct function but without the need to specify a token identifier and nonce.

Related