-
Notifications
You must be signed in to change notification settings - Fork 41
Add support for PolygonScan #20
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
Conversation
Hello! Thanks for such PR, I will look into it deeply when have more time! As for tests that's maybe the best to rewrite all tests (if they use all same endpoints / APIs) to parameterized tests and pass different APIs with different addresses to test all cases, thats may be the best way |
Hi Anton, I mistakenly added my changes for "making the log-api usage bug free" in the same PR since I did not revert my branch to your master. Since I am more used to SVN, I don't know how to make a dedicated PR for my second commit. However, for my project, I need to use Logs and the previous implementation of the Log-Api did not offer all the opportunities that were possible. Additionally, the usage seemed difficult and it was easy to run into run-time errors, since everything looked fine during compilation but would not work in the end. Thus, I made some adaptations to make the usage basically bug free. This needed a lot more (simple) classes to ensure type safety. I wonder what you think about it? |
I didn't forget about your PR, I just trying to rearrange and finish other projects and then will back to this one |
- Inclusion of tokenID in Erc721 transfers - Support for Erc1155 transfers
I was kinda out of the grid for quite a time, will take a look into it, this will probably go into 2.0 so I have to make preparations for 2.0 refactoring to include this one in there |
Kudos, SonarCloud Quality Gate passed! |
@GoodforGod do you have plans to merge this one? |
Hello @phil3k3 , current API supports all methods that are included in this PR, for polygon URL usage please create API with the following syntax: EtherScanAPI api = EtherScanAPI.builder()
.withNetwork(() -> URI.create("https://api-my-custom.etherscan.io/api"))
.build(); So there is no need in this PR anymore cause everything is already supported, it will be closed |
With the emergence of side chains and layer 2s, etherscan expanded its offerings and supports block explorer APIs for other networks as well. Since the API requests and responses are fairly similar between the networks, the extension should not be too difficult.
Changes
I created a BaseApi class for the setup and a Network interface to get the correct API-URL. I added the Polygonscan implementation as the first alternative API. I left the EthNetwork enum in the module as before, but I think it might be better to place it in the network submodule.
Todos
Since some requests and responses are different between Polygonscan and Etherscan (especially for the stats APIs), more specifications regarding the setup of the specific endpoints might be required (e.g. protected initialization methods for endpoint APIs with default implementation such as IStatisticApi createStatisticsApi() { return new PolygonStatisticsApi()}).
Testing
I added some basic account and contract api tests with random addresses. I am not sure how to best integrate specific endpoint api tests into the current testing architecture. Do you have any suggestions?
Looking forward to your thoughts and ideas.