Skip to content

Commit 3a0aac4

Browse files
committed
Change TransactionWidget fiat decimals to two (#8366)
<!-- ## [SDK] Fix: Format TransactionWidget fiat amounts to 2 decimals ## Notes for the reviewer This PR updates the `formatMoney` function to display fiat amounts with a maximum of 2 decimal places instead of 5. This standardizes currency formatting for improved readability within the TransactionWidget. ## How to test - Verify fiat amounts in the TransactionWidget (e.g., payment screens, token selection) are displayed with a maximum of 2 decimal places. - Unit tests passed. --> --- [Slack Thread](https://thirdwebdev.slack.com/archives/C09DS2CKGP2/p1762414792059159?thread_ts=1762414792.059159&cid=C09DS2CKGP2) <a href="https://cursor.com/background-agent?bcId=bc-65f07aee-1cee-4915-9656-8e4d9904ae3c"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-65f07aee-1cee-4915-9656-8e4d9904ae3c"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on modifying the formatting of token balances in the `formatTokenBalance.ts` file to limit the maximum number of fraction digits displayed. ### Detailed summary - Changed `maximumFractionDigits` from `5` to `2` in the currency formatting options. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Updated currency formatting to display a maximum of 2 decimal places instead of 5, improving readability and consistency of financial amounts throughout the app while maintaining appropriate minimum precision. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 7b13015 commit 3a0aac4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function formatMoney(
4949
return new Intl.NumberFormat(locale, {
5050
style: "currency",
5151
currency: currencyCode,
52-
maximumFractionDigits: 5,
52+
maximumFractionDigits: 2,
5353
minimumFractionDigits: 0,
5454
}).format(value);
5555
}

0 commit comments

Comments
 (0)