feat: auto-import erc20 tokens after fork #75
Merged
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.
Fixes #56
Works but there are a few things I'm not sure about (feel free to just fix and merge as well)
GetLogsParameters
typing is painful (only figured it out by copying the same idea from another one relating to blocks)useGetLogs
should probably be cached in a different way (or does it matter if it querys the same logs from fork to latest when it doesn't need to, technically one could save another cache of the last fetched block per chain per user but might be too much to save/invalidate later)useImportTransferredTokens
be called? right now it's just called whenever the account details screen is rendered (this also has the effect that if you are already on the screen it won't refresh until you go back to it?)event Transfer(address indexed from, address indexed to, uint256)
is the same event for both erc20/erc721? I'm not sure how that will be saved, like if it should be in the same store (all tokens, with an extra field to say whether it's erc20 or 721, or etc), since you don't know it based on the address ahead of time