honor tokens-to-return on /address token balances#1441
Open
honor tokens-to-return on /address token balances#1441
Conversation
2bb4e64 to
ed9bed5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Before this PR, Blockbook parsed
tokens=nonzero|used|derivedfor address requests, but the EVM address path did not actually honor that filter.EVM address token filtering is inconsistent with xpub filtering :
getAccountInfoand/api/v2/addressparsestokens=nonzero|used|derivedbut the EVM address path ignored those modes during token assembly.Solution
Apply token-mode filtering directly in the EVM address token assembly path :
tokens=nonzerois honored on the EVM address path.tokens=usedandtokens=derivedto stay compatible with current websocket consumers.Behavior after change
ERC20
tokens=nonzero: now works properly. Zero-balance ERC20s are excluded when holdings are available.tokens=used/tokens=derived: zero-balance ERC20s are still included, to preserve legacy behavior.nonzerofinally means nonzero.ERC721 / ERC1155
tokens=nonzero: now works properly.ids.multiTokenValueswith holdings.tokens=used/tokens=derived: empty NFT-style contracts are still omitted, preserving previous address-path behavior.nonzerobecomes correct, but compatibility is kept for websocket/default consumers by not surfacing metadata-only empty NFT contracts.One caveat
details=tokens, current holdings are not fetched, sotokens=nonzerobehaves likeused. That is documented indocs/api.md(line 479).Practical summary
nonzero.nonzero, but intentionally compatibility-preserving forused/derived.contract=history behavior remains intact even if a token is filtered out of thetokenslist.Test Commands