I am using js to test contracts (hardhat, ethers, etc) and I am returning a uint256 tokenId that was created using
uint256 newItemId = _tokenIds.current();
And after, I increment the counter and return the newItemId from the
In my test I mint to tokens:
const connectedMinter = await nft.connect(minter); const tx1 = await connectedMinter.mintCollectable(tokenUri); const tx2 = await connectedMinter.mintCollectable(tokenUri);
The tx object I get back (which isnt the return of the mint function, which is supposed to return a uint256 tokenId) doesn't have the tokenId.
It has a value, but I am guessing that is the msg.value, ie the ether amount.
How should I test the increment without stubbing or calling directly like you guys do here
I just want to get back the uint256 tokenId so I can use it in sequential tests.. I know I can stub it with
BN("0"), BN("1"), BN("2") because I know it is sequential, but is there a better way?
I LOVE THIS PROJECT and all the hard work done by the team and the contributors. You guys really make smart contracts fun to write.
Thanks in advance!