Preserving amounts across the interface
The application handled USD and KHR in the same account and transfer workflows, with different display rules: two decimal places for USD and whole amounts for KHR. Large balances also needed to remain readable without changing the digits received from the API.
I changed the balance representations in account adapters and transfer components from numbers to strings, and rewrote the formatting helper to apply the currency’s grouping and precision rules to that representation. The change had to reach the component contracts as well as the formatter; otherwise, a balance could be handled differently depending on which screen displayed it.
Regression tests covered both currencies and included a value with 26 digits. Those cases made the expected representation explicit when the formatting code changed.


