Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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.

About

JNano Client is the first Java RPC client which allows you to create and sign transactions in the client side.

Topics

Resources

License

Packages

No packages published

Languages