Skip to content
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

feat: filter contract logs for events #300

Merged
merged 3 commits into from
Aug 23, 2021

Conversation

lcamargof
Copy link
Contributor

@lcamargof lcamargof commented Aug 12, 2021

Description of changes

Avoid No Matching event by only calling parseLog on the logs that correspond to the current contract called.

Notes:

I'm not sure if this is the best solution for the problem, ideally we should return the logs unparsed but that can be found in the transaction itself

@changeset-bot
Copy link

changeset-bot bot commented Aug 12, 2021

🦋 Changeset detected

Latest commit: f5408d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@usedapp/core Minor
@usedapp/coingecko Patch
@usedapp/example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lcamargof lcamargof force-pushed the Filter_useContractFunction_events branch from 5257014 to a7e613f Compare August 12, 2021 23:04
@quagliero
Copy link
Contributor

Just stumbled across this as having the same error. Nice one.

@quagliero
Copy link
Contributor

For anyone else arriving here, this error was introduced in the most recent relase (0.4.4), so if you fix to version 0.4.3 you're OK.

Copy link
Contributor

@Szymx95 Szymx95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should pass the filtering function as argument to useContractFunction

useContractFunction(..., filteringFunction?: (e:any) => boolean)

So that developers can have more control and as default it can be left filtering address of contract

@nezouse nezouse merged commit afe26a5 into TrueFiEng:master Aug 23, 2021
@lcamargof
Copy link
Contributor Author

Maybe we should pass the filtering function as argument to useContractFunction

useContractFunction(..., filteringFunction?: (e:any) => boolean)

So that developers can have more control and as default it can be left filtering address of contract

More than a filtering function I would say it's a parse function, where manually they read the logs and parse the event with the corresponding contract Abi, this could be an empty function to get the raw logs

@mirkopezo
Copy link

I still have this issue even after updating to [email protected], it only throws error when calling smart contract function that has emit keyword in it. In my case I am calling _mint function from OpenZeppelin ERC20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants