fix: refactor: [cherry-pick][V12.1.0] Permit decimal fix + introduce ConfirmInfoRowTextTokenUnits component#26478
Conversation
) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** No UI/UX changes Create reusable ConfirmInfoRowTextTokenUnits notes: - there is an outstanding bug ticket to redesign the display length of the amount to max 15 characters. This will be handled separately - there's also a precision issue being handle separately [](https://codespaces.new/MetaMask/metamask-extension/pull/26105?quickstart=1) ## **Related issues** Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2888 ## **Manual testing steps** 1. Create a redesign Permit transaction 2. Observe amount displays as expected ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After**  ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| // FIXME - Precision may be lost for large values when using formatAmount | ||
| /** @see {@link https://github.com/MetaMask/metamask-extension/issues/25755} */ | ||
| const tokenValue = formatAmount('en-US', resultBn); | ||
| const tokenValueMaxPrecision = formatAmountMaxPrecision('en-US', valueBN); |
There was a problem hiding this comment.
This was actually a bug. We should be reading resultBn here not valueBN
There was a problem hiding this comment.
fixed using the new component introduced here
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## Version-v12.1.0 #26478 +/- ##
===================================================
- Coverage 69.62% 69.62% -0.00%
===================================================
Files 1362 1363 +1
Lines 48412 48410 -2
Branches 13347 13347
===================================================
- Hits 33703 33701 -2
Misses 14709 14709 ☔ View full report in Codecov by Sentry. |
…ign-conf-token-amount
Builds ready [f4f4079]
Page Load Metrics (227 ± 244 ms)
|
| const tokenValue = calcTokenAmount(value, decimals); | ||
|
|
||
| // FIXME - Precision may be lost for large values when using formatAmount | ||
| /** @see {@link https://github.com/MetaMask/metamask-extension/issues/25755} */ |
There was a problem hiding this comment.
This issue has been fixed, we can get rid of this comment now.
There was a problem hiding this comment.
Turns out we haven't cherry-picked the Precision fix to 12.1.0 yet. Cherry-pick PR #26496
jpuri
left a comment
There was a problem hiding this comment.
Changes look good, I left a small feedback to remove an outdated comment.
Description
Cherry-picks refactor: Create reusable ConfirmInfoRowTextTokenUnits component (#26105)
into V12.1.0
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2888
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2991 (cherry-pick issue)
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Standards.
Pre-merge reviewer checklist