features/wallet/zat_format library

Money formatting for ZEC amounts — INTEGER MATH ONLY.

A zatoshi is 1e-8 ZEC. Balances cross the bridge as i64 zatoshis (Dart int, 64-bit on every supported host — web is out of scope for this SDK, README § Building). Formatting NEVER routes through double: IEEE-754 cannot represent most decimal ZEC values exactly, so a float path silently mis-renders a balance — unacceptable for money. Max ZEC supply (~21e6 ZEC ⇒ ~2.1e15 zat) is well inside int64, so plain integer division is exact.

Constants

zatPerZec → const int
Zatoshis per ZEC (1e8). The one place this constant lives.

Functions

formatZec(int zat) → String
Format a zatoshi amount as a ZEC decimal string WITHOUT a unit suffix (the caller appends a localized unit). Trailing fractional zeros are trimmed; a whole amount renders with no decimal point. Negative inputs (signed net amounts in history) keep their sign.