Coder Social home page Coder Social logo

ebenezergh / etherscan-android-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 3.0 409 KB

An Android wrapper for the etherscan.io API

Home Page: https://etherscan.io/

License: MIT License

Kotlin 100.00%
ethereum etherscan etherscan-api ether android-wrapper ethereum-blockchain

etherscan-android-api's People

Contributors

ebenezergh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

etherscan-android-api's Issues

Add Readme

add readme w/ good documentation of how to use, where to assign apikey, etc..

Fix circleci.yml

CI isn't properly added to this project. Need to properly fill out the circleci.yml file with the proper build settings.

Convert Application module to a library module

All of my development so far has been done with this being an Application Module for the sake of testing. I need to convert the app into a library module which seems to a 1-2 line change in gradle. Some discovery will need to be done on other gradle scrips that should probably change.

Kotlinize the App

Yeah the whole app is written in kotlin, but there are many features that are available that could optimize the codebase in which are not being utilized..

Find areas that could be optimized
*data classes
*sealed classes
*ext functions
*etc...

remove unused dependencies

I initially added a few dependency's like Dagger and some testing dependency's i thought would be necessary. turns out they aren't. Would be nice to remove them so the users will not have any conflicts when importing this library.

Support ERC20 Token events by address

[BETA] Get a list of "ERC20 - Token Transfer Events" by Address

[Optional Parameters] startblock: starting blockNo to retrieve results, endblock: ending blockNo to retrieve results

http://api.etherscan.io/api?module=account&action=tokentx&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken
(Returns up to a maximum of the last 10000 transactions only)

or

https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2&page=1&offset=100&sort=asc&apikey=YourApiKeyToken
(To get paginated results use page= and offset=)

or

https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&page=1&offset=100&sort=asc&apikey=YourApiKeyToken
(To get transfer events for a specific token contract, include the contractaddress paramter)

Change conventions for retrieving data

To fall in line with current coding conventions, I should have consistency with the commands the user uses to fetch data. Instead of get, maybe a retrieve.. etc..

Move Library to Jitpack.io

we are currently testing and using the library through another module. This task is for importing the library to jitpack.io

Abstract out responses until another class

    private fun handleResponse(retrieveQuery: MainResponse) {
        stat.status = retrieveQuery.status
        stat.message = retrieveQuery.message
        stat.ethBtc = retrieveQuery.etherPriceresult?.ethBtc
        stat.ethBtcTimestamp = retrieveQuery.etherPriceresult?.ethBtcTimestamp
        stat.ethUsd = retrieveQuery.etherPriceresult?.ethUsd
        stat.ethUsdTimestamp = retrieveQuery.etherPriceresult?.ethUsdTimestamp
    }
private fun handleResponse(retrieveQuery: GethResponse) {
 geth...
 ...
 ...
}

Some of these queries, geth for example has maybe MANY different fields. If the responses are going to be retrieved from the fields using this current model then to prevent this class from being too convoluted I will need to pull them out to keep things clean.

This will probably be better to work on after all the responses have been added.

Write Tests around Networking

Priority is to write test around the Networking classes since that is the core of this library. Afterwards I will create Issues for writing tests on other classes.

Deserialization of result to be a string/object/list.. Seems that I can get results of all types

For some reason Fields can contain different object types.
Example:
https://api.etherscan.io/api?module=proxy&action=eth_getBlockByNumber&tag=0x10d4f&boolean=true&apikey=YourApiKeyToken

https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=YourApiKeyToken

Sometimes the "result" field will return an object, other times it will just completely return a string. The logic needs to be implemented to handle both of these fields.

Return the correct data types

So far i'm returning most variables as Strings. It'll be a more fluent experience for the users of the library if the returned data was returning the correct data type

Handle Gracefully when Etherscan.io API goes down

Experienced an etherscan.api network outage for the first time and the module wasn't able to handle the crash gracefully. After 10 seconds the stream crashes.

Caused by: java.net.SocketTimeoutException: failed to connect to
Caused by: java.net.SocketTimeoutException: failed to connect to api.etherscan.io/23.111.151.66 (port 80) from /192.168.1.3 (port 37860) after 10000ms

**Should also handle gracefully faulty connections

A lot of redundancy's

There is a lot of code being reused in classes, and there are some areas where extension functions could be used. Stat,Account,querymediator, etc.. Clean these up.

return correct datatype

Go through Endpoints of queries and make sure they're returning the correct datatype.
For instance, i am retrieving a lot of hex values and saving them as a string. These could be saved in an easier format and allow the user of this library to access those variables without the extra step of converting the response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.