Fix token with balance of zero, chain filter reset and correct USD price#291
Fix token with balance of zero, chain filter reset and correct USD price#291
Conversation
WalkthroughThe changes update how chain state and token price data are managed in the exchange-related components and their tests. When opening token lists in the swap UI, the chain state is now explicitly set to a default value. Price fetching logic is refactored to use static price data from tokens instead of asynchronous hooks. Tests are updated to reflect these changes by removing mocks and relying on token-internal price properties. Additionally, the portfolio API response converter now filters out tokens with non-positive balances. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CardsSwap
participant ReduxStore
User->>CardsSwap: Open Swap/Receive Token List
CardsSwap->>ReduxStore: Dispatch setSwapChain/setReceiveChain (default: all)
CardsSwap->>ReduxStore: Dispatch openSwapTokenList/openReceiveTokenList
sequenceDiagram
participant EnterAmount
participant ReduxStore
EnterAmount->>EnterAmount: Token changes
alt Token has price
EnterAmount->>ReduxStore: Dispatch setUsdPrice with token.price
else Token missing price
EnterAmount->>console: Log error
EnterAmount->>ReduxStore: Dispatch setUsdPrice with 0
end
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (6)
🧰 Additional context used🧬 Code Graph Analysis (4)src/apps/the-exchange/components/EnterAmount/EnterAmount.tsx (1)
src/services/pillarXApiWalletPortfolio.ts (1)
src/apps/the-exchange/components/CardsSwap/CardsSwap.tsx (1)
src/apps/the-exchange/components/DropdownTokensList/test/DropdownTokensList.test.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (14)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying x with
|
| Latest commit: |
5e6e13f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e3fe98c8.x-e62.pages.dev |
| Branch Preview URL: | https://feat-pro-3162-the-exchange-c.x-e62.pages.dev |
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit
New Features
Bug Fixes
Tests