Add support for ERC-721 (NFT) Tokens #13
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.
I noticed there was currently only support for ERC-20 tokens and that Ertherscan used a different endpoint to get ERC-721 (NFT) Tokens.
Changes
I followed the same paradigm used for the ERC-20 tokens and just duplicated and changed for the new endpoint.
Considerations
With how similar the tokens are in requests, the methods could be combined into a single set with an enum or parameter (or similar in function) that determines which token type your are intending and reduces nearly duplicate code. Though it would take extra work to support backwards compatible upgrades to the new version.
Testing
Manually tested against a random account (0x51b1501420C50aDdA1C4942720bC0e7e8C6D768e) which includes both ERC-20 and ERC-721 tokens.
Still need to add test cases for this. But... was curious how you chose the account for the initial set of test cases. I noticed that account did not have ERC-721 tokens and I would be hesitant to use a random account knowing there could be additional tokens in the future and break the tests.
Let me know your throughts.