kleros / kleros-juror-front

The front end for Kleros jurors.
MIT License
8 stars 5 forks source link

Solve the not being able to transfer error. #134

Closed clesaege closed 6 years ago

clesaege commented 6 years ago

Hi, I tried to transfer the amount provided by the interface "504041,44934273383" and got this error errortransfer Removing one decimal fixes the issue.

epiqueras commented 6 years ago

@satello API error?

clesaege commented 6 years ago

Another user with the issue: https://youtu.be/jji4YGgN1Z4

stefek99 commented 6 years ago

While you are at it...

image

Left miniscule amount and formatting is odd.

2.9143354e-11.toFixed(18)

satello commented 6 years ago

It looks like the issue is when converting from a BigNumber to a float you only get 9 significant digits and by default it does standard rounding (up at 5+). So if you have 1.66666... PNK it will be converted to 1.666666667. I am going to take out the conversions in the API so the front end can convert for display purposes but all passed values will be integers

0xferit commented 6 years ago

Is it necessary to convert to float? Why not do calculations using big number library and when needs to be displayed convert it to string. Same way string input can be parsed to a big number.

satello commented 6 years ago

True that would be a simpler fix for now, and we don't have need of floats. The front end isn't making any calculations so it can just use strings. I do think it makes sense for the API to return BigNumbers instead of strings in the future and have the front ends convert to whatever form they need

epiqueras commented 6 years ago

Everything should stay in BN, everywhere. Only convert to strings for rendering. On Tue, Aug 28, 2018 at 8:53 AM Sam Vitello notifications@github.com wrote:

True that would be a simpler fix for now. The front end isn't making any calculations so it can just use strings. I do think it makes sense for the API to return BigNumbers instead of strings in the future and have the front ends convert to whatever form they need

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kleros/kleros-juror-front/issues/134#issuecomment-416592158, or mute the thread https://github.com/notifications/unsubscribe-auth/ASRQaFTgtzZCCNORqr6QXsqZtYjHew53ks5uVUs8gaJpZM4WKOc- .