Expand description
Exact decimal amounts: ZEC ↔ zatoshi and dollars ↔ token base units, without floating point.
Constants§
- ZAT_
PER_ ZEC - Zatoshi per ZEC.
Functions§
- exact
- Token base units as an exact decimal string (
4975000→"4.975"for 6 decimals). - parse_
decimal - Parses a non-negative decimal (
"0.1","25","1.000001") into base units withdecimalsdigits. Refuses signs, exponents, empty parts and more fractional digits thandecimals. - parse_
usd - Parses an amount of dollars into token base units with
decimalsdigits (more than zero). - parse_
zec - Parses an amount of ZEC into zatoshi (more than zero).
- usd
- Token base units as dollars with two decimals, rounded down (
4975000→"4.97"for 6 decimals). - zec
- Zatoshi as ZEC, without trailing zeros (
10000000→"0.1").