Skip to content

fix(wallet): trim exposed zeros in full-balance tooltips - #1012

Merged
fathah merged 8 commits into
mainfrom
codex/docs-pr-976-balance-formatting
Oct 11, 2026
Merged

fathah merged 8 commits into
mainfrom
codex/docs-pr-976-balance-formatting

Conversation

@fathah

@fathah fathah commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Full-balance tooltips could display zeros exposed by truncation: 1.20001 became 1.2000, and 1.00001 became 1.0000. The original #976 fix trims those zeros after the four-digit cut, producing 1.2 and 1; regression tests cover both fractional branches and an integer-only result. The LAT note documents this behavior.

This PR retains #976's original commit history through a merge of 99429853dcd52593841b6f1074ab598967cb997b and includes current main's audited dependencies. Its organization-owned sprayberry-code fork cannot accept upstream maintainer pushes, so the existing supporting PR carries the validated integration. Merge this PR with a merge commit to keep #976's original head reachable. Thanks @askalf for the wallet fix and regression tests.

Validation: all 34 wallet balance tests, both full TypeScript checks, full ESLint, lat check, git diff --check, and the production dependency audit passed (zero vulnerabilities). The diff against main is three files with 20 additions and two deletions.

askalf and others added 6 commits September 17, 2026 05:32
formatTokenBalanceFull promises "up to 4 significant digits with
trailing zeros removed", but it trimmed the fraction before capping it
to 4 digits. When the cut lands on a zero that was only interior in the
untrimmed fraction, that zero becomes trailing and was still rendered:
1.20001 HD showed as "1.2000" and 1.00001 HD as "1.0000".

Both branches now re-trim after the slice. The sub-1 branch keeps its
leading zeros (they are emitted separately) and its first significant
digit is non-zero, so a digit always survives. formatTokenBalance
inherits the fix below the K threshold, where it delegates here.
Adds the ledger rows the first pass left untested: an interior zero kept
while the cut's exposed tail goes, the sub-1 branch with no leading zeros
at both 18 and 6 decimals, a fraction entirely past the 4-digit window,
and a control pinning that the compact K path never reaches the changed
lines.
…eFull tests

One case per truncation branch, beside the existing formatter tests.
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Removes trailing fractional zeros exposed by truncation in formatTokenBalanceFull.

  • Full-balance tooltips drop zeros exposed by the four-digit cut.

Reviews (2) · Last reviewed commit: "Merge commit '99429853dcd52593841b6f1074..." · Reviewed by Greptile

@fathah fathah changed the title docs(wallet): document full-balance zero trimming fix(wallet): trim exposed zeros in full-balance tooltips Oct 11, 2026
@fathah
fathah merged commit 48aa36d into main Oct 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants