Git Product home page Git Product logo

polkaj's Introduction

PolkaJ - Polkadot Java Client

Unit Tests Coverage License Gitter

Java client library to use and access API of Polkadot based networks.

Warning
UNDER DEVELOPMENT
  • Latest Stable Version: 0.3.0

  • Latest Snapshot Version: 0.5.0-SNAPSHOT

Modules

  • io.emeraldpay.polkaj:polkaj-scale:0.3.0 - SCALE codec implementation

  • io.emeraldpay.polkaj:polkaj-scale-types:0.3.0 - SCALE mapping for standard Polkadot types

  • io.emeraldpay.polkaj:polkaj-schnorrkel:0.3.0 - Schnorrkel for Java

  • io.emeraldpay.polkaj:polkaj-ss58:0.3.0 - SS58 codec to encode/decode addresses and pubkeys

  • io.emeraldpay.polkaj:polkaj-common-types:0.3.0 - common types (Address, DotAmount, Hash256, etc)

  • io.emeraldpay.polkaj:polkaj-json-types:0.3.0 - JSON RPC mapping to Java classes

  • io.emeraldpay.polkaj:polkaj-api-base:0.3.0 - RPC base classes

  • io.emeraldpay.polkaj:polkaj-api-http:0.3.0 - JSON RPC HTTP client

  • io.emeraldpay.polkaj:polkaj-api-ws:0.3.0 - JSON RPC WebSocket client

  • io.emeraldpay.polkaj:polkaj-tx:0.3.0 - Storage access and Extrinsics

Usage

To use development SNAPSHOT versions you need to install the library into the local Maven repository.

Install into local Maven
gradle install
Using with Gradle
repositories {
   // polkaj public repo
   maven { url  "https://dl.bintray.com/emerald/polkaj" }
   // required for com.github.multiformats:java-multibase library
   maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'io.emeraldpay.polkaj:polkaj-api-http:0.3.0'
}

Documentation

See Documentation in ./docs directory, and a demonstration in ./examples.

Example

Show current finalized block
PolkadotHttpApi client = PolkadotApi.newBuilder()
    .rpcCallAdapter(JavaHttpAdapter.newBuilder().build())
    .build();
Future<Hash256> hashFuture = client.execute(
        PolkadotApi.commands().getFinalizedHead()
);

Hash256 hash = hashFuture.get();
System.out.println("Current head: " + hash);

Future<BlockResponseJson> blockFuture = client.execute(
        PolkadotApi.commands().getBlock(hash)
);

BlockResponseJson block = blockFuture.get();
System.out.println("Current height: " + block.getBlock().getHeader().getNumber());
System.out.println("State hash: " + block.getBlock().getHeader().getStateRoot());


client.close();

License

The core project code is released under Apache 2.0 license.

Examples and docs are published under CC0 license + additionally Apache 2.0 for code parts in the examples.

polkaj's People

Contributors

alexey-n-chernyshov avatar gianinbasler avatar mmagician avatar nschwermann avatar pablojorge avatar paulvi avatar splix avatar

Watchers

 avatar

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.