Repository navigation
feat(confirmations): show up to 8 decimals for send and simulation amounts - #47532
Conversation
…ounts Co-authored-by: Daniel <dan437@users.noreply.github.com>
Co-authored-by: Daniel <dan437@users.noreply.github.com>
…cimals-8847 Co-authored-by: Daniel <dan437@users.noreply.github.com>
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (7 files, +12 -10)
🔄 @MetaMask/swaps-engineers (1 files, +1 -0)
|
Builds ready [0b68541]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 5 warn · 🔴 2 fail)
Bundle Size Diffs
|
…decimals Co-authored-by: Daniel <dan437@users.noreply.github.com>
Builds ready [8030f6d] [reused from 0b68541]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 5 warn · 🔴 2 fail)
Bundle Size Diffs
|
Co-authored-by: Daniel <dan437@users.noreply.github.com>
Co-authored-by: Daniel <dan437@users.noreply.github.com>
Builds ready [96eed2e] [reused from 0b68541]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 5 warn · 🔴 2 fail)
Bundle Size Diffs
|
There was a problem hiding this comment.
Visual validation: ✅ succeeded
metamask-extension#47532 · 4 PASS / 0 FAIL / 0 BLOCKED · Langfuse trace
The PR visually validates as intended on the inspected confirmation surfaces: native send headings, ERC-20 send headings, and simulation details now show the longer precision, while the compact-formatting smoke check still shows short ETH formatting and stable layout. No funded confirmations were submitted.
Test results
| Test case | Status |
|---|---|
| native-send-heading-precision | ✅ PASS |
| erc20-send-heading-precision | ✅ PASS |
| simulation-details-precision | ✅ PASS |
| compact-formatting-smoke | ✅ PASS |
Evidence
Full report · execution-result.json
Sent by Cursor Automation: MetaMask/agent-orchestration
Restore the send heading, token value and gas fee token list item tests, the gas fee token balance, the bridge E2E helper and the simulation details E2E check to main. None of them break with the new formatAmount output. Co-authored-by: Daniel <dan437@users.noreply.github.com>
… compact
Restore the roundingMode parameter and add an optional trailing
{ compact } option, so existing callers are unchanged. Only the bridge
token amount and the gas fee token amount opt out.
Co-authored-by: Daniel <dan437@users.noreply.github.com>
Builds ready [ba0ed8e]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 4 warn · 🔴 2 fail)
Bundle Size Diffs
|
Builds ready [d22e17d]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 6 warn · 🔴 2 fail)
Bundle Size Diffs
|
|
|
No release label on PR. Adding release label release-13.57.0 on PR, as PR was added to branch 13.57.0 when release was cut. |








Description
The send confirmation heading and the simulation / estimated changes amounts showed only about 3 significant digits, and fewer decimals as the amount grew (for example
121.456showed as121.5and1,034.123as1,034). That can hide cents on large stablecoin sends.formatAmountnow shows up to 8 decimal places by default, without trailing zeros. Longer amounts are rounded to 8 decimals, and the existing tooltip still shows the full value. Non-zero amounts below0.000001still show<0.000001. The change lives informatAmount, so it applies everywhere that formatter is used.formatAmountkeeps its signature and gets an optional trailing{ compact }option, so no existing caller has to change.compact: truekeeps the previous 3-significant-digit output.{ compact: true }: the network fee when paying with a token (useGasFeeToken) and swap / bridge (formatTokenAmount).Decisions to confirm
pay-token-amount.tsx(MetaMask Pay "pay with" amount) and the dapp-swap quote panel inside confirmations now show up to 8 decimals. Swap / bridge pages are unchanged.getExpectedQuoteTotalCosts) now uses the new default, while the bridge UI stays compact. No current spec reaches it, since all mocked quotes are priced, so it is left unchanged.Changelog
CHANGELOG entry: Increased the precision of amounts on the send confirmation and in estimated changes to up to 8 decimals
Related issues
Fixes: CONF-2212
Manual testing steps
1.234567ETH.1.234567 ETH, not1.235 ETH.1.123456789). Verify the heading shows1.12345679and hovering it shows1.123456789.1034.123. Verify the heading shows1,034.123.<0.000001.1.235 USDC).Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Widespread display change via shared
formatAmountaffects send and confirmation UX; incorrect rounding could mislead users, though bridge/gas fee paths are explicitly kept compact.Reviewed by Cursor Bugbot for commit d22e17d. Bugbot is set up for automated code reviews on this repo. Configure here.