Skip to content

Conversation

@AntonioVentilii
Copy link
Collaborator

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.

@AntonioVentilii AntonioVentilii requested review from a team as code owners November 26, 2025 13:35
Copilot AI review requested due to automatic review settings November 26, 2025 13:35
@AntonioVentilii AntonioVentilii marked this pull request as draft November 26, 2025 13:35
Copy link
Contributor

Copilot AI left a 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 StakeBalances type definition mapping token IDs to stake data
  • Created stakeBalances derived 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.

@AntonioVentilii AntonioVentilii marked this pull request as ready for review November 26, 2025 14:14
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@dfinity dfinity deleted a comment from Copilot AI Nov 26, 2025
@AntonioVentilii AntonioVentilii added this pull request to the merge queue Nov 26, 2025
Merged via the queue into main with commit 153006a Nov 26, 2025
79 checks passed
@AntonioVentilii AntonioVentilii deleted the feat-frontend/Derived-store-for-stake-balances-map branch November 26, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants