feat(amount): route remaining display sites through the amount layer - #893
Open
raul-oliveira wants to merge 2 commits into
Open
feat(amount): route remaining display sites through the amount layer#893raul-oliveira wants to merge 2 commits into
raul-oliveira wants to merge 2 commits into
Conversation
Converts every remaining direct numberUtils.prettyValue call onto the shared amount layer from PR1, so the format preference applies consistently across Reown, atomic swap, nano contracts, the NFT list, token mint/melt, token import and the send/create flows. - JSX sites render <Amount>; string sites use useAmountFormat / formatAmount - class components mask the preference with resolveAmountFormat in mapStateToProps, so the feature flag cannot be bypassed - getDepositAmount takes an optional amountFormat, threaded from its two wrapper callers; HTR fee and deposit amounts never receive a token's isNFT - CreateTokenRequestData keeps a null/try-catch guard around the amount, since the payload comes from an external dApp over Reown numberUtils.prettyValue now survives only in InputNumber, which is always expanded by design.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Acceptance Criteria
numberUtils.prettyValuecall is routed through the shared amount layer from feat(amount): add wallet-wide amount format preference #892, so the Expanded/Compressed preference applies consistently across the whole wallet — Reown, atomic swap, nano contracts, the NFT list, token mint/melt, token import, and the send/create flowsnumberUtils.prettyValuenow survives only inInputNumber, which is always expanded by designamount-format-desktop.rolloutflag is off (its default)Second of 6 PRs. Stacked on #892 — base branch is
raul-oliveira/feat/amount-format, notmaster. Review #892 first.What changed
18 files, all mechanical conversions onto the three PR1 APIs:
<Amount>useAmountFormat()formatAmount, and mask the preference withresolveAmountFormat(...)inmapStateToPropsso the feature flag can't be bypassedTwo sites needed more than a substitution:
Reown/CreateTokenRequestData.jsdefined its formatter at module scope; it moved inside the component to use the hook, and keeps anull/try-catchguard around the amount because the payload arrives from an external dApp over Reown — an unguardedprettyValuedoesBigInt(), which throws on a malformed value.utils/tokens.jsgetDepositAmountgained an optionalamountFormatparameter (last, so it stays backward-compatible), threaded from its two wrapper callers.HTR fee and deposit amounts are never given a token's
isNFT— a fee is always HTR.Testing
Suite unchanged from #892: 33/33 pass, same 7 pre-existing suites failing on the Jest/axios ESM issue (see #892 for detail). No new user-facing strings, so
make update_potis a no-op.Manual QA needed
With the flag temporarily forced on and Compressed selected, confirm small values compress everywhere and long values are consistent (Expanded elsewhere when the flag is off):
Security Checklist