⚙️
Bloxy Api
Kotlin & Java Library for all available Bloxy API endpoints.
Bloxy.info is a source of open, reliable, verifiable and objective data about the blockchain.
Dependency
🚀
Library depends on Klaxon so jcenter repository is required.
Gradle
repositories {
jcenter()
}
dependencies {
compile 'com.github.goodforgod:bloxy-api:1.2.1'
}
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.2.1</version>
</dependency>
</dependencies>
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.31</version> // Or your version
</dependency>
</dependencies>
Gradle
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31" // 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> supplier = () -> new HttpClient(10000, 40000);
BloxyApi api = new BloxyApi("YourApiKey", supplier);
Kotlin
val supplier = Supplier { HttpClient(10000, 40000) }
val api = BloxyApi("YourApiKey", supplier)
API Modules
Library supports all API modules with all endpoints support for each module:
- Address
- DApp
- MakerDAO
- Smart Contract
- DEX
- Money Flow
- Token
- Tokensale
- dYdX
- Livepeer
- Transaction
- Maltego
API Examples
Below there are examples for some API modules.
You can read about all API available here at Bloxy
Smart Contract Api
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
Java
BloxyApi api = new BloxyApi("YourApiKey");
List<DexProtocol> protocols = api.getDex().protocols();
Kotlin
val api = BloxyApi("YourApiKey")
val protocols = api.dex.protocols()
DApp Api
Java
BloxyApi api = new BloxyApi("YourApiKey");
List<DAppStats> appStats = api.getDapp().statistics();
Kotlin
val api = BloxyApi("YourApiKey")
val appStats = api.dapp.statistics()
Version History
1.2.1 - Base URL for API changed.
1.2.0 - Token, Contract new endpoints introduced.
1.1.0 - Address, Transaction, Dex, Token, MoneyFlow, TokenSale APIs enchanted, tests were reinforced
1.0.4 - Livepeer & dYdY & Maltego API modules support.
1.0.3 - DApp, MakerDAO API support & Address API extension support.
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.