Error "no matching event" while parsing logs
See original GitHub issueHi while parsing an Log
array I’m getting the following error:
no matching event (argument="topichash", value="0x0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271", code=INVALID_ARGUMENT, version=abi/5.0.10)
I’m sure I’m missing something. On a different event and a different contract everything works like a charm.
This is my code:
let abi: string[] = [
"event RoundDetailsUpdated(uint128 indexed paymentAmount, uint32 indexed minSubmissionCount, uint32 indexed
maxSubmissionCount, uint32 restartDelay, uint32 timeout)",
];
let iface: utils.Interface = new utils.Interface(abi);
const filter: providers.Filter = {
address: "0x2f6BfbBB5d9CD374574Aa552dC6942C01D330C75",
fromBlock: 11630000,
};
const logs: providers.Log[] = await this.infuraProvider.getLogs(filter);
let events: utils.LogDescription[] = logs.map((log) => iface.parseLog(log));
console.log(events);
I know there were some similar issues with parsing but I couldn’t solve my issue with that solutions. Also those issues were more specific e.g. https://github.com/ethers-io/ethers.js/issues/1077.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Ethers contract on method "No mathing event" error
Ethers contract.on() (docs) is invoked when an event with the specified name is emitted. Your snippet is passing a function name ...
Read more >Parsing log data - New Relic Documentation
Troubleshooting. If parsing isn't working the way you intended, it may be due to: Logic: The parsing rule matching logic doesn't match the...
Read more >Uknown error while parsing user agent data - Elastic Discuss
I'm trying to parse some iis logs and i'm seeing this error in my logstash ... IllegalStateException: No match found, :field=>"useragent", ...
Read more >LOG SOURCE EXTENSIONS MIGHT FAIL TO PARSE ... - IBM
DSMExtensionException: An error occurred when trying to process match group: Log Source Extension for full W3C fields [ecs-ec] [Event Parser[0]] at ...
Read more >Documentation - Ethers.js
When a Contract creates a log, it can include up to 4 pieces of data to be ... If there is no avatar...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone still getting this issue, the below may work for you.
and the
decodedLogs
will look like this:You can verify that this event data is correct by searching the transactionHash on etherscan and comparing the event log data there, versus
decodedLogs
.I was stuck on this for a while because of that
undefined
that sneaks in. I’m not sure why its there, but thetry catch
handles it gracefully enough.Kudos to @linumlabs for their well written article on
iface.decodeEventLog
and @tangrisjones who helped debug this withtry catch
.A few ideas. 😃
Idea 1) If you aren’t trying to use the primitives for a good reason, you can use the higher level Contract API:
Idea 2) If you need to use the primitives because of upstream dependencies, or you already have the primitives left over from somewhere else:
Note: @azat-s the library you linked to looks like it just uses Web3, which just uses ethers anyways, so you are likely just adding extra dependencies that ultimately just wrap things in try…catch. 😃
Let me know if that helps, or it there are other constraints you are aiming to satisfy. There is likely an easy (ish) way to get what you want. 😃