Conversation
WalkthroughThis update refines token swap and transaction logic by adjusting slippage tolerance, enhancing token wrapping checks, and updating function signatures for offer and transaction retrieval. Additional metadata attributes are added to transaction info buttons, and a safety warning in the send modal is temporarily disabled pending a future update. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant EnterAmount
participant ExchangeAction
participant useOffer
participant TokenService
User->>EnterAmount: Input swap details
EnterAmount->>useOffer: getBestOffer(..., slippage=0.03)
useOffer->>TokenService: Fetch token data
useOffer-->>EnterAmount: Return best offer
User->>ExchangeAction: Click exchange
ExchangeAction->>useOffer: getStepTransactions(swapToken, offer, walletAddress)
useOffer->>TokenService: Check if wrapping required
useOffer-->>ExchangeAction: Return step transactions
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ 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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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: |
2f6d449
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f66eda79.x-e62.pages.dev |
| Branch Preview URL: | https://fix-pro-3493-swap-wrapped-na.x-e62.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1)
598-611: Safety warning temporarily disabled - verify user impact.The safety warning that prevents users from proceeding when transaction costs exceed the send amount has been disabled pending Transaction Kit 2.0. While this addresses the PR objective, consider the user experience implications of removing this protective measure.
Ensure that:
- Users are still informed about high transaction costs through other means
- The temporary removal timeline is acceptable from a UX perspective
- Transaction Kit 2.0 timeline is confirmed for reintroducing this feature
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/apps/the-exchange/components/EnterAmount/EnterAmount.tsx(1 hunks)src/apps/the-exchange/components/ExchangeAction/ExchangeAction.tsx(1 hunks)src/apps/the-exchange/hooks/useOffer.tsx(4 hunks)src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx(2 hunks)src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx(2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: RanaBug
PR: pillarwallet/x#275
File: src/apps/the-exchange/components/DropdownTokensList/DropdownTokenList.tsx:180-195
Timestamp: 2025-03-28T09:22:22.712Z
Learning: In the Exchange app, `swapTokenList` and `receiveTokenList` are derived from `searchTokenResult` when search is active, so including `searchToken` in the useEffect dependency array that uses these lists would be redundant as the lists will update when search results change.
src/apps/the-exchange/components/ExchangeAction/ExchangeAction.tsx (2)
Learnt from: RanaBug
PR: pillarwallet/x#275
File: src/apps/the-exchange/components/DropdownTokensList/DropdownTokenList.tsx:180-195
Timestamp: 2025-03-28T09:22:22.712Z
Learning: In the Exchange app, `swapTokenList` and `receiveTokenList` are derived from `searchTokenResult` when search is active, so including `searchToken` in the useEffect dependency array that uses these lists would be redundant as the lists will update when search results change.
Learnt from: RanaBug
PR: pillarwallet/x#334
File: src/apps/leaderboard/utils/index.tsx:91-94
Timestamp: 2025-06-17T09:20:44.533Z
Learning: In src/apps/leaderboard/utils/index.tsx, the getLastWeekMigrationData function intentionally uses currentWeek (not lastWeek) for the completedSwapWeek lookup. This is correct business logic - when retrieving last week's migration data, the function should check swap completion against the current week while using lastWeek for points and USD calculations.
src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx (1)
Learnt from: RanaBug
PR: pillarwallet/x#320
File: src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx:177-182
Timestamp: 2025-05-28T14:30:02.702Z
Learning: In the transaction history tracking feature, chain ID validation is performed earlier in the flow before the values reach the TransactionInfo component, so additional validation at the display level is not needed.
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1)
Learnt from: RanaBug
PR: pillarwallet/x#275
File: src/apps/the-exchange/components/DropdownTokensList/DropdownTokenList.tsx:180-195
Timestamp: 2025-03-28T09:22:22.712Z
Learning: In the Exchange app, `swapTokenList` and `receiveTokenList` are derived from `searchTokenResult` when search is active, so including `searchToken` in the useEffect dependency array that uses these lists would be redundant as the lists will update when search results change.
src/apps/the-exchange/hooks/useOffer.tsx (1)
Learnt from: RanaBug
PR: pillarwallet/x#275
File: src/apps/the-exchange/components/DropdownTokensList/DropdownTokenList.tsx:180-195
Timestamp: 2025-03-28T09:22:22.712Z
Learning: In the Exchange app, `swapTokenList` and `receiveTokenList` are derived from `searchTokenResult` when search is active, so including `searchToken` in the useEffect dependency array that uses these lists would be redundant as the lists will update when search results change.
🧬 Code Graph Analysis (1)
src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx (1)
src/utils/blockchain.ts (1)
getBlockScan(218-237)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: lint
- GitHub Check: unit-tests
- GitHub Check: build
🔇 Additional comments (10)
src/apps/the-exchange/components/EnterAmount/EnterAmount.tsx (1)
129-129: Clarify slippage tolerance change direction.The PR objectives mention "increasing the slippage tolerance from 1% to 3%", but this change reduces slippage from 5% (0.05) to 3% (0.03). Please verify this is the intended change and update the PR description accordingly if needed.
src/apps/the-exchange/components/ExchangeAction/ExchangeAction.tsx (1)
99-102: LGTM! Function call updated correctly.The addition of
swapTokenparameter aligns properly with the updatedgetStepTransactionsfunction signature in theuseOfferhook. The parameter is correctly sourced from the Redux state.src/components/BottomMenuModal/HistoryModal/TransactionInfo.tsx (2)
213-213: LGTM! Metadata attribute added correctly.The
data-urlattribute correctly matches the URL constructed in the onClick handler for transaction viewing.
237-237: LGTM! Metadata attribute added correctly.The
data-urlattribute correctly matches the URL constructed in the onClick handler for blockchain explorer viewing, including the properisAddressflag usage.src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1)
576-577: ESLint suppression added correctly.The unused variable suppression is appropriate since
costAsFiatis calculated but no longer used due to the commented safety warning below.src/apps/the-exchange/hooks/useOffer.tsx (5)
22-25: LGTM! Necessary imports added.The import additions for
TokenandchainNameToChainIdTokensDataare required for the enhanced wrapping logic ingetStepTransactions.
44-44: LGTM! Slippage parameter added to function signature.The addition of the
slippageparameter enables dynamic slippage control, which aligns with the PR objective of adjusting slippage tolerance.
62-62: LGTM! Slippage parameter correctly utilized.The slippage parameter is properly passed to the routes request options, enabling the dynamic slippage control.
133-133: LGTM! Token parameter added for enhanced wrapping logic.The addition of
tokenToSwapparameter enables more precise wrapping detection by comparing the actual token to swap against the route token.
139-144: LGTM! Improved wrapping logic prevents unnecessary operations.The enhanced wrapping logic correctly compares the route token (which may already be wrapped) with the actual token to swap, avoiding unnecessary wrapping steps when the token to swap is already wrapped.
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit
Improvements
Temporary Changes