We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As the issue #581, I need an easy way to capture values from event to reuse them.
For the moment and thanks to @wminshew I did this:
it('should burn tokens if asked', async () => { const response = await ( await contract.safeMint(await owner.getAddress()) ).wait(); expect(response.events[0].event).to.equals('Transfer'); const [, , tokenId] = response.events.[0].args; await expect(await contract.burn(tokenId)).to.emit(contract, 'Transfer'); });
Note the boring stuff about response / await / await / wait and the required expect on the event name. Maybe something like that could be interesting:
const args = await expect(await contract.safeMint(await owner.getAddress())).to.emit(contract, 'Transfer').args(); const tokenId = args[2];
The text was updated successfully, but these errors were encountered:
Interesting, wondering what we would like to return in the case of chaining the matcher, ie:
await expect(tx) .to.emit(contract, 'Transfer') .to.emit(contract, 'Mint') .args()
Just the arguments of the last one, Mint? Have you thought about this, what would make sense to you in this case?
Mint
Sorry, something went wrong.
Yes, it would be perfect ie args() returning the values of the event from the last emit().
No branches or pull requests
As the issue #581, I need an easy way to capture values from event to reuse them.
For the moment and thanks to @wminshew I did this:
Note the boring stuff about response / await / await / wait and the required expect on the event name. Maybe something like that could be interesting:
The text was updated successfully, but these errors were encountered: