EbenezerGH / etherscan-android-api

An Android wrapper for the etherscan.io API

Home Page:https://etherscan.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generic badge Generic badge Generic badge License: MIT

etherscan-android-api

etherscan android api is an android wrapper for the etherscan api. This is just a module to handle networking calls.

There are only a few features left to add, however this version is completely safe to use.

Note: For Coroutines Implementation use coroutines-master branch etherscan-coroutines

Getting Started

Add JitPack to your root build.gradle at the end of repositories

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Add the dependency

	dependencies {
	        implementation 'com.github.EbenezerGH:etherscan-android-api:v1.4.0'
	}

Optional: Call ApiKey.takeOff.setApiKey("[your api key here]") in your module's application class when recording api usage in the etherscan.io console. [see example implementation]

ApiKey.takeOff.setApiKey("1I7CRNU2QIU253UBPFVB5UV2C2PBDURAIYZ")

Create an Instance of one of the reactive singles and access values by specifying thread and subscribing. [see example implementation]

Currently Available: [accountsApi, contractsApi, transactionsApi, blocksApi, statApi]

Coming Soon: [eventLogs, geth, websockets, tokens]

        val account = Account()
        val contract = ContractABI()
        val blocks = BlocksMined()

            //account
            account.getERC20Tokens("0x4e83362442b8d1bec281594cea3050c8eb01311c")
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribeBy(
                            onSuccess = { Log.d(TAG, "The Account Size of Transactions is: ${it.size}") },
                            onError = { Log.d(TAG, "error receiving ERC20") })

            //contracts
            contract.getContractABI("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413")
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribeBy(
                            onSuccess = { Log.d(TAG, "The ABI has returned: $it") },
                            onError = { Log.d(TAG, "error receiving abi contract") })

            //blocks
            blocks.getBlocksMined("2165403")
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribeBy(
                            onSuccess = {
                                Log.d(TAG, "The block miner is: ${it.blockMiner} and " +
                                        "the first miner : ${it.uncles.get(0).miner}")
                            },
                            onError = { Log.d(TAG, "error receiving blocks mined") })

Authors

BTC: 1MLaf31sjVG3LbMyQEuY16qosPAhwNRQeZ
ETH: 82e4499D4b2A669831a3881d61BB24f7b620c61a
LTC: LUF9RpzZ3kyKMYpSNiAT5hx7qR3q7ShV3H

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

References

Etherscan APIs

Contracts Verified

Ethereum Github Repo

Ethereum Wiki

About

An Android wrapper for the etherscan.io API

https://etherscan.io/

License:MIT License


Languages

Language:Kotlin 100.0%