jsonrpc4j : I am using jsonrpc4j Java lib to issue the asset

+1 vote
Hi , I am using jsonrpc4j Java lib to issue the asses I am able to issue asset without Details but when I am trying to add details it's not working , Do you have any idea ?

Below is working ( without details )

JsonRpcHttpClient client = new JsonRpcHttpClient(   new URL("http://192.168.0.172:6742/"));
  Object  info = client.invoke("issue", new Object[] { "1DTvYE5AkWRTMairZwhtwJZuoMfEdD2UGKu4kH",   "usd",   50000,   0.01, 100 }, Object.class);

but when i am adding array for details it is giving invalid amount error.

JsonRpcHttpClient client = new JsonRpcHttpClient(   new URL("http://192.168.0.172:6742/"));
   Object[] array1 =  {"Hello:Details"};
     
         Object  info = client.invoke("issue", new Object[] { "1DTvYE5AkWRTMairZwhtwJZuoMfEdD2UGKu4kH",   "usd",   50000,   0.01, 100, array1   }, Object.class);
asked Jul 25, 2016 by Vikas

1 Answer

0 votes

I don't know enough about this Java library but it seems like you need to create a key-value object to pass, rather than a single string with a colon inside. You can try debugging the JSON-RPC data sent in the HTTP request payload, and comparing it to the first line output by multichain-cli.

answered Jul 27, 2016 by MultiChain
I can elaborate on this. Although I'm using a different library I believe the same would apply. You can pass a LinkedHashMap containing the key-value pair. In this case you would have a LinkedHashMap<String,String> and have the key as "details" and the value as what you want the detail to be (hello). In instances where you get multiple key-value pairs then these are returned as an Arraylist of LinkedHashMaps. Hope this helps!
...