⚙️ Kotlin/Java library for Bloxy.info API
Switch branches/tags
Clone or download
GoodforGod Merge pull request #1 from GoodforGod/feature/extention
Feature/extention : 1.0.2 Version
Latest commit f07d38c Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Travis CI fix Nov 30, 2018
src Contract API javadoc Dec 2, 2018
.gitignore Gradle build central publish preparation Nov 28, 2018
.travis.yml Travis CI fix Nov 30, 2018
LICENSE LICENCE Nov 26, 2018
README.md 1.0.2 Release Final Dec 4, 2018
_config.yml Set theme jekyll-theme-minimal Nov 26, 2018
build.gradle 1.0.2 Release Final Dec 4, 2018
gradlew Travis CI fixs Nov 27, 2018
gradlew.bat Travis CI fixs Nov 27, 2018
settings.gradle Travis CI fix Nov 30, 2018

README.md

⚙️ Bloxy Api

travis codecov

Kotlin & Java Library for all available Bloxy API endpoints.

Bloxy.info is as a source of open, reliable, verifiable and objective data about the blockchain.

Readme Web Page

Dependency 🚀

Library depends on Klaxon so jcenter repository is required.

Maven

<repositories>
    <repository>
        <id>jcenter</id>
        <url>https://jcenter.bintray.com/</url>
    </repository>
</repositories>
 
<dependencies>
    <dependency>
        <groupId>com.github.goodforgod</groupId>
        <artifactId>bloxy-api</artifactId>
        <version>1.0.2</version>
    </dependency>
</dependencies>

Gradle

repositories {
    mavenCentral()
    jcenter()
}
 
dependencies {
    compile 'com.github.goodforgod:bloxy-api:1.0.2'
}

Content

Getting Started

All you need to start is just to get API key to Bloxy, key will be in the email (login link)

Bloxy Client in Java

BloxyApi api = new BloxyApi("YourApiKey");

Bloxy Client in Kotlin

val api = BloxyApi("YourApiKey")

Java Project Dependency

In case you are using library in Java project and have ParseException's, mostly its Klaxon missing some kotlin dependencies. Try to manually add kotlin stdlib.

Maven

<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
        <version>1.3.10</version> // Or your version
    </dependency>
</dependencies>

Gradle

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.10" // Or your version
}

Custom HttpClient

In case you need to set custom timeout, custom headers or better implementation for HttpClient, just implement IHttpClient by your self or initialize it with your values.

Java

Supplier<IHttpClient> clientSupplier = () -> new HttpClient(10000, 40000);
BloxyApi api = new BloxyApi("YourApiKey", supplier);

Kotlin

val api = BloxyApi("YourApiKey", Supplier { HttpClient(6000, 10000) })

API Examples

Below there are examples for each API module.

You can read about all API available here at Bloxy

Token Api

Get token holders

Java

BloxyApi api = new BloxyApi("YourApiKey");
List<Holder> holders = api.getToken().holders("0xB97048628DB6B661D4C2aA833e95Dbe1A905B280");

Kotlin

val api = BloxyApi("YourApiKey")
val holders = api.token.holders("0xB97048628DB6B661D4C2aA833e95Dbe1A905B280")

Address Api

Get address balance

Java

BloxyApi api = new BloxyApi("YourApiKey");
Balance balance = api.getAddress().balance("0xB97048628DB6B661D4C2aA833e95Dbe1A905B280");

Kotlin

val api = BloxyApi("YourApiKey")
val balance = api.address.balance("0x9eAb08daA285183F9A04269747D4125F08e634B0")

Contract Api

List of smart contract methods and call statistics

Java

BloxyApi api = new BloxyApi("YourApiKey");
Balance balance = api.getContract().methods("0xd26114cd6ee289accf82350c8d8487fedb8a0c07");

Kotlin

val api = BloxyApi("YourApiKey")
val balance = api.contract.methods("0xd26114cd6ee289accf82350c8d8487fedb8a0c07")

DEX Api

Get DEX protocols

Java

BloxyApi api = new BloxyApi("YourApiKey");
List<DexProtocol> protocols = api.getDex().protocols();

Kotlin

val api = BloxyApi("YourApiKey")
val protocols = api.dex.protocols()

Token Sale Api

Lists recent token sale aggregated statistics

Java

BloxyApi api = new BloxyApi("YourApiKey");
List<Sale> sales = api.getTokenSale().sales();

Kotlin

val api = BloxyApi("YourApiKey")
val sales = api.tokenSale.sales()

Money Flow Api

List of all transfers to/from the given address

Java

BloxyApi api = new BloxyApi("YourApiKey");
List<String> addresses = Collections.singletonList("0xC0ea08A2d404d3172d2AdD29A45be56dA40e2949");
List<AddrTransfer> transfers = api.getMoneyFlow().transfersAll(addresses);

Kotlin

val api = BloxyApi("YourApiKey")
val addresses = listOf("0xC0ea08A2d404d3172d2AdD29A45be56dA40e2949")
val result = api.moneyFlow.transfersAll(addresses)

Transaction Api

List of all transfers in the given transaction

Java

BloxyApi api = new BloxyApi("YourApiKey");
List<String> txhashs = Arrays.asList("0x52a9a7dfe6f002b7d7deb5555e356e319839fc4dc280a68de55778524a41f986");
List<TxTransfer> txTransfers = api.getTx().transfers(txhashs);

Kotlin

val api = BloxyApi("YourApiKey")
val txhashs = listOf("0x52a9a7dfe6f002b7d7deb5555e356e319839fc4dc280a68de55778524a41f986")
val transfers = api.tx.transfers(list)

Version History

1.0.2 - Contract API support.

1.0.1 - Gradle/Kotlin dependency publish issue, BasicProvider getOffset fix, HttpClient decoding support, javadoc improvements.

1.0.0 - Initial project with all API functionality, with tests coverage for all cases.

License

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