No description or website provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
secp256k1
src/main/java
.gitignore
README.md
build.sh
build.xml
dispatch-labs-java-sdk.iml
pom.xml

README.md

Dispatch Labs Java SDK

Prerequisites

  • Java 1.8 or higher
  • Maven 3.5.0 or higher

Setup and Run

  • git clone https://github.com/dispatchlabs/java-sdk.git
  • cd java-sdk
  • build.sh
  • Make sure to set -Djava.library.path=...secp256k1/.libs

Sample

        System.out.println("Dispatch Labs SDK Example");
        try {
            Sdk sdk = new Sdk("10.0.1.2");
            List<Contact> contacts = sdk.getDelegates();
            Account fromAccount = sdk.createAccount();
            Account toAccount = sdk.createAccount();
            Receipt receipt = sdk.transferTokens(contacts.get(0), fromAccount, toAccount, 45);
            System.out.println(receipt.getStatus());

            // Pending?
            while ((receipt = sdk.getLastStatus()).getStatus().equals(Receipt.Status.PENDING)) {
                Thread.sleep(100);
            }
            System.out.println(receipt.getStatus());

            // Get transactions.
            List<Transaction> transactions = sdk.getTransactions(contacts.get(0));
            System.out.println(transactions);
        } catch (Throwable t) {
            System.out.println(t);
        }