Skip to content

Add support for ERC-721 (NFT) Tokens #13

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

Merged
merged 4 commits into from
Dec 2, 2021
Merged

Add support for ERC-721 (NFT) Tokens #13

merged 4 commits into from
Dec 2, 2021

Conversation

NGuggs
Copy link

@NGuggs NGuggs commented Nov 20, 2021

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.

@GoodforGod
Copy link
Owner

Hello, Nathan

Thanks for your PR!

Everything looks good! You are correct, only test cases are needed for regression testing of such API. Thats a good question actually, I can't remember like proper strategy I was using at that time, something like "found unused account that barely move assets (probably forgotten) and reinforce tests as mush as possible".

I think such strategy is applicable here also, will be waiting test cases for your changes and they will be ready to go!

@GoodforGod GoodforGod added the enhancement New feature or request label Nov 29, 2021
@GoodforGod GoodforGod self-assigned this Nov 29, 2021
@GoodforGod GoodforGod added this to the v1.2.0 milestone Nov 29, 2021
@GoodforGod GoodforGod self-requested a review November 29, 2021 16:14
@GoodforGod
Copy link
Owner

Looks like rate limit wasn't expecting PR and API key is not propagated and API is rate limited, I'll merge and release it in 1.2.0

@GoodforGod GoodforGod changed the base branch from master to dev December 2, 2021 23:10
@GoodforGod GoodforGod merged commit 4bb51f6 into GoodforGod:dev Dec 2, 2021
@GoodforGod
Copy link
Owner

Thanks for your contribution @NGuggs !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
2 participants