-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
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
How to decode log data #422
Comments
Keep in mind that that
without the first 'string'. You can also use the Interface API to help: let abi = [
"event newConnect (string indexed hashedName, string name, bytes32 connectId, string encrypted, address owner)"
];
let iface = new ethers.utils.Interface(abi)
getLogs.then((logs) => {
logs.forEach((log) => {
console.log(iface.parseLog(log));
});
}); That is just typed off the top of my head, so there may be typos, but that should get you started. :) |
No typos at all and both solutions work like a charm. Thank you very much! |
I have spent the last two days troubleshooting, this thread has given me the solution. I am using etherjs, I wish they had documented well that indexed parameters are not included in the connection.data, but in the connection.topics. |
the second solution is nice.. good thing to note is that ethers.Contract instances have Interface instances on them already, which you're likely to already be familiar with.. just call |
I fetched logs via
provider.getLogs
. Now I try to decode thedata
with this:But I get
The data comes from this event:
The text was updated successfully, but these errors were encountered: