Skip to content

Conversation

@msteiner96
Copy link
Collaborator

No description provided.

- Updated token structure to include contractId, id, symbol, decimals, balance, and isStakingToken properties.
- Modified createWalletActions to fetch and filter tokens more efficiently, ensuring only valid tokens are processed.
- Enhanced fetchTokenInfo to return a complete token object with updated properties.
- Adjusted various strategy files to accommodate the new token structure, ensuring contractId is set where applicable.
- Updated UI components and stories to reflect the new token structure, ensuring consistency across the application.
@msteiner96 msteiner96 requested a review from Copilot June 10, 2025 20:02
@vercel
Copy link

vercel bot commented Jun 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
phoenix-frontend-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2025 8:15pm

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 refactors the global token and balance state by introducing new metadata fields, unifying token storage, and updating components and stories to use the centralized appStore.tokens.

  • Added comprehensive Token metadata (contractId, id, symbol, decimals, balance, isStakingToken) and updated type definitions.
  • Refactored state actions (getAllTokens, fetchTokenInfo) to return and populate Token[], and removed legacy allTokens.
  • Updated UI components, hooks, and story files to consume appStore.tokens instead of local or outdated token sources.

Reviewed Changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/ui/src/Earn/Modals/ClaimAllModal.stories.tsx Added missing Token fields (id, contractId, etc.) to mockToken
packages/ui/src/Earn/Modals/BondModal.tsx Switched to appStore.tokens and updated effect deps
packages/ui/src/Earn/Modals/BondModal.stories.tsx Added contractId to mock strategy assets
packages/ui/src/Earn/EarnPage.tsx Populated contractId in mock EarnPage strategies
packages/ui/src/Dashboard/WalletBalanceTable/WalletBalanceTable.stories.tsx Added contractId to test tokens, extra import
packages/ui/src/Dashboard/AssetInfoModal/AssetInfoModal.stories.tsx Replaced address with contractId in story data
packages/ui/src/AnchorServices/AnchorServices.stories.tsx Added contractId to anchor sample assets
packages/types/src/state/wallet.ts Updated WalletActions to use Token, removed allTokens
packages/types/src/general/token.ts Extended Token interface with new metadata fields
packages/strategies/src/phoenix/strategies/xlm-usdc.liquidity.ts Populated assets from _tokenX metadata, default decimals
packages/strategies/src/phoenix/strategies/xlm-pho.liquidity.ts Same metadata enhancements for XLM-PHO strategy
packages/strategies/src/phoenix/strategies/pho-usdc.liquidity.ts Same metadata enhancements for PHO-USDC strategy
packages/state/src/state/wallet/actions.ts Refactored wallet actions to use new Token type and cleanup
packages/core/hooks/useContractTransaction.tsx Triggered appStore.getAllTokens() on transaction success/restore
packages/core/app/swap/page.tsx Removed local tokens state, consume appStore.tokens and added loading UI
packages/core/app/pools/page.tsx Single-run fetchPool effect, replaced store with appStore
packages/core/app/pools/[poolAddress]/page.tsx Deduped appStore declarations; updated icon, contractId usage
packages/core/app/page.tsx Replaced local allTokens with appStore.tokens for balances
packages/core/app/layout.tsx Ensures initial getAllTokens() on mount
packages/core/app/earn/page.tsx Removed local Token definition, imported shared Token
Comments suppressed due to low confidence (4)

packages/ui/src/Dashboard/AssetInfoModal/AssetInfoModal.stories.tsx:287

  • The contractId for the PHO asset appears to be a copy of the first asset's address. Use the correct PHO contract address to ensure accurate data in the story.
contractId: "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",

packages/types/src/state/wallet.ts:4

  • The StateToken type is no longer used by WalletActions. Consider removing this unused type to reduce maintenance overhead.
export type StateToken = {

packages/types/src/general/token.ts:7

  • [nitpick] Having both contractId (required) and optional alias id on Token may lead to confusion. Consider consolidating to a single identifier to simplify the API.
contractId: string; // Contract address/ID for the token

packages/ui/src/Dashboard/WalletBalanceTable/WalletBalanceTable.stories.tsx:5

  • The imported symbol 'contract' is never used. Consider removing this unused import to clean up the code.
import { contract } from "@stellar/stellar-sdk";

@msteiner96 msteiner96 merged commit 5e21b2d into main Jun 10, 2025
4 of 6 checks passed
@msteiner96 msteiner96 deleted the rework-token-state branch June 10, 2025 20:15
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.

1 participant