-
Notifications
You must be signed in to change notification settings - Fork 39
feat(frontend): Derived store for stake balances map #10554
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): Derived store for stake balances map #10554
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 introduces a derived store for stake balances, mapping token IDs to their staked amounts and claimable rewards. However, the implementation has critical architectural issues that create circular dependencies and duplicate exports.
Key Changes:
- Added
StakeBalancestype definition mapping token IDs to stake data - Created
stakeBalancesderived store to aggregate stake position data - Attempted to integrate stake balances into token UI data through a new file
Critical Issues:
The implementation creates a circular dependency: stake.derived.ts depends on enabledFungibleTokensUi from tokens.derived.ts, while the new tokens-ui.derived.ts attempts to redefine enabledFungibleTokensUi to depend on stakeBalances. Additionally, tokens-ui.derived.ts creates multiple duplicate exports that conflict with existing stores in tokens.derived.ts.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
src/frontend/src/lib/types/stake-balance.ts |
Defines the StakeBalances type mapping token IDs to staked and claimable amounts |
src/frontend/src/lib/derived/stake.derived.ts |
Implements the stakeBalances derived store but incorrectly depends on enabledFungibleTokensUi instead of enabledTokens, creating a circular dependency |
src/frontend/src/lib/derived/tokens-ui.derived.ts |
Creates duplicate exports (enabledFungibleTokensUi, enabledMainnetFungibleTokensUsdBalance, enabledMainnetFungibleIcTokensUsdBalance) that conflict with existing exports in tokens.derived.ts and calls mapTokenUi with an unsupported $stakeBalances parameter |
src/frontend/src/tests/lib/derived/stake.derived.spec.ts |
Provides comprehensive test coverage for the stakeBalances store including edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Similar to what we have with token balances, it will be useful to have a map of token ID vs stake data (for example staked balance and claimable rewards.