Event logs does not support types for indexed properties
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
Currently if we access the event properties via, property name it detects valid type.
(await myContract.events.MyEvent()).on('data', log => {
console.log(log.returnValues.eventProp1) // will detect valid type
console.log(log.returnValues[0]) // will not detect valid type
});
Expected Behavior
It should detect the type for indexed properties as well.
Steps to Reproduce
Explained above.
Web3.js Version
4.x
Environment
- Operating System:
- Browser:
- Node.js Version:
- NPM Version:
Anything Else?
I am not sure if this can be done with existing types. But can be looked into further.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.
Estimated as 1. Will need to investigate and update estimate later.
who can resolve this issue
I tested https://github.com/web3/web3.js/blob/9b15fb1fd84d92cdd503e1324b7f58614d095192/fixtures/contracts/Basic.sol#L70 and I am getting:
log.returnValues :
{
'0': 'value',
'1': 12n,
'2': true,
__length__: 3,
str: 'value',
val: 12n,
flag: true
}
for tx with: firesMultiValueEvent('value', 12, true)
both for index (log.returnValues[0]) and by event prop title (log.returnValues.str) I am getting same value.
Same as well, i am getting the correct types but they are both detected as unknown, will be creating an issue for adding the feature of supporting event log types from abi