stellar / js-stellar-base

The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr
https://stellar.github.io/js-stellar-base/
Apache License 2.0
108 stars 137 forks source link

Add utilities for formatting token amounts (`formatTokenAmount` and `parseTokenAmount`) #667

Closed jeesunikim closed 1 year ago

jeesunikim commented 1 year ago

Summary:

Shaptic commented 1 year ago

I'm confused about why CI isn't running :raised_eyebrow:

aristidesstaffieri commented 1 year ago

btw the original inspiration for these is here and they do some extra stuff that we don't like work with negative values so maybe worth discussing? Ours have worked for all of our use cases so far but they may get used differently as part of the sdk.

Shaptic commented 1 year ago

@aristidesstaffieri thanks for the ref! we should steal their (non-negative) test cases, then. I think the usage aligns (besides multiplier, which I don't understand).

Btw, a lot of the code comments in this review I'd make there, too, but I bet theirs was written before e.g. .padEnd or ?? support was common in JS.

aristidesstaffieri commented 1 year ago

I'm confused about why CI isn't running 🤨

Github is having issues, probably related https://www.githubstatus.com/incidents/nwb8m3ppfxw6

github-actions[bot] commented 1 year ago

Size Change: +50.6 kB (+2%)

Total Size: 3.13 MB

Filename Size Change
dist/stellar-base.js 2.3 MB +36.8 kB (+2%)
dist/stellar-base.min.js 834 kB +13.7 kB (+2%)

compressed-size-action