-
Notifications
You must be signed in to change notification settings - Fork 39
feat(frontend): Add the stake balance in the network switcher list #10567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(frontend): Add the stake balance in the network switcher list #10567
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the network switcher dropdown to display complete token balances by adding staking balances (including claimable rewards) alongside regular balances. The implementation follows existing patterns in the codebase by creating a utility function to aggregate stake balances per network and a derived store to make the data reactive.
Key changes:
- Added
sumMainnetTokensUsdStakeBalancesPerNetworkutility function to aggregate stake and claimable balances per network - Created
enabledMainnetTokensUsdStakeBalancesPerNetworkderived store based onenabledFungibleTokensUi - Updated
NetworkSwitcherListcomponent to include stake balances in the total balance calculation
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/lib/utils/tokens.utils.ts | Added new utility function to sum stake balances per network for mainnet tokens; includes grammar fixes in comments |
| src/frontend/src/lib/derived/tokens.derived.ts | Added new derived store for stake balances per network; includes grammar fixes in comments |
| src/frontend/src/lib/components/networks/NetworkSwitcherList.svelte | Updated to include stake balances in the total balance display for the network switcher |
| src/frontend/src/tests/lib/utils/tokens.utils.spec.ts | Added comprehensive test coverage for the new utility function including edge cases |
| src/frontend/src/lib/utils/token.utils.ts | Grammar fix in JSDoc comment (no functional changes) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
…etwork-switcher-list
DenysKarmazynDFINITY
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
Motivation
We would like to show the complete balance in the network drop down: that means normal balances and stake balances (including claimable rewards).
Changes
NetworkSwitcherList.Tests
Added tests.