JNano Client

JNano Client is the first Java RPC client which allows you to fully manage yours keys localy. Together with JNano Commons you will have all needed operations to create a light wallet without the need to dig in Nano implementation and focus more in delivery new awesome features.

License

License

Categories

Categories

CLI User Interface JNA Development Tools Native
GroupId

GroupId

com.rotilho.jnano
ArtifactId

ArtifactId

jnano-client
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

JNano Client
JNano Client is the first Java RPC client which allows you to fully manage yours keys localy. Together with JNano Commons you will have all needed operations to create a light wallet without the need to dig in Nano implementation and focus more in delivery new awesome features.
Project URL

Project URL

https://github.com/rotilho/jnano-client
Source Code Management

Source Code Management

https://github.com/rotilho/jnano-client

Download jnano-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.rotilho.jnano/jnano-client/ -->
<dependency>
    <groupId>com.rotilho.jnano</groupId>
    <artifactId>jnano-client</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.rotilho.jnano/jnano-client/
implementation 'com.rotilho.jnano:jnano-client:1.1.2'
// https://jarcasting.com/artifacts/com.rotilho.jnano/jnano-client/
implementation ("com.rotilho.jnano:jnano-client:1.1.2")
'com.rotilho.jnano:jnano-client:jar:1.1.2'
<dependency org="com.rotilho.jnano" name="jnano-client" rev="1.1.2">
  <artifact name="jnano-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.rotilho.jnano', module='jnano-client', version='1.1.2')
)
libraryDependencies += "com.rotilho.jnano" % "jnano-client" % "1.1.2"
[com.rotilho.jnano/jnano-client "1.1.2"]

Dependencies

compile (4)

Group / Artifact Type Version
com.rotilho.jnano : jnano-commons jar 1.5.0
com.squareup.okhttp3 : okhttp jar 3.11.0
com.fasterxml.jackson.core : jackson-databind jar 2.9.7
com.fasterxml.jackson.module : jackson-module-parameter-names jar 2.9.7

test (4)

Group / Artifact Type Version
junit : junit jar 4.12
org.skyscreamer : jsonassert jar 1.5.0
org.mockito : mockito-core jar 2.18.3
com.github.tomakehurst : wiremock jar 2.17.0

Project Modules

There are no modules declared in this project.

Build Status Codacy Badge Codacy Badge Maven Central

JNano Client

JNano Client is the first Java RPC client which allows you to fully manage yours keys localy. Together with JNano Commons you will have all needed operations to create a light wallet without the need to dig in Nano implementation and focus more in delivery new awesome features.

JNano Client is complience with external key management.

How to use it?

First, take a look in JNano Commons. It will provide you basic knowledge about low level operations.

Gradle compile 'com.rotilho.jnano:jnano-client:1.1.2

Maven

<dependency>
    <groupId>com.rotilho.jnano</groupId>
    <artifactId>jnano-client</artifactId>
    <version>1.1.2</version>
</dependency>

Sample

NanoAPI nanoAPI = NanoAPI.builder().endpoint("http://my-wallet").build();
NanoAccountOperations accountOperations = NanoAccountOperations.of(NanoBaseAccountType.NANO, nanoAPI);

Optional<NanoAccountInfo> info = accountOperations.getInfo(account);
info.ifPresent(i-> log.info(i));

// Work may take several seconds, better have higher timeout
NanoAPI workNanoAPI = NanoAPI.builder().endpoint("http://my-wallet").readTimeoutMillis(100_000).build();
NanoWorkOperations workOperations = NanoRemoteWorkOperations.of(workNanoAPI);

NanoTransactionOperations transactionOperations = NanoTransactionOperations.of(NanoBaseAccountType.NANO, api, accountOperations, workOperations);

List<NanoTransaction<NanoStateBlock>> transactions = transactionOperations.receive(privateKey);
transactions.forEach(t -> log.info(t));

All classes are thread safe and can be used as singleton

How to cache work?

The possibility to pre-cache the work give to the user a nice user experience and one of the main fatures which make Nano be almost instant.

To pre-cache work you need to just wrap a NanoWorkOperations with NanoCachedWorkOperations

NanoCachedWorkOperations workOperations = NanoCachedWorkOperations.of(NanoRemoteWorkOperations.of(workNanoAPI));

// Now after finish to process a transaction you can simpltly call NanoCachedWorkOperations to pre-calculated the work
workOperations.cache(newTransaction.getHash())

Missing feature?

If you notice a missing feature let me know and I'll try to do my best to implement ASAP.

Just keep in mind that I don't plan to support any wallet RPC method, they are not going to exist for too long.

Versions

Version
1.1.2
1.1.1
1.1.0
1.0.0