I have created a ERC-721 contract deployed on ropston network. Using contract I'm creating NFT's and its totally working fine.
Now for the transfer part I need to get tokenID of any NFT and transfer to to other address but I'm not able get the tokenID whenever I fetch transaction details from etherscan or using web3.
I want to store the tokenID in DB so it can be utilized while transferring to other address.
I have encircled the exact tokenID required in above image.
I'm using following code:
window.ethereum
.request({
method: 'eth_sendTransaction',
params: [
{
from: fromAddress,
to: contractAddress,
gas: '50000',
data: nftContract.methods.transferFrom(fromAddress, toAddress, tokenNumber).encodeABI()
},
],
})
I just want to get tokenID when NFT was created and store into DB for reference and perform business logic.
function mintNFT(address recipient, string memory tokenURI)
public onlyOwner
returns (uint256)
{
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(recipient, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
Above is the solidity function responsible for creating the NFT.