koczadly / jnano Goto Github PK
View Code? Open in Web Editor NEWA comprehensive Java library for the Nano cryptocurrency.
License: MIT License
A comprehensive Java library for the Nano cryptocurrency.
License: MIT License
Every time i try to make a request to the rpc, the program crashes with this error. Example:
RpcQueryNode rpc = RpcServiceProviders.nanex(); RequestAccountBalance req = new RequestAccountBalance("nano_34qjpc8t1u6wnb584pc4iwsukwa8jhrobpx4oea5gbaitnqafm6qsgoacpiz"); ResponseBalance response = rpc.processRequest(req);
Hi, nice work here encapsulating the API, couple thoughts -
Just looking through the docs and tests but couldn't find an easy example for how to properly construct a Send or Receive block and publish it. We can look up Nano docs and use that as a guide, but it would be nice to have a simple api or some quick examples, as from what I recall the block requirements/structure can be tricky and can change over time.
It would also be nice to have the low level block construction abstracted away so the api user would only need to provide a few basic details - construct a wallet from address/seed, then Send() from the wallet to a target address a given amount.
Lastly is nanex.cc (the one in example) rpc node still usable?
I get this error every now and again when processing a request.
The request is to generate work. What causes it?
Thanks,
Letskingit
Currently, when calling toString()
on a NanoAmount, it produces something like "1 NANO". I am proposing that it should now return something more along the lines of "Ӿ1" or "Ӿ 1". This should be a pretty easy change, but it does require some awkwardness around appending or prepending the unit description.
In my opinion, NanoUnit needs a more general update to reflect the move away from the terms Gnano, NANO, knano, nano, mnano, etc. These days, there are just two common denominations, nano and raw. NANO, Nano, and nano mean the same thing now. I think we could get rid of these other denominations, and just use nano and raw. And then if nano, prepend "Ӿ", and if raw append "raw". Alternatively, it might be best to just leave off any sort of label, and leave that up to the user of the library.
I'd be happy to work on this myself and make a pull request. If work on this is already begun, please let me know, and if anyone has opinions on this I'd be happy to hear them.
java.lang.IllegalArgumentException: class uk.oczadly.karl.jnano.rpc.request.wallet.RequestAccountCreate declares multiple JSON fields named work
Thats what I am getting while attempting your example.
public void receiveAll(int bananoAmountThreshold)
{
try
{
WorkDifficultyPolicy banano = NetworkConstants.BANANO.getWorkDifficulties();
WorkGenerator workGenerator = new CPUWorkGenerator(banano);
BlockProducer blockProducer = new StateBlockProducer
(
BlockProducerSpecification.builder()
.defaultRepresentative("ban_1ka1ium4pfue3uxtntqsrib8mumxgazsjf58gidh1xeo5te3whsq8z476goo")
.workGenerator(workGenerator) // Generate work on the node
.build()
);
LocalRpcWalletAccount account = new LocalRpcWalletAccount(privateKey, Banano.KaliumRPC, blockProducer);
BigDecimal bigDecimal = new BigDecimal(bananoAmountThreshold*0.1).setScale(1,RoundingMode.DOWN);
Bukkit.getLogger().warning(bigDecimal.toString());
NanoAmount amount = NanoAmount.valueOfNano(bigDecimal);
account.receiveAll(amount);
}
catch(WalletActionException e) { e.printStackTrace(); }
}
It probably is because i'm trying to generate a banano block instead of a nano block, but i don't know what to change to make it work for banano (Except for the WorkDifficulty)
Hey again,
I am getting the error shown in the title within this code block(on the processRequest line) code:
String seed = 978B57EDDE3DA88D97930A1B58082920A2A496B5BF3F6085F4EFF3AB0411942C;
RequestAccountCreate request = new RequestAccountCreate(seed);
ResponseAccount response = node.processRequest(request); //error caught here
accountAddress = response.getAccountAddress();
What do I need to do?
Heres some free nano for your help - (awesome tipping service for nano) https://heytip.me/?claim=puqwv4935
Cheers
Hello!
I'm getting a 500 server error with pippin on creating an account.
Was wondering if you could make jnano more compatible with pippin.
Java log:
java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:11338
Pippin log:
raise ValueError ('badly formed hexadecimal UUID string')
Error is raised on RequestAccountCreate
Notes about pippin:
APIs that are different between Pippin and the Nano node wallet.
account_list accepts a count parameter that defaults to 1000
Pippin has an auto_receive_on_send option that will automatically receive pending blocks when you do a send, it will only do this if balance isnt high enough to make the transaction.
account_create does not accept an index
Thanks.
I know you can request receive transactions for a specific account but there a few steps involved. It would be great to have something like:
RequestReceive(walletId, account) to receive all pending transactions for the account specified.
Cheers,
Mat
uk.oczadly.karl.jnano.model.block.BlockDeserializer$BlockParseException: Could not parse block (malformed json?).
at uk.oczadly.karl.jnano.model.block.BlockDeserializer.deserialize(BlockDeserializer.java:105)
at uk.oczadly.karl.jnano.model.block.BlockDeserializer$JsonAdapter.deserialize(BlockDeserializer.java:174)
at uk.oczadly.karl.jnano.model.block.BlockDeserializer$JsonAdapter.deserialize(BlockDeserializer.java:144)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69)
at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
at com.google.gson.Gson.fromJson(Gson.java:932)
at com.google.gson.Gson.fromJson(Gson.java:1003)
at com.google.gson.Gson.fromJson(Gson.java:975)
at uk.oczadly.karl.jnano.callback.BlockCallbackServer$HttpCallbackProcessor.onRequest(BlockCallbackServer.java:129)
at uk.oczadly.karl.jnano.callback.httpserver.HttpRequestHandler.run(HttpRequestHandler.java:67)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:851)
Caused by: java.lang.IllegalArgumentException: Subtype cannot be null.
at uk.oczadly.karl.jnano.model.block.StateBlock.(StateBlock.java:154)
at uk.oczadly.karl.jnano.model.block.StateBlock.lambda$static$0(StateBlock.java:40)
at uk.oczadly.karl.jnano.model.block.StateBlock$$Lambda$108/0000000000000000.apply(Unknown Source)
at uk.oczadly.karl.jnano.model.block.BlockDeserializer.deserialize(BlockDeserializer.java:103)
Using version: 2.8.0-V21.2
Using the latest nano node version as well.
Not really sure what causes this error and need some guidance on this.
Thanks!
close
As just said, I wanna know did you processed keepalive and Reconnect ?
RpcWalletSpecification can't be imported in the latest version. Reverting back to 2.19.1 works.
Haven't really looked into too much detail as to why this is happening, I just know that 2.20 broke RpcWalletSpecification for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.