Skip to content

[READY] Optimize token selection#1055

Merged
Sharqiewicz merged 7 commits into
stagingfrom
chore/optimize-token-selection-and-balances
Feb 3, 2026
Merged

[READY] Optimize token selection#1055
Sharqiewicz merged 7 commits into
stagingfrom
chore/optimize-token-selection-and-balances

Conversation

@Sharqiewicz
Copy link
Copy Markdown
Member

@Sharqiewicz Sharqiewicz commented Feb 3, 2026

Summary

  • Centralize token balance fetching into a dedicated service and Zustand store
  • Remove redundant balance fetching hooks that caused unnecessary re-renders
  • Improve token sorting by USD value with fallback to raw balance

Changes

New Files

  • apps/frontend/src/services/balances/ - Centralized balance fetching service
  • assetHubBalanceFetcher.ts - Fetches AssetHub token balances with USD prices
  • evmBalanceFetcher.ts - Fetches EVM token balances
  • apps/frontend/src/stores/tokenBalanceStore.ts - Zustand store for balance state
  • apps/frontend/src/hooks/useInitTokenBalances.ts - Hook to initialize balances on wallet connect
  • apps/frontend/src/hooks/useMaintenanceStatus.ts - Extracted maintenance status logic

Removed Files

  • apps/frontend/src/hooks/useOnchainTokenBalances.ts - Replaced by centralized service
  • apps/frontend/src/hooks/useOnchainTokenBalancesSorted.ts - No longer needed
  • apps/frontend/src/hooks/useTokensSortedByBalance.ts - No longer needed

Modified Files

  • apps/frontend/src/components/TokenSelection/TokenSelectionList/components/SelectionTokenList.tsx - Use balance store, improved sorting
  • apps/frontend/src/layouts/index.tsx - Initialize balances at app level

Test Plan

  • Connect EVM wallet and verify token balances load
  • Connect Polkadot wallet and verify AssetHub token balances load
  • Open token selection modal and verify tokens sort by USD value (highest first)
  • Verify AssetHub tokens (DOT, USDC, USDT) show correct USD values
  • When USD values are equal, verify tokens sort by raw balance

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 3, 2026

Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit 140976e
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/698245f14f65840008a47032
😎 Deploy Preview https://deploy-preview-1055--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 3, 2026

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 140976e
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/698245f11bc4390008765486
😎 Deploy Preview https://deploy-preview-1055--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Sharqiewicz Sharqiewicz changed the title [IN PROGRESS] Optimize token selection [READY] Optimize token selection Feb 3, 2026
@Sharqiewicz Sharqiewicz requested review from ebma and gianfra-t and removed request for gianfra-t February 3, 2026 17:25
Copy link
Copy Markdown
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good ✅ let's fix the sorting with having the stablecoins on top of the list in a follow-up.

@Sharqiewicz Sharqiewicz merged commit 2528b9a into staging Feb 3, 2026
5 checks passed
@ebma ebma deleted the chore/optimize-token-selection-and-balances branch February 3, 2026 19:20
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