I have a problem using the java api.

+1 vote
hello~ i'm minsoonss

i have a question 'sendtoaddress' of java api

my source code~

i have an error

code -1

message : value is type str expected real

@RequestMapping(value = "/sendtoaddress", method = RequestMethod.GET)

public void sendtoaddress(

@RequestParam ("address") String address,

@RequestParam ("amount")  double amount) {

connectionMaker = new ConnectionMaker();

multiChainCommand = connectionMaker.getconnect();

String result = "";

try {

result = multiChainCommand.getWalletTransactionCommand().SendToAddress(address, amount);

} catch (MultichainException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

what's the problem
asked Aug 4, 2017 by minsoonss

1 Answer

0 votes

We didn't develop the Java API ourselves but it sounds like you're not passing a number for the amount field of the request but instead some kind of string.

answered Aug 5, 2017 by MultiChain
However, the 'parameter' of 'sendtoaddress' in a multichain is defined as a string and a real number
That API, like many others, has more than one parameter. You need to pass a string (for the address) AND a number (for the amount).
umm...
If you look at my source code above, you'll see that 'address' is a string and 'amount' is a real number. What's the problem?
OK, sorry about that. We can't see anything immediately wrong with what you're doing, so it's worth contacting the creator of the Java library to see if he can help.
...