koczadly / jNano

A comprehensive Java library for the Nano cryptocurrency.
MIT License
30 stars 6 forks source link

Update NanoAmount/NanoUnit friendly amount to support new currency symbol Ӿ #12

Open bwebster4 opened 2 years ago

bwebster4 commented 2 years ago

Currently, when calling toString() on a NanoAmount, it produces something like "1 NANO". I am proposing that it should now return something more along the lines of "Ӿ1" or "Ӿ 1". This should be a pretty easy change, but it does require some awkwardness around appending or prepending the unit description.

In my opinion, NanoUnit needs a more general update to reflect the move away from the terms Gnano, NANO, knano, nano, mnano, etc. These days, there are just two common denominations, nano and raw. NANO, Nano, and nano mean the same thing now. I think we could get rid of these other denominations, and just use nano and raw. And then if nano, prepend "Ӿ", and if raw append "raw". Alternatively, it might be best to just leave off any sort of label, and leave that up to the user of the library.

I'd be happy to work on this myself and make a pull request. If work on this is already begun, please let me know, and if anyone has opinions on this I'd be happy to hear them.

koczadly commented 2 years ago

Thanks for submitting an issue! No need to make the change yourself, I've actually already done this months back (albeit on a local branch). The older units have also been deprecated, but kept for backwards compatibility.

I'll try push them all to a dev branch for the time being, but I still have a few things I wanna figure out before I release a new version, I've got a bunch of local changes stacked up - I'm trying to bundle as many (possibly breaking) changes all at once for version 3, and hopefully segment the library into different lightweight maven artifacts while I'm at it.

koczadly commented 2 years ago

If I'm gonna make a bunch of breaking changes I'll probably just remove the deprecated enums, and rename MEGA to NANO.

bwebster4 commented 2 years ago

Awesome, looking forward to that update! Thanks for your work on this library.

koczadly commented 2 years ago

No worries at all bro! If you have any suggestions or criticisms of it in it's current state, please do let me know! I'm always looking to improve, and this will probably be the last set of breaking changes I do given that many other projects are now dependant on this library.