I am trying to get the token id back after minting. I have the below function in my contract sol.
function createToken(address to) public onlyOwner returns (uint256) {
_tokenIdCounter.increment();
uint256 newItemId = _tokenIdCounter.current();
_safeMint(to, newItemId);
return newItemId;
}
The minting works, but instead of getting newItemId returned I am getting json data back. Same as if I just called the mint method directly.
{
tx: '0xf...',
receipt: {
transactionHash: '0x...',
transactionIndex: 0,
blockHash: '0x...',
blockNumber: 5,
from: '0x...',
to: '0x...',
gasUsed: 154884,
cumulativeGasUsed: 154884,
...
I am testing locally with truffle.