fix: show balances and fees below 0.000001 as nonzero on the send screens (closes #343)
check / check (push) Successful in 2m28s
e2e / e2e-chrome (push) Successful in 3m15s
e2e / e2e-firefox (push) Successful in 2m38s

The stored ETH and token balances and the send-confirm screen's fee were each
cut to six decimal places, so a value below 0.000001 read as zero. Balances are
now stored exactly; a token declaring more than 18 decimals is cut to 18, the
most the balance check reads. A token holding below 0.000001 is still left off
the lists as dust, except for a token the user tracks, whose holding now
reaches the Send screen and is what the send is checked against. The send and
send-confirm screens' balances, reserve and insufficient-balance messages go
through truncateAmountNeverZero(). The send-confirm and approval screens both
render the fee through formatFee(), which prices the exact fee in USD. The
balance lists still round with toFixed(4).

Model: opus-5-5
This commit is contained in:
2026-10-04 04:45:02 +00:00
committed by sneak
parent 49a7da87e8
commit 090a5e785c
10 changed files with 494 additions and 82 deletions
+15
View File
@@ -45,6 +45,21 @@ but the review is broader than any of them.
# Completed Steps
- 2026-10-04: The Send and confirmation screens no longer show an ETH balance, a
token balance or a network fee below 0.000001 as zero
([#343](https://git.eeqj.de/sneak/AutistMask/issues/343)). The stored balances
(`src/shared/balances.js`) and the confirmation screen's fee were each cut to
six decimal places by a rule of their own. Balances are now stored exactly,
except that a token declaring more than 18 decimals is stored to 18, the most
the balance check reads. A token holding below 0.000001 is still not listed,
but only for a token the user does not track, so a tracked token's holding
reaches the Send screen and the send is checked against it. The Send screen's
`Current balance`, and the confirmation screen's balance, fee, reserve and
insufficient-balance messages, go through `truncateAmountNeverZero()` in
`src/shared/amountDisplay.js`, the helper the approval screen already used.
The confirmation and approval screens both render the fee through
`formatFee()` in `src/popup/views/helpers.js`, which prices the exact fee in
USD, so the same fee reads the same on both, USD value included.
- 2026-10-04: Settings lists the sites connected without "Remember", and
removing a site there disconnects it
([#406](https://git.eeqj.de/sneak/AutistMask/issues/406)). Such a connection