Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Started here
Problem:
After migrating to viem and wagmi 1+ access to event parameters changed.
Before (ethers.js):
All the parameters of the event were accessible by index of argument in listener function or basically by index in args array.
After. We have two cases:
SomeEvent(uint256 arg1, uint256 arg2)
. We can access that event parameters on frontend only by param name:const {arg1, arg2} = event.args
SomeEvent(uint256, uint256)
. We can access that event parameters on frontend only by index:const [arg1, arg2] = event.args
or the sameconst arg1 = event.args[0]; const arg2 = event.args[1];
so writing frontend we're depending on how contract events are written and can't write universal code
Solution:
Add indexed parameters for frontend for named event parameters too. So for case with named params
SomeEvent(uint256 arg1, uint256 arg2)
we can access event params by param name OR by index of param.And it means we can always access event parameters at least by index
Additional Information
Your ENS/address:
0xrinat