Move to use the Zapper API to loading token balances #3
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.
This CR changes (essentially rewrites) the Ethereum Wallet integration to use the Zapper API to load token balances for users. This API is by far the most comprehensive API for capturing the token balances of all tokens across the DeFi ecosystem and has recently been made publicly available, free of charge. As such it was a no-brainer to use this API for LunchMoney Ethereum balances, as the previous solution had no ability to capture the value of more esoteric token holdings like liquidity pool tokens, farming tokens, NFTs, etc. The previous solution also had no ability to capture token balances for Ethereum Layer 2 networks like Polygon, Optimism, etc.
The most significant upstream change included in this is that the client now returns an
amountInUSD
field in addition to anamount
field. TheamountInUSD
field contains Zapper's calculation of the value of the wallet's token holding in US dollars. I chose to start to include this in the output instead of letting the upstream caller calculate this, as we've been doing up to now, because many of these conversions to USD value are rather complicated and Zapper gives us this for free, so why not use it. :)Another nice side-effect of this solution is that we no longer use a fixed token list, so this invalidates the needs for PRs like #2.