Open
Conversation
* feat: add numberFormatter and web3 utils * feat: add formatting * fix: fix bug * fix: remove extra formatPercent * fix: fix UI bugs * fix: add abbreviation * fix: remove linting errors * fix: remove conflict * fix: add linter checks --------- Co-authored-by: ECWireless <40322776+ECWireless@users.noreply.github.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
13 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces centralized number/address formatting utilities and migrates many Explorer UI surfaces (voting, treasury, orchestrators, transactions, charts, and account views) away from ad-hoc formatting/divisors to shared formatters and constants.
Changes:
- Added
utils/numberFormatters.ts(LPT/ETH/USD/percent/round/number) with accompanying tests. - Added
utils/web3.ts(address helpers, wei conversions, percent precision constants) and migrated call sites from@lib/utils. - Replaced scattered manual formatting across multiple pages/components (percent divisors, LPT/ETH display, address/hash shortening).
Reviewed changes
Copilot reviewed 50 out of 51 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/web3.ts | New web3/address + wei conversion helpers and percent precision constants |
| utils/web3.test.ts | Unit tests for new utils/web3 helpers |
| utils/voting.ts | Removes local formatPercent; switches fromWei import to @utils/web3 |
| utils/numberFormatters.ts | New centralized formatting utilities for LPT/ETH/USD/percent/etc. |
| utils/numberFormatters.test.ts | Unit tests for new number formatting utilities |
| tsconfig.json | Adds @utils/* path alias |
| pages/voting/create-poll.tsx | Switches fromWei import to @utils/web3 |
| pages/voting/[poll].tsx | Uses shared formatters/constants instead of local/manual formatting |
| pages/treasury/create-proposal.tsx | Uses formatLPT + fromWei/toWei from @utils/web3 |
| pages/treasury/[proposal].tsx | Uses shared formatters/constants; moves web3 helpers to @utils/web3 |
| pages/migrate/orchestrator.tsx | Switches address/hash formatting to @utils/web3 |
| pages/migrate/delegator/index.tsx | Switches address/hash formatting to @utils/web3 |
| pages/migrate/broadcaster.tsx | Switches address/hash formatting to @utils/web3 |
| pages/index.tsx | Replaces hardcoded inflation divisor with PERCENTAGE_PRECISION_BILLION |
| pages/api/score/[address].tsx | Moves checkAddressEquality to @utils/web3 |
| pages/api/l1-delegator/[address].tsx | Moves EMPTY_ADDRESS to @utils/web3 |
| pages/_app.tsx | Removes global numbro.setDefaults initialization |
| lib/utils.tsx | Removes web3/formatting helpers now housed in @utils/web3 |
| lib/utils.test.ts | Removes tests for moved helpers; imports EMPTY_ADDRESS from @utils/web3 |
| lib/api/treasury.ts | Switches fromWei import to @utils/web3 |
| lib/api/ens.ts | Switches formatAddress import to @utils/web3 |
| layouts/main.tsx | Switches EMPTY_ADDRESS/formatAddress imports to @utils/web3 |
| layouts/account.tsx | Switches checkAddressEquality import to @utils/web3 |
| hooks/useSwr.tsx | Switches formatAddress import to @utils/web3 |
| components/TxStartedDialog/index.tsx | Switches formatAddress/fromWei imports to @utils/web3 |
| components/TxConfirmedDialog/index.tsx | Switches formatAddress/fromWei imports to @utils/web3 |
| components/Treasury/TreasuryVotingWidget/index.tsx | Replaces various percent/LPT formatting with shared formatters |
| components/Treasury/TreasuryVoteTable/index.tsx | Standardizes weight formatting with shared formatters |
| components/Treasury/TreasuryVoteTable/Views/VoteItem.tsx | Switches formatTransactionHash import to @utils/web3 |
| components/Treasury/TreasuryVoteTable/TreasuryVotePopover.tsx | Uses formatNumber for vote counts |
| components/TransactionsList/index.tsx | Replaces numbro/manual formatting with shared formatters/constants |
| components/TransactionBadge/index.tsx | Switches formatTransactionHash import to @utils/web3 |
| components/StakeTransactions/index.tsx | Uses formatLPT and formatAddress from new utils |
| components/Search/index.tsx | Switches formatAddress import to @utils/web3 |
| components/RoundStatus/index.tsx | Replaces numbro formatting with shared formatters |
| components/Profile/index.tsx | Switches formatAddress import to @utils/web3 |
| components/PollVotingWidget/index.tsx | Uses shared percent + voting power formatting |
| components/PerformanceList/index.tsx | Replaces numbro formatting with formatNumber/formatPercent + web3 address formatting |
| components/OrchestratorList/index.tsx | Replaces numbro/manual percent formatting and divisors with shared formatters/constants |
| components/OrchestratingView/index.tsx | Replaces numbro/manual formatting with shared formatters/constants |
| components/HistoryView/index.tsx | Replaces numbro/manual formatting with shared formatters/constants |
| components/ExplorerChart/index.tsx | Moves most subtitle/axis formatting to shared formatters |
| components/DelegatingWidget/index.tsx | Uses formatLPT and fromWei from new utils |
| components/DelegatingWidget/ProjectionBox.tsx | Uses shared formatters for ROI, principle, fees/rewards |
| components/DelegatingWidget/InputBox.tsx | Switches fromWei import to @utils/web3 |
| components/DelegatingWidget/Input.tsx | Replaces hardcoded divisors with percent precision constants |
| components/DelegatingWidget/Header.tsx | Switches formatAddress import to @utils/web3 |
| components/DelegatingView/index.tsx | Replaces numbro/manual formatting with shared formatters |
| components/Claim/index.tsx | Switches formatAddress import to @utils/web3 |
| components/AccountCell/index.tsx | Switches formatAddress import to @utils/web3 |
| components/Account/index.tsx | Switches formatAddress import to @utils/web3 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
See #545 for all details. Original PR created by @Roaring30s .