adyliu / jeos

EOS Blockchain Java SDK
https://github.com/adyliu/jeos
71 stars 38 forks source link

offline transfer report error #3

Open liuzhijun23 opened 5 years ago

liuzhijun23 commented 5 years ago

I use the offline transfer function,the code as follow: `static void transferOffline() throws Exception{ // --- get the current state of blockchain EosApi eosApi = EosApiFactory.create("http://192.168.1.75:8888"); SignArg arg = eosApi.getSignArg(120); System.out.println(eosApi.getObjectMapper().writeValueAsString(arg));

    // --- sign the transation of token tansfer
    String privateKey = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3";//replace the real private key
    String from1 = "acca";
    String to1 = "accb";
    String quantity = "100 SYS";
    String memo = "sent by eos sdk";
    LocalApi localApi = EosApiFactory.createLocalApi();
    PushTransactionRequest req = localApi.transfer(arg, privateKey, from1, to1, quantity, memo);
    System.out.println(localApi.getObjectMapper().writeValueAsString(req));

    // --- push the signed-transaction to the blockchain
    PushedTransaction pts = eosApi.pushTransaction(req);
    System.out.println(localApi.getObjectMapper().writeValueAsString(pts));
}`

But it report error as follow: Exception in thread "main" io.jafka.jeos.exception.EosApiException: Internal Service Error: eosio_assert_message assertion failure at io.jafka.jeos.impl.EosApiServiceGenerator.executeSync(EosApiServiceGenerator.java:61) at io.jafka.jeos.impl.EosApiRestClientImpl.pushTransaction(EosApiRestClientImpl.java:131) at org.web3j.sample.TestEOS.transferOffline(TestEOS.java:129) at org.web3j.sample.TestEOS.main(TestEOS.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

I can use offline transfer function with another SDK eos4j-1.0.2.jar.I think there are something wrong with
this SDK.Please help!

liuzhijun23 commented 5 years ago

I find the reason now.The error is because I pass the quantity string "100 SYS",the quantity string should be "100.0000 SYS".