Skip to content
Java
Branch: master
Clone or download
Latest commit d4e9ebe Aug 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Changed properties, use different binary format. Jul 31, 2019
src Refactor KeyUtils. Aug 12, 2019
README.md Changed properties, use different binary format. Jul 31, 2019
pom.xml Add jlibra-spring-boot-starter with predifined JLibra instance. Jul 24, 2019

README.md

jlibra Spring Boot Starter

Integrate jlibra into your Spring Boot applications via Spring's dependency injection and Spring Boots external configuration and Actuator functionality.
This is basically a copy with search/replace of web3j-spring-boot-starter

Usage

The jlibra-spring-boot-starter project enables other (Spring Boot) applications, like web applications, shell applications, and more, to use the jlibra library.

As a sample for this usage the java-libra-cli application was created.

To use, create a new Spring Boot Application, and include the following dependencies:

Maven:

<dependency>
    <groupId>dev.jlibra</groupId>
    <artifactId>jlibra-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle:

compile ('dev.jlibra:jlibra-spring-boot-starter:1.0.0')

Now Spring can inject jlibra instances for you where ever you need them:

@Autowired
private JLibra jlibra;

The JLibra class is initialized with the values configured according to externalized configuration in Spring.
For example, add the configuration values to a file application.properties next to the runnable jar.

jlibra.service-url=ad.testnet.libra.org
jlibra.service-port=8000
jlibra.faucet-url=faucet.testnet.libra.org
jlibra.faucet-port=80
jlibra.gas-unit-price=5
jlibra.max-gas-amount=600000

Predefined Actions

There are currently two predefined actions in the action package.

  • AccountStateQuery
  • PeerToPeerTransfer

These actions can just be @Autowired and are preconfigured as well, so you don't have to deal with jlibra directly.
This is WIP and other actions will be added soon.

@Autowired
private PeerToPeerTransfer peerToPeerTransfer

public void transfer(...) {
	peerToPeerTransfer.transfer(...);
}

Further information

For further information on jlibra, please refer to the jlibra GitHub.

You can’t perform that action at this time.