nealsun / jlibra

A Java library for building applications on Libra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JLibra

GitHub Actions - Build Codacy Badge Known Vulnerabilities Maven Central

A Java library for building applications on Libra

The API for creating transactions and querying the database of Libra uses json-rpc - a simple remote procedure call protocol utilizing JSON for encoding data. Sending new transactions to the Libra network requires also another type of serialization - the Libra Canonical Serialization. JLibra implements both of these and provides a simple api for Java applications to integrate to Libra.

JLibra simplifies integration to Libra but does not hide any features of the Libra api, this makes it possible to implement anything supported by Libra with Java.

Prerequisites

  • JDK 8+
  • Maven 3+

Setup

  • Clone this repo
  • Build project with mvn install (this is important because the project contains classes that will be created during the Maven build and simply checking the project out is not enough)

Try the examples

Start sample Main classes in dev.jlibra.example package for examples (for a complete example with creating accounts to moving coins between them check the how to)

GenerateKeysExample

GetAccountStateExample

GetAccountTransactionBySequenceNumberExample

GetEventsByEventKeyExample

GetTransactionsExample

ImportAccountMnemonicExample

KeyRotationExample

MintExample

TransferExample

TransferWithMetadataExample

Use JLibra in your project

Versions of JLibra are deployed to the Central Maven repository, you can add JLibra as a dependency to your project:

Maven:

<dependency>
  <groupId>dev.jlibra</groupId>
  <artifactId>jlibra-core</artifactId>
  <version>0.9.0</version>
</dependency>

Gradle:

compile("dev.jlibra:jlibra-core:0.9.0")

How-Tos & Step-by-Step Guides

How-Tos and Step-by-Step Guides are gathered in a separate document.

Known Issues

Transaction is not executed, but without errors (no events, no transaction in librabrowser.io)

  1. You might have specified too few gas.
  • Try increasing maxGasAmount.

Contributors

Projects using JLibra

About

A Java library for building applications on Libra

License:Apache License 2.0


Languages

Language:Java 100.0%