How to retreive TokenID from ERC-721

Hello,
I created a smart contract with preset ERC721PresetMinterPauserAutoId. My smart contract is deployed and i can mint without problem. I have two questions

  1. How i can get the TokenID when my ERC-721 call the mint function, i got the transaction hash but i didn’t found any solution to get this ID. I tried

web3.eth.getTransactionReceipt(txnHash).. but no ID inside this. Any idea ?

  1. How much an audit from OpenZeppelin cost ? i can’t find this information :frowning:

Thanks for help,
I love your work and the community around

1 Like

After some reseaches i found my solution.

The Contracts emit an event , called Transfer

In Web 3js, we can listen to this transfer and get details.

async function getTransferInformations(){

	token.Transfer({}, { fromBlock: 0, toBlock: 'latest' }).get((error, eventResult) => {
		if (error)
		  console.log('Error in myEvent event handler: ' + error);
		else
		  console.log(eventResult.slice(-1)[0]);

	  });

}
2 Likes

Hi @Charly_Stern,

Welcome to the community :wave:

Glad you were able to get the token ID from the Transfer event.

Our quotes and turnaround times vary according to the codebase’s length and complexity.
For info on requesting an audit please see:

1 Like