BitShares Forum

Main => Technical Support => Topic started by: maverica on April 18, 2015, 10:41:48 pm

Title: RPC wallet_account_balance gives number without a decimal point
Post by: maverica on April 18, 2015, 10:41:48 pm
Hello,

I'm making a small app and using jsonRPCClient PHP library to post balance request about my open wallet in bitshares client. The balance I get is something of ten digits 1234567890, whether this balance is 12.34567890 or 12345.67890 I cant distinguish from the result that the API is returning. The command I am using is wallet_account_balance. Currently im modifying the string but that is not such a good idea if the decimal point changes position. Any idea on how to get a real number?

Thanks
Title: Re: RPC wallet_account_balance gives number without a decimal point
Post by: monsterer on April 18, 2015, 11:15:00 pm
Call get_asset on the asset that you have a balance for and inside the returned data is a precision variable which you can then divide your ulong by to get the actual real number.
Title: Re: RPC wallet_account_balance gives number without a decimal point
Post by: maverica on April 19, 2015, 07:44:10 am
That worked - thanks!