-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide helpers for converting units #22
Comments
I can't seem to find a helper function for converting amounts to zero-filled hex. I know this is trivial to do, but was thinking since this library is also useful to those who would be making blocks, exporting the helper function _convertAmountDecimalIntegerToHex would probably not be a bad idea? |
Just wondering, what's the point of creating the block yourself when you can use https://github.com/marvinroger/nanocurrency-js/blob/develop/DOCUMENTATION.md#nanocurrencycreateopenblocksecretkey-data--object ? |
Wasn't aware that the method didn't do PoW. Thanks for letting me know. Usually when I see a create block method, it's always with PoW included. |
Even if it is kind of optimized with the WebAssembly, it's still very expensive (time-speaking) to compute a PoW, so the library does not compute one when you create a block, you'll have to provide it yourself. Another reason is that you might already have a PoW precomputed in cache, so you can pass it. |
@kilkelly considering you've 馃憤 this issue, and you're the author of nano-prettify, would you mind if I reuse some of your code? With the proper copyright notice, obviously! |
Sure thing @marvinroger , just include the MIT license and it's cool. Alternatively link it as a package to receive future bug fixes. The choice is completely up to you 馃挴 |
@kilkelly there was some limitation with your code (we can only convert raw to another unit, not the other way around) and the prettify part is out of scope for this library (Numeral.js does it best), so I ended up coding the convert code myself: https://github.com/marvinroger/nanocurrency-js/blob/a7e66ab50301644fff60444a6dc784f7c5a8bb41/src/conversion.js Thanks for the permission, though. 馃槈 |
No worries, it was only ever intended to be a raw to unit one-way conversion. Your code looks good, will give it a try soon. |
The goal of the library is to contain everything needed to deal with the Nano currency. We should add helpers to convert units (Nano, nano, raw, NANO...).
Please vote 馃憤 if this is important to you.
The text was updated successfully, but these errors were encountered: