Skip to content

chore: swap refactor (#3731) #3799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 209 commits into
base: develop
Choose a base branch
from
Open

chore: swap refactor (#3731) #3799

wants to merge 209 commits into from

Conversation

stackchain
Copy link
Member

@stackchain stackchain commented Jan 27, 2025

Description / Change(s) / Related issue(s)

Summary by CodeRabbit

  • New Features

    • Introduced a redesigned swap experience with a new main swap screen, updated order creation flow, and enhanced order management.
    • Added protocol selection, improved token selection screens, and detailed swap route summaries.
    • Enhanced swap settings with routing preferences and custom slippage options.
    • Introduced new components for protocol avatars, protocol icons, and swap order lists.
    • Added support for hardware wallet transaction confirmation and a refresh button with animation.
    • Improved token image handling and display with new image hooks and icon sizes.
  • Bug Fixes

    • Improved error handling and user feedback for malformed token data and swap order actions.
    • Enhanced resilience to invalid or missing token information in portfolio and swap features.
  • Documentation

    • Added a comprehensive README for the swap package, including a glossary of DeFi terms.
  • Style

    • Updated button and icon styles, added a reusable outline component, and refined layout for swap-related screens.
  • Chores

    • Updated translation files with new and revised keys for swap and transaction review screens.
    • Lowered Jest coverage thresholds in the swap package for easier testing.
  • Refactor

    • Simplified and unified swap context management, removing legacy swap form providers and related components.
    • Reorganized navigation and route structures for swap features.
    • Centralized and streamlined token info and image management.
  • Tests

    • Added and updated utility tests; removed obsolete swap and portfolio tests.
  • Revert

    • Removed legacy swap components, stories, and helpers to streamline the codebase.

Co-authored-by: Juliano Lazzarotto <[email protected]>
@stackchain stackchain marked this pull request as ready for review January 27, 2025 11:57
Copy link

coderabbitai bot commented Apr 16, 2025

Walkthrough

This update delivers a comprehensive refactor and modernization of the swap feature in the wallet-mobile app. The swap form state management is consolidated into a new SwapProvider, replacing the previous SwapFormProvider and associated context logic. The swap UI and navigation flows are restructured, introducing new screens for order creation, protocol selection, token selection, and order management, while removing many legacy and storybook files. Token image handling is centralized with a new usePortfolioImage hook, and several UI components are updated or added to support enhanced swap and portfolio features. Localization, error handling, and utility functions are expanded, and documentation is improved. The codebase is streamlined by removing obsolete files, mocks, and tests, aligning the swap experience with updated design and architecture.

Changes

Files/Paths (Grouped) Change Summary
src/features/Swap/common/SwapProvider.tsx
src/features/Swap/useCases/CreateOrder/SwapMainScreen.tsx
src/features/Swap/useCases/CreateOrder/EstimateSummary.tsx
src/features/Swap/useCases/CreateOrder/SelectProtocolScreen.tsx
src/features/Swap/useCases/CreateOrder/SelectTokenScreen.tsx
src/features/Swap/useCases/CreateOrder/WarnLimitPrice.tsx
src/features/Swap/useCases/ListOrders/ListOrders.tsx
src/features/Swap/common/Protocol/ProtocolAvatar.tsx
src/features/Swap/common/Protocol/ProtocolIcon.tsx
src/features/Swap/common/constants.ts
src/features/Swap/common/strings.ts
src/features/Swap/common/filterBySearch.ts
src/features/Swap/common/hooks/usePortfolioImage.ts
src/features/Swap/useCases/SwapSettings/SwapSettings.tsx
src/components/Outline.tsx
src/components/RefreshButton/RefreshButton.tsx
src/features/Transactions/common/HeaderRightSwap.tsx
New or refactored swap provider, screens, protocol and token selection, estimate summary, protocol icons, constants, string resources, filter, portfolio image hook, swap settings, outline and refresh button components, and header action.
src/features/Swap/common/AmountCard/AmountCard.tsx
src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx
src/features/Portfolio/common/TokenAmountItem/TokenInfoIcon.tsx
src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts
src/features/Portfolio/common/hooks/useNavigateTo.tsx
src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts
src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx
src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx
src/features/ReviewTx/common/TokenDetails.tsx
src/features/ReviewTx/common/WalletBalance.tsx
src/features/ReviewTx/common/hooks/useOnConfirm.tsx
src/features/ReviewTx/common/hooks/useStrings.tsx
src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/Overview/OverviewTab.tsx
src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/ReviewTx.tsx
src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx
src/features/Swap/common/useSwapConfig.ts
src/features/Swap/useCases/PortfolioTokenDetails/Actions.tsx
src/features/Transactions/useCases/TxHistory/ActionsBanner.tsx
Refactored token, amount, and swap UI components; updated hooks for portfolio, navigation, and chart; improved review and wallet balance UI; updated string resources and navigation logic.
src/features/Swap/common/entries.ts
src/features/Swap/common/entries.test.ts
src/features/Swap/common/mocks.ts
src/features/Swap/common/useSwapTx.ts
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/ResetQuantities.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/SwitchTokens.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/OrderActions/OrderActions.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/EditBuyAmount.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/SelectPoolFromListScreen/SelectPoolFromListScreen.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/ShowPoolActions.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPrice/EditPrice.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/EditSellAmount.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippage.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageActions.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageInfo.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/StartSwapOrderScreen.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnLimitPrice/WarnLimitPrice.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnPriceImpact/WarnPriceImpact.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnSlippage/WarnSlippage.tsx
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/CompletedOrders.tsx
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/OpenOrders.tsx
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/helpers.ts
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/mapOrders.ts
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/ListOrders.tsx
src/features/Swap/common/ButtonGroup/ButtonGroup.tsx
src/features/Swap/common/LiquidityPool/LiquidityPool.tsx
src/features/Swap/common/PoolIcon/PoolIcon.tsx
src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.tsx
src/features/Swap/common/SwapFormProvider.tsx
src/features/Swap/useCases/index.ts
Removed legacy swap form, pool, order, token selection, helpers, mocks, and storybook/test files.
src/features/Swap/common/AmountCard/AmountCard.stories.tsx
src/features/Swap/common/ButtonGroup/ButtonGroup.stories.tsx
src/features/Swap/common/ConfirmRawTx/ConfirmRawTx.stories.tsx
src/features/Swap/common/LiquidityPool/LiquidityPool.stories.tsx
src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.stories.tsx
src/features/Swap/useCases/ReviewSwap/TransactionSummary.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/ResetQuantities.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/SwitchTokens.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/OrderActions/OrderActions.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/EditBuyAmount.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/SelectPoolFromListScreen/SelectPoolFromListScreen.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/ShowPoolActions.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPrice/EditPrice.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/EditSellAmount.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippage.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageActions.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageInfo.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/StartSwapOrder.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnLimitPrice/WarnLimitPrice.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnPriceImpact/WarnPriceImpact.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnSlippage/WarnSlippage.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/CompletedOrders.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/ListOrders.stories.tsx
src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/OpenOrders.stories.tsx
Deleted all swap-related Storybook stories.
src/components/ExpandableInfoCard/ExpandableInfoCard.tsx
src/components/ExpandableInfoCard/ExpandableInfoCard.stories.tsx
Removed ExpandableInfoCard component and its stories.
src/features/Swap/SwapNavigator.tsx Removed swap tab navigator component.
src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx
src/features/Swap/useCases/ReviewSwap/TransactionSummary.tsx
Refactored swap review and summary to use new swap context and data access patterns.
src/features/ReviewTx/common/ConfirmRawTxWithHw.tsx Added new component and hook for hardware wallet transaction confirmation.
src/components/Button/Button.tsx Added color override props, updated styles and icon sizing.
src/components/Icon/Portfolio2.tsx
src/components/Icon/index.ts
src/components/Icon/Icon.stories.tsx
Added new Portfolio2 icon and registered it in the icon set and stories.
src/components/Icon/Chevron.tsx
src/components/Icon/Info.tsx
src/components/Icon/Refresh.tsx
src/components/Icon/Swap.tsx
Updated icon component props, defaults, and viewbox.
src/components/MediaPreview/MediaPreview.tsx
src/components/NftPreview/NftPreview.tsx
Switched to new usePortfolioImage hook for image loading.
src/features/Discover/useDappConnectorManager.tsx Updated import path for collateral not found alert hook.
src/features/Swap/common/Counter/Counter.tsx Swapped font weights for counter text styles.
src/features/Swap/common/SwapInfoLink/SwapInfoLink.tsx Refactored to use Button component for link.
src/features/Swap/useCases/CreateOrder/LimitInput.tsx
src/features/Swap/useCases/CreateOrder/ShowPriceImpact.tsx
Refactored and simplified price input and price impact components.
src/features/Swap/useCases/ShowSubmittedTxScreen/SubmittedTxScreen.tsx Updated to use new swap context for reset action.
src/features/Transactions/TxHistoryNavigator.tsx
src/kernel/navigation.tsx
Reorganized swap-related navigation routes and screens.
src/kernel/i18n/global-messages.ts
src/kernel/i18n/locales/en-US.json
Added/updated translation keys and descriptions for swap and ADA.
src/kernel/features.ts Added new feature flag for swap token links.
src/WalletNavigator.tsx Removed swap-related context and logic from wallet navigator.
src/yoroi-wallets/cardano/api/fetch.ts Added error logging for API fetch failures.
src/yoroi-wallets/hooks/index.ts Added useAddressHex hook, removed useNativeAssetImage, updated frontend fee naming.
src/hooks/useShowCollateralNotFoundAlert.tsx Added new hook for collateral not found alert handling.
translations/messages/... Added/updated translation message entries and metadata for new/changed strings.
packages/common/src/utils/strings.ts
packages/common/src/utils/strings.test.ts
Added hexToAscii and asciiToHex utility functions and tests.
packages/portfolio/src/helpers/create-cached-unknown-token-info.ts
packages/portfolio/src/helpers/create-cached-unknown-token-info.test.ts
packages/portfolio/src/helpers/create-unknown-token-info.ts
packages/portfolio/src/helpers/create-unknown-token-info.test.ts
Simplified unknown token info creation and adjusted tests.
packages/portfolio/src/adapters/dullahan-api/api-maker.ts
packages/portfolio/src/adapters/dullahan-api/api-maker.test.ts
packages/portfolio/src/adapters/dullahan-api/transformers.ts
packages/portfolio/src/adapters/dullahan-api/transformers.test.ts
Changed error handling for malformed token info/activity; now skips bad entries instead of throwing. Adjusted tests accordingly.
packages/swap/README.md Added documentation with glossary for swap-related terms.
packages/swap/package.json Lowered Jest coverage thresholds for testing.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant WalletApp
  participant SwapProvider
  participant SwapAPI
  participant Portfolio

  User->>WalletApp: Navigates to Swap
  WalletApp->>SwapProvider: Initializes swap state/context
  SwapProvider->>SwapAPI: Fetch available tokens, pools, protocols
  SwapAPI-->>SwapProvider: Returns tokens, pools, protocol options
  SwapProvider-->>WalletApp: Provides swap state, tokens, protocols

  User->>WalletApp: Selects tokens, enters amounts
  WalletApp->>SwapProvider: Dispatches actions (token/amount/slippage changes)
  SwapProvider->>SwapAPI: Fetches swap estimates
  SwapAPI-->>SwapProvider: Returns swap estimate
  SwapProvider-->>WalletApp: Updates UI with estimate

  User->>WalletApp: Confirms swap
  WalletApp->>SwapProvider: Create order
  SwapProvider->>SwapAPI: Submit swap order
  SwapAPI-->>SwapProvider: Returns order details/confirmation
  SwapProvider-->>WalletApp: Navigates to order review/confirmation

  Note over WalletApp,Portfolio: Token images and info loaded via usePortfolioImage and Portfolio APIs
Loading

Suggested reviewers

  • banklesss

Poem

🐇

Hopping through code with a swap in my paw,
I tidied the forms and refactored with awe.
Old stories and mocks, I swept them away,
New hooks and icons now brighten the day!
With tokens and routes all neatly aligned,
This rabbit’s proud of the progress you’ll find.

— Happy swapping! 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🧹 Nitpick comments (32)
apps/wallet-mobile/src/yoroi-wallets/cardano/api/fetch.ts (1)

97-100: Improved error logging for better debugging.

The additional error catching and logging enhances visibility of API failures by explicitly logging the full API path and error details before rethrowing.

Consider using the existing logger instead of console.error for consistency:

  return checkedFetch(request).catch((e) => {
-    console.error(`Failed call for ${fullPath}: ${e}`)
+    logger.error(`Failed call for ${fullPath}`, {error: e})
    throw e
  })
packages/common/src/utils/strings.ts (1)

36-45: Properly implemented hex to ASCII conversion with input validation.

The function correctly validates hex input and converts to ASCII characters.

The non-null assertion (!) on line 42 could be avoided with a safer pattern:

  return hex
-    .match(/.{1,2}/g)!
+    .match(/.{1,2}/g) || []
    .map((byte) => String.fromCharCode(parseInt(byte, 16)))
    .join('')
apps/wallet-mobile/src/hooks/useShowCollateralNotFoundAlert.tsx (1)

1-45: New hook for collateral alert handling looks good.

This hook encapsulates collateral alert logic, making it reusable across the application.

The pending alert lacks button text and cancel options:

    if (isCollateralUtxoPending) {
-      Alert.alert(collateralTxPendingTitle, collateralTxPendingText, [{onPress: onCollateralPendingPress}])
+      Alert.alert(
+        collateralTxPendingTitle, 
+        collateralTxPendingText, 
+        [
+          {
+            text: 'OK',
+            onPress: onCollateralPendingPress,
+          }
+        ],
+        {cancelable: true}
+      )
      return
    }
packages/swap/package.json (1)

123-126: Coverage thresholds relaxed—acceptable for refactor, but track for future.

Lowering Jest coverage thresholds to 1% is reasonable during major refactors. Ensure this is temporary and plan to restore higher thresholds once the codebase stabilizes.

apps/wallet-mobile/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts (1)

99-99: Improved query dependency chain to prevent potential race conditions.

The addition of Boolean(ptPriceQuery?.data) to the enabled condition ensures that the portfolio token chart query only executes when primary token price data is available. This prevents potential issues where the chart query might attempt to run before having the necessary price data.

For additional clarity, you could extract this condition into a named variable:

- enabled: tokenInfo && isPrimaryToken(tokenInfo.info) && Boolean(ptPriceQuery?.data),
+ const hasPriceData = Boolean(ptPriceQuery?.data);
+ enabled: tokenInfo && isPrimaryToken(tokenInfo.info) && hasPriceData,
packages/common/src/utils/strings.test.ts (1)

69-74: Test cases for asciiToHex function.

The test cases cover basic functionality of converting ASCII strings to hexadecimal representation. Consider adding edge cases such as empty strings and special characters for more comprehensive testing.

 describe('asciiToHex', () => {
   test('converts ascii to hex correctly', () => {
     expect(asciiToHex('hello')).toBe('68656c6c6f')
     expect(asciiToHex('world')).toBe('776f726c64')
   })
+
+  test('handles edge cases correctly', () => {
+    expect(asciiToHex('')).toBe('')
+    expect(asciiToHex('!@#$')).toBe('21402324')
+    expect(asciiToHex(' ')).toBe('20')
+  })
 })
apps/wallet-mobile/src/features/Transactions/common/HeaderRightSwap.tsx (1)

9-18: Nicely structured component but consider design consistency

The component is well-structured using React.memo for performance optimization and properly typed navigation. However, there are two points to consider:

  1. The component uses Icon.TermsOfUse which semantically doesn't align with a swap orders functionality - this could be confusing to users.
  2. There's an inline style that could be moved to a styled component for better maintainability.

Consider using a more semantically appropriate icon that visually communicates "swap orders" rather than terms of use, and extract the inline styling:

-  return (
-    <TouchableOpacity onPress={() => navigation.navigate('swap-orders')} style={{paddingRight: 8}}>
-      <Icon.TermsOfUse color={color.gray_max} size={24} />
-    </TouchableOpacity>
-  )
+  return (
+    <TouchableOpacity onPress={() => navigation.navigate('swap-orders')} style={styles.container}>
+      <Icon.Portfolio2 color={color.gray_max} size={24} />
+    </TouchableOpacity>
+  )
+}
+
+const styles = {
+  container: {
+    paddingRight: 8
+  }
apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolIcon.tsx (1)

1-28: LGTM! Well-structured component with proper fallback.

The ProtocolIcon component is well-implemented with:

  • Proper TypeScript typing
  • Good use of the Record type for the icon mapping
  • Appropriate fallback to a generic swap icon when no matching protocol icon is found

Consider adding JSDoc comments to document the purpose and usage of the component:

+/**
+ * Renders an appropriate icon for the given swap protocol
+ * @param protocol - The swap protocol identifier
+ * @param size - Icon size in pixels
+ */
 export const ProtocolIcon = ({protocol, size}: Props) => {
   const IconVariant = icons[getDexByProtocol(protocol)] ?? Icon.Swap
   return <IconVariant size={size} />
 }
apps/wallet-mobile/src/features/Swap/common/filterBySearch.ts (1)

5-10: Improved type safety with broader input handling.

The function now properly handles both string and object inputs, with an explicit type guard to safely handle different input types.

Consider using optional chaining for a more concise implementation:

-  return (item: string | {ticker?: string; name?: string; symbol?: string}) => {
-    if (typeof item === 'string') return false
-
-    const name = normalizeString(item.name ?? '')
-    const ticker = normalizeString(item.ticker ?? '')
-    const symbol = normalizeString(item.symbol ?? '')
+  return (item: string | {ticker?: string; name?: string; symbol?: string}) => {
+    if (typeof item === 'string') return false
+
+    const name = normalizeString(item?.name ?? '')
+    const ticker = normalizeString(item?.ticker ?? '')
+    const symbol = normalizeString(item?.symbol ?? '')

However, this is unnecessary since TypeScript knows that item is not a string after the type guard, making the current implementation correct and clean.

apps/wallet-mobile/src/features/Swap/common/SwapInfoLink/SwapInfoLink.tsx (1)

2-2: Great refactor using the standard Button component.

Replacing custom TouchableOpacity/Text implementation with the standardized Button component improves code consistency and maintainability. This aligns with best practices by leveraging reusable components.

For even better consistency, consider using a constant for the button title that includes the URL in its name, like SWAP_INFO_LINK_TEXT.

Also applies to: 4-4, 12-16

apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/Overview/OverviewTab.tsx (1)

465-467: Good enhancement to allow customizable modal height.

Exporting the ReviewDetailsProps type and adding an optional height property improves flexibility when using the Details component. This allows consumers to adjust the modal size based on content needs.

Consider adding a descriptive comment to the exported type to help other developers understand its purpose and usage.

Also applies to: 477-477

apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolAvatar.tsx (2)

16-19: Potential edge case in protocol name formatting

The code replaces only the first hyphen in the protocol name, which might lead to inconsistent formatting for protocol names with multiple hyphens.

Consider using replace(/-/g, ' ') to replace all hyphens with spaces:

-  const formattedName = `${protocol.charAt(0).toUpperCase()}${protocol.slice(1).replace(/-/, ' ')}${append}`
+  const formattedName = `${protocol.charAt(0).toUpperCase()}${protocol.slice(1).replace(/-/g, ' ')}${append}`

20-31: No error handling for Linking.openURL

The component calls Linking.openURL() directly without error handling, which could cause issues if the URL is invalid or the link cannot be opened.

Consider adding error handling for the link opening:

-      onPress={onPress ?? (() => Linking.openURL(getDexUrlByProtocol(protocol)))}
+      onPress={onPress ?? (() => {
+        const url = getDexUrlByProtocol(protocol)
+        Linking.openURL(url).catch(error => {
+          console.warn(`Failed to open URL: ${url}`, error)
+        })
+      })}
packages/portfolio/src/helpers/create-unknown-token-info.ts (1)

5-13: Token name extraction logic could be more robust.

The function extracts the asset name from the token ID by splitting on '.', but doesn't explicitly handle cases where the ID doesn't contain a dot separator. While you're correctly handling potential undefined values with the nullish coalescing operator in line 11, it would be more explicit to add validation or a fallback for IDs without a dot.

Consider adding a more explicit check or improved error handling:

-  const [, assetNameHex] = id.split('.')
+  const parts = id.split('.')
+  const assetNameHex = parts.length > 1 ? parts[1] : ''
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/WarnLimitPrice.tsx (1)

53-95: Consider memoizing styles for optimization

The useStyles function creates a new StyleSheet on every render. While this is likely not a performance bottleneck for this component, consider using React.useMemo to optimize it:

-const useStyles = () => {
+const useStyles = () => {
   const {color, atoms} = useTheme()
-  const styles = StyleSheet.create({
+  const styles = React.useMemo(() => StyleSheet.create({
     container: {
       ...atoms.justify_between,
       ...atoms.flex_1,
       ...atoms.px_lg,
       ...atoms.pb_lg,
     },
     // rest of the styles...
-  })
+  }), [color, atoms])

   return styles
 }
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectProtocolScreen.tsx (2)

30-33: Memoize the formatPrice function to improve performance

The formatPrice function is recreated on every render. Use useCallback to memoize it:

-  const formatPrice = (price: number) => {
+  const formatPrice = React.useCallback((price: number) => {
     const roundedPrice = price.toFixed(tokenOutInfo?.decimals ?? 0).replace(/\.0+$/, '')
     return roundedPrice !== '0' ? roundedPrice : price.toFixed(6)
-  }
+  }, [tokenOutInfo?.decimals])

88-132: Consider memoizing the styles and colors objects

Similar to the WarnLimitPrice component, the styles and colors objects could be memoized for optimization:

 const useStyles = () => {
   const {color, atoms} = useTheme()

-  const styles = StyleSheet.create({
+  const styles = React.useMemo(() => StyleSheet.create({
     // styles definition
-  })
+  }), [color, atoms])

-  const colors = {
+  const colors = React.useMemo(() => ({
     gradient: color.bg_gradient_1,
     baseGradient: 'transparent',
-  }
+  }), [color])

   return {styles, colors}
 }
apps/wallet-mobile/src/features/Transactions/useCases/TxHistory/ActionsBanner.tsx (2)

61-66: Consider consolidating swap actions into a single dispatch.
Currently, multiple actions run sequentially (reset, tokenId changes, input touched). It’s fine, but consider a single composite action if you find a need to keep these changes atomic or reduce dispatch overhead.

 swapForm.action({type: 'ResetForm'})

 if (tokenOutId !== undefined) {
-  swapForm.action({type: 'TokenOutIdChanged', value: tokenOutId})
-  swapForm.action({type: 'TokenOutInputTouched'})
+  swapForm.action({
+    type: 'ResetFormAndSetTokenOut',
+    payload: { tokenOutId },
+  })
 }

73-74: Hard-coded swap parameters.
Using fixed 'market' order type and 1 slippage tolerance is straightforward for a baseline. If you want adjustable or user-configurable options in the future, consider exposing these as parameters or reading from config.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/EstimateSummary.tsx (1)

136-156: Check for potential division by zero in percentage calculation

The percentage calculation could potentially cause a division by zero if all splits have zero expected output.

Consider adding a guard against division by zero:

- const total = data.reduce((acc, curr) => (acc += curr.expectedOutputWithoutSlippage), 0)
+ const total = data.reduce((acc, curr) => (acc += curr.expectedOutputWithoutSlippage), 0)
+ 
  return (
    <View style={styles.list}>
      {[...data]
        .sort((a, b) => b.expectedOutputWithoutSlippage - a.expectedOutputWithoutSlippage)
        .map((split, index) => (
          <View key={index} style={[styles.composedText, styles.between]}>
            <ProtocolAvatar protocol={split.protocol} preventOpenLink />

            <Text style={styles.textValue}>
-              {((100 * (split.expectedOutputWithoutSlippage ?? 0)) / total).toFixed(2)} %
+              {total > 0 ? ((100 * (split.expectedOutputWithoutSlippage ?? 0)) / total).toFixed(2) : '0.00'} %
            </Text>
          </View>
        ))}
    </View>
  )
apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx (1)

57-64: Modal-based token details display.
This is a clean approach to show more info without cluttering the main UI. Be mindful of extra-long content in smaller screens.

Possibly add a scrollable content wrapper or smaller fallback height for very small screens.

apps/wallet-mobile/src/features/ReviewTx/common/ConfirmRawTxWithHw.tsx (1)

100-115: useSignRawTxWithHw custom hook for signing.
Well-structured mutation to sign a raw transaction with Ledger. The useErrorBoundary is a nice addition for error handling.

Consider providing a success/failure callback or event to inform the parent about any errors, ensuring more robust user feedback.

apps/wallet-mobile/src/features/Transactions/TxHistoryNavigator.tsx (1)

247-248: Title is set to "settings"

No issues, though consider clarifying if these are specifically “Swap Settings” to distinguish from general app settings.

apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx (1)

31-31: Return null if createTx is undefined

Consider providing a fallback UI or redirecting the user instead of returning null.

apps/wallet-mobile/src/features/Swap/common/strings.ts (1)

179-183: New strings "from", "to", "sell", "buy", and "max"

No immediate issues, though consider consolidating with existing "swapFrom"/"swapTo" to avoid confusion.

apps/wallet-mobile/src/features/Portfolio/common/hooks/usePortfolioImage.ts (1)

74-75: Clarify fallback MIME type for iOS GIF support.

The fallback to image/gif when Platform.OS === 'ios' is helpful but warrants a comment clarifying this decision, since older iOS versions may have known limitations with WebP.

+ // Fallback to GIF on iOS for compatibility with older versions that may not fully support WebP
const needsGif = mediaType === 'image/gif' && Platform.OS === 'ios'
apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/TransactionSummary.tsx (3)

2-2: Consider partial lodash imports for bundle size optimization.

Using the full lodash package may increase bundle size. If only a few lodash functions are used, consider importing them individually (e.g., import get from 'lodash/get') to reduce overhead.


29-39: Watch out for precision loss with large token amounts.

Calling Number(...) on potentially large or highly precise token amounts (especially if decimals are high) risks floating-point precision issues before calling Math.floor(...). Consider using a big-number library or string-based approach to avoid rounding errors for large tokens.


108-108: Consider a milder user-facing approach for "moderate" price impact.

Your conditions merge both "moderate" and "high" price impacts in the same check. This can lead to a similar user experience for both severity levels. If desired, consider showing a less intrusive warning for "moderate" risk to maintain user trust.

apps/wallet-mobile/src/features/Swap/common/SwapProvider.tsx (1)

70-75: Potential repeated refetch on focus.

useFocusEffect(refetches) triggers queries on every screen focus. This might be fine, but if your swap flow is advanced or the user navigates in and out frequently, it could become costly. Consider adding logic to throttle or conditionally refetch only when data is stale.

apps/wallet-mobile/src/features/Swap/common/AmountCard/AmountCard.tsx (2)

59-65: Enforce consistent styling across different swap states.

You’re dynamically applying multiple styles (styles.container, styles.background, styles.active, etc.). Ensure the final UI appearance remains consistent, particularly with combined states (e.g. if error is present and also focused).


70-84: Guard the "Max" button usage.

For line 77, consider edge cases where the wallet balance might still be finalizing or if we have insufficient on-chain data. Provide a fallback or disable the button if the balance is undefined/slow to load.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6178e96 and 410de38.

📒 Files selected for processing (147)
  • apps/wallet-mobile/.storybook/storybook.requires.js (0 hunks)
  • apps/wallet-mobile/src/WalletNavigator.tsx (2 hunks)
  • apps/wallet-mobile/src/components/Button/Button.tsx (4 hunks)
  • apps/wallet-mobile/src/components/ExpandableInfoCard/ExpandableInfoCard.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/components/ExpandableInfoCard/ExpandableInfoCard.tsx (0 hunks)
  • apps/wallet-mobile/src/components/Icon/Chevron.tsx (1 hunks)
  • apps/wallet-mobile/src/components/Icon/Icon.stories.tsx (1 hunks)
  • apps/wallet-mobile/src/components/Icon/Info.tsx (1 hunks)
  • apps/wallet-mobile/src/components/Icon/Portfolio2.tsx (1 hunks)
  • apps/wallet-mobile/src/components/Icon/Refresh.tsx (1 hunks)
  • apps/wallet-mobile/src/components/Icon/Swap.tsx (1 hunks)
  • apps/wallet-mobile/src/components/Icon/index.ts (2 hunks)
  • apps/wallet-mobile/src/components/MediaPreview/MediaPreview.tsx (2 hunks)
  • apps/wallet-mobile/src/components/NftPreview/NftPreview.tsx (2 hunks)
  • apps/wallet-mobile/src/components/RefreshButton/RefreshButton.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Discover/useDappConnectorManager.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Exchange/common/AmountCard/AmountCard.tsx (2 hunks)
  • apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx (7 hunks)
  • apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenInfoIcon.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Portfolio/common/hooks/useGetPortfolioTokenChart.ts (1 hunks)
  • apps/wallet-mobile/src/features/Portfolio/common/hooks/useNavigateTo.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Portfolio/common/hooks/usePortfolioImage.ts (3 hunks)
  • apps/wallet-mobile/src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts (1 hunks)
  • apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/Actions.tsx (3 hunks)
  • apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TradeTokensBannerBig.tsx (1 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/common/ConfirmRawTxWithHw.tsx (1 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/common/TokenDetails.tsx (6 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/common/WalletBalance.tsx (1 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/common/hooks/useOnConfirm.tsx (1 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/common/hooks/useStrings.tsx (2 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/Overview/OverviewTab.tsx (2 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/ReviewTx.tsx (2 hunks)
  • apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx (5 hunks)
  • apps/wallet-mobile/src/features/Swap/SwapNavigator.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/AmountCard/AmountCard.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/AmountCard/AmountCard.tsx (2 hunks)
  • apps/wallet-mobile/src/features/Swap/common/ButtonGroup/ButtonGroup.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/ButtonGroup/ButtonGroup.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/ConfirmRawTx/ConfirmRawTx.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/Counter/Counter.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/LiquidityPool/LiquidityPool.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/LiquidityPool/LiquidityPool.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/PoolIcon/PoolIcon.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolAvatar.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolIcon.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/SwapFormProvider.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/SwapInfoLink/SwapInfoLink.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/SwapProvider.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/constants.ts (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/entries.test.ts (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/entries.ts (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/filterBySearch.ts (1 hunks)
  • apps/wallet-mobile/src/features/Swap/common/mocks.ts (0 hunks)
  • apps/wallet-mobile/src/features/Swap/common/navigation.ts (3 hunks)
  • apps/wallet-mobile/src/features/Swap/common/strings.ts (6 hunks)
  • apps/wallet-mobile/src/features/Swap/common/useSwapConfig.ts (2 hunks)
  • apps/wallet-mobile/src/features/Swap/common/useSwapTx.ts (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/EstimateSummary.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/LimitInput.tsx (3 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectProtocolScreen.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectTokenScreen.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/ShowPriceImpact.tsx (2 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SwapMainScreen.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/WarnLimitPrice.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/WarnSlippage.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/ListOrders/ListOrders.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx (5 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/TransactionSummary.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/TransactionSummary.tsx (3 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/ShowSubmittedTxScreen/SubmittedTxScreen.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/ResetQuantities.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/ResetQuantities.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/SwitchTokens.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/SwitchTokens.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/OrderActions/OrderActions.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/OrderActions/OrderActions.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/EditBuyAmount.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/EditBuyAmount.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/SelectPoolFromListScreen/SelectPoolFromListScreen.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/SelectPoolFromListScreen/SelectPoolFromListScreen.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/ShowPoolActions.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/ShowPoolActions.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPrice/EditPrice.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/EditSellAmount.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/EditSellAmount.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippage.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippage.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippageScreen/EditSlippageScreen.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageActions.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageActions.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageInfo.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageInfo.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/StartSwapOrder.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/StartSwapOrderScreen.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnLimitPrice/WarnLimitPrice.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnLimitPrice/WarnLimitPrice.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnPriceImpact/WarnPriceImpact.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnPriceImpact/WarnPriceImpact.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnSlippage/WarnSlippage.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/CompletedOrders.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/CompletedOrders.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/ListOrders.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/ListOrders.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/OpenOrders.stories.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/OpenOrders.tsx (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/helpers.ts (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/mapOrders.ts (0 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/SwapSettings/SwapSettings.tsx (6 hunks)
  • apps/wallet-mobile/src/features/Swap/useCases/index.ts (0 hunks)
  • apps/wallet-mobile/src/features/Transactions/TxHistoryNavigator.tsx (5 hunks)
  • apps/wallet-mobile/src/features/Transactions/common/HeaderRightSwap.tsx (1 hunks)
  • apps/wallet-mobile/src/features/Transactions/useCases/TxHistory/ActionsBanner.tsx (4 hunks)
  • apps/wallet-mobile/src/hooks/useShowCollateralNotFoundAlert.tsx (1 hunks)
  • apps/wallet-mobile/src/kernel/features.ts (1 hunks)
  • apps/wallet-mobile/src/kernel/i18n/global-messages.ts (1 hunks)
  • apps/wallet-mobile/src/kernel/i18n/locales/en-US.json (5 hunks)
  • apps/wallet-mobile/src/kernel/navigation.tsx (3 hunks)
  • apps/wallet-mobile/src/yoroi-wallets/cardano/api/fetch.ts (1 hunks)
  • apps/wallet-mobile/src/yoroi-wallets/hooks/index.ts (3 hunks)
  • apps/wallet-mobile/translations/messages/src/WalletNavigator.json (1 hunks)
  • apps/wallet-mobile/translations/messages/src/features/ReviewTx/common/hooks/useStrings.json (1 hunks)
  • apps/wallet-mobile/translations/messages/src/features/Swap/common/AmountCard/AmountCard.json (1 hunks)
  • apps/wallet-mobile/translations/messages/src/features/Swap/common/strings.json (1 hunks)
  • apps/wallet-mobile/translations/messages/src/features/Transactions/TxHistoryNavigator.json (1 hunks)
  • apps/wallet-mobile/translations/messages/src/kernel/i18n/global-messages.json (4 hunks)
  • packages/common/src/utils/strings.test.ts (2 hunks)
  • packages/common/src/utils/strings.ts (1 hunks)
  • packages/portfolio/src/adapters/dullahan-api/api-maker.test.ts (3 hunks)
  • packages/portfolio/src/adapters/dullahan-api/api-maker.ts (2 hunks)
  • packages/portfolio/src/adapters/dullahan-api/transformers.test.ts (1 hunks)
  • packages/portfolio/src/adapters/dullahan-api/transformers.ts (2 hunks)
  • packages/portfolio/src/helpers/create-cached-unknown-token-info.test.ts (1 hunks)
  • packages/portfolio/src/helpers/create-cached-unknown-token-info.ts (1 hunks)
  • packages/portfolio/src/helpers/create-unknown-token-info.test.ts (2 hunks)
  • packages/portfolio/src/helpers/create-unknown-token-info.ts (1 hunks)
  • packages/swap/README.md (1 hunks)
  • packages/swap/package.json (1 hunks)
💤 Files with no reviewable changes (63)
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageInfo.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageInfo.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/SwitchTokens.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageActions.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/ListOrders.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPrice/EditPrice.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/ResetQuantities.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippageScreen/EditSlippageScreen.stories.tsx
  • apps/wallet-mobile/.storybook/storybook.requires.js
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippage.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/AmountActions.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/ShowPoolActions.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/ButtonGroup/ButtonGroup.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/StartSwapOrder.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/SelectPoolFromListScreen/SelectPoolFromListScreen.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/mocks.ts
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnLimitPrice/WarnLimitPrice.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/index.ts
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/OpenOrders.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnSlippage/WarnSlippage.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/LiquidityPool/LiquidityPool.stories.tsx
  • apps/wallet-mobile/src/components/ExpandableInfoCard/ExpandableInfoCard.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/CompletedOrders.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/PoolIcon/PoolIcon.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/ShowSlippageActions.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/SwitchTokens.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/AmountCard/AmountCard.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/OrderActions/OrderActions.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/EditSellAmount.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/LiquidityPool/LiquidityPool.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/OrderActions/OrderActions.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/TransactionSummary.stories.tsx
  • apps/wallet-mobile/src/features/Swap/common/ButtonGroup/ButtonGroup.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/ListOrders.tsx
  • apps/wallet-mobile/src/features/Swap/common/useSwapTx.ts
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/EditBuyAmount.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/Actions/AmountActions/ResetQuantities.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/mapOrders.ts
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/helpers.ts
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/SelectPoolFromListScreen/SelectPoolFromListScreen.tsx
  • apps/wallet-mobile/src/features/Swap/SwapNavigator.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnLimitPrice/WarnLimitPrice.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/OpenOrders.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnPriceImpact/WarnPriceImpact.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSlippage/EditSlippage.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx
  • apps/wallet-mobile/src/features/Swap/common/entries.ts
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/StartSwapOrderScreen.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditSellAmount/EditSellAmount.tsx
  • apps/wallet-mobile/src/features/Swap/common/ConfirmRawTx/ConfirmRawTx.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/WarnPriceImpact/WarnPriceImpact.stories.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/ListOrders/CompletedOrders.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditPool/ShowPoolActions.tsx
  • apps/wallet-mobile/src/features/Swap/common/SelectPool/SelectPoolFromList/SelectPoolFromList.tsx
  • apps/wallet-mobile/src/features/Swap/common/SwapFormProvider.tsx
  • apps/wallet-mobile/src/components/ExpandableInfoCard/ExpandableInfoCard.tsx
  • apps/wallet-mobile/src/features/Swap/useCases/StartOrderSwapScreen/CreateOrder/EditBuyAmount/EditBuyAmount.tsx
  • apps/wallet-mobile/src/features/Swap/common/entries.test.ts
🧰 Additional context used
🧬 Code Graph Analysis (25)
apps/wallet-mobile/src/components/Icon/Icon.stories.tsx (1)
apps/wallet-mobile/src/components/Icon/index.ts (1)
  • Icon (148-295)
apps/wallet-mobile/src/features/ReviewTx/common/WalletBalance.tsx (1)
apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenInfoIcon.tsx (1)
  • TokenInfoIcon (16-48)
apps/wallet-mobile/src/features/Swap/common/Counter/Counter.tsx (1)
packages/theme/src/atoms/atoms.ts (1)
  • atoms (253-446)
packages/common/src/utils/strings.test.ts (1)
packages/common/src/utils/strings.ts (2)
  • hexToAscii (36-45)
  • asciiToHex (47-51)
apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/ReviewTx.tsx (1)
apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/Overview/OverviewTab.tsx (1)
  • ReviewDetailsProps (465-465)
apps/wallet-mobile/src/components/NftPreview/NftPreview.tsx (1)
apps/wallet-mobile/src/features/Portfolio/common/hooks/usePortfolioImage.ts (1)
  • usePortfolioImage (59-133)
apps/wallet-mobile/src/features/Exchange/common/AmountCard/AmountCard.tsx (1)
apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenInfoIcon.tsx (1)
  • TokenInfoIcon (16-48)
packages/portfolio/src/adapters/dullahan-api/api-maker.test.ts (1)
packages/portfolio/src/adapters/token-history.mocks.ts (1)
  • tokenHistoryMocks (75-83)
packages/portfolio/src/helpers/create-unknown-token-info.ts (1)
packages/common/src/utils/strings.ts (1)
  • hexToAscii (36-45)
apps/wallet-mobile/src/features/Transactions/common/HeaderRightSwap.tsx (3)
apps/wallet-mobile/src/kernel/navigation.tsx (1)
  • TxHistoryRouteNavigation (167-167)
packages/theme/src/ThemeProvider.tsx (1)
  • useTheme (65-66)
apps/wallet-mobile/src/components/Icon/index.ts (1)
  • Icon (148-295)
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/WarnLimitPrice.tsx (2)
packages/theme/src/ThemeProvider.tsx (1)
  • useTheme (65-66)
packages/theme/src/atoms/atoms.ts (1)
  • atoms (253-446)
apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/Actions.tsx (3)
apps/wallet-mobile/src/features/Swap/common/SwapProvider.tsx (1)
  • useSwap (21-21)
apps/wallet-mobile/src/kernel/metrics/metricsManager.tsx (1)
  • useMetrics (351-351)
packages/portfolio/src/helpers/is-primary-token.ts (1)
  • isPrimaryToken (10-21)
apps/wallet-mobile/src/features/Swap/common/useSwapConfig.ts (3)
apps/wallet-mobile/src/features/Swap/common/SwapProvider.tsx (1)
  • useSwap (21-21)
packages/portfolio/src/adapters/dullahan-api/api-maker.ts (1)
  • tokenInfos (89-136)
apps/wallet-mobile/src/features/Swap/common/constants.ts (1)
  • undefinedToken (7-7)
packages/portfolio/src/helpers/create-unknown-token-info.test.ts (1)
packages/portfolio/src/helpers/create-unknown-token-info.ts (1)
  • createUnknownTokenInfo (5-33)
apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolAvatar.tsx (5)
packages/types/src/index.ts (2)
  • Protocol (362-362)
  • Protocol (363-363)
packages/swap/src/helpers/getDexUrlByProtocol.ts (1)
  • getDexUrlByProtocol (6-8)
apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolIcon.tsx (1)
  • ProtocolIcon (12-15)
packages/theme/src/ThemeProvider.tsx (1)
  • useTheme (65-66)
packages/theme/src/atoms/atoms.ts (1)
  • atoms (253-446)
packages/portfolio/src/adapters/dullahan-api/transformers.test.ts (2)
packages/types/src/index.ts (8)
  • TokenInfosResponse (575-575)
  • Api (340-340)
  • Api (358-358)
  • Api (491-495)
  • Api (510-510)
  • Api (580-580)
  • Api (676-676)
  • Api (685-685)
packages/portfolio/src/adapters/dullahan-api/transformers.ts (1)
  • toSecondaryTokenInfos (14-51)
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/EstimateSummary.tsx (13)
apps/wallet-mobile/src/features/Swap/common/strings.ts (1)
  • useStrings (5-185)
apps/wallet-mobile/src/features/WalletManager/common/hooks/useSelectedWallet.tsx (1)
  • useSelectedWallet (8-21)
apps/wallet-mobile/src/features/Swap/common/SwapProvider.tsx (1)
  • useSwap (21-21)
apps/wallet-mobile/src/components/Modal/ModalContext.tsx (1)
  • useModal (35-41)
apps/wallet-mobile/src/features/Swap/common/navigation.ts (1)
  • useNavigateTo (6-41)
apps/wallet-mobile/src/features/Swap/common/constants.ts (1)
  • undefinedToken (7-7)
apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolAvatar.tsx (1)
  • ProtocolAvatar (16-31)
apps/wallet-mobile/src/components/Button/Button.tsx (1)
  • Button (33-84)
apps/wallet-mobile/src/features/Swap/common/SwapInfoLink/SwapInfoLink.tsx (1)
  • SwapInfoLink (9-18)
apps/wallet-mobile/src/components/Icon/index.ts (1)
  • Icon (148-295)
packages/swap/src/adapters/api/muesliswap/types.ts (1)
  • Split (162-176)
packages/theme/src/ThemeProvider.tsx (1)
  • useTheme (65-66)
packages/theme/src/atoms/atoms.ts (1)
  • atoms (253-446)
packages/portfolio/src/helpers/create-cached-unknown-token-info.ts (1)
packages/portfolio/src/helpers/create-unknown-token-info.ts (1)
  • createUnknownTokenInfo (5-33)
apps/wallet-mobile/src/kernel/navigation.tsx (1)
apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/Overview/OverviewTab.tsx (1)
  • ReviewDetailsProps (465-465)
apps/wallet-mobile/src/features/Transactions/TxHistoryNavigator.tsx (6)
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SwapMainScreen.tsx (1)
  • SwapMainScreen (28-186)
apps/wallet-mobile/src/features/Transactions/common/HeaderRightSwap.tsx (1)
  • HeaderRightSwap (9-18)
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectTokenScreen.tsx (1)
  • SelectTokenScreen (34-73)
apps/wallet-mobile/src/features/Swap/useCases/ListOrders/ListOrders.tsx (1)
  • ListOrders (38-109)
apps/wallet-mobile/src/features/Swap/useCases/SwapSettings/SwapSettings.tsx (1)
  • SwapSettings (42-179)
apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectProtocolScreen.tsx (1)
  • SelectProtocolScreen (15-86)
apps/wallet-mobile/src/features/Portfolio/common/hooks/usePortfolioImage.ts (2)
apps/wallet-mobile/src/kernel/logger/logger.ts (1)
  • logger (97-97)
apps/wallet-mobile/src/kernel/env.ts (1)
  • isDev (12-12)
apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx (7)
apps/wallet-mobile/src/features/ReviewTx/common/ReviewTxProvider.tsx (1)
  • useReviewTx (16-16)
apps/wallet-mobile/src/kernel/navigation.tsx (2)
  • useUnsafeParams (17-21)
  • ReviewTxRoutes (293-312)
apps/wallet-mobile/src/kernel/env.ts (1)
  • isDev (12-12)
apps/wallet-mobile/src/features/ReviewTx/common/CopiableText.tsx (1)
  • CopyButton (31-39)
apps/wallet-mobile/src/features/ReviewTx/common/hooks/useTxBody.tsx (1)
  • useTxBody (7-37)
apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedTx.tsx (1)
  • useFormattedTx (26-82)
apps/wallet-mobile/src/features/ReviewTx/common/hooks/useFormattedMetadata.tsx (1)
  • useFormattedMetadata (58-75)
packages/portfolio/src/adapters/dullahan-api/transformers.ts (1)
packages/portfolio/src/validators/token-info.ts (1)
  • parseSecondaryTokenInfoWithCacheRecord (85-89)
apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx (1)
apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenInfoIcon.tsx (1)
  • TokenInfoIcon (16-48)
apps/wallet-mobile/src/hooks/useShowCollateralNotFoundAlert.tsx (1)
apps/wallet-mobile/src/yoroi-wallets/cardano/types.ts (1)
  • YoroiWallet (58-182)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: check
🔇 Additional comments (239)
packages/common/src/utils/strings.ts (1)

47-51: Well-implemented ASCII to hex conversion.

The function correctly converts ASCII string to hexadecimal representation with proper padding.

apps/wallet-mobile/src/features/Discover/useDappConnectorManager.tsx (1)

6-6: Updated import path for relocated hook.

The import path has been correctly updated to use the hook from its new location.

apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TokenBalanceItem.tsx (1)

46-46: Icon size increased for consistency—looks good.

The TokenInfoIcon size prop update to "lg" improves visual consistency and aligns with the refactored icon component. No issues found.

apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioDashboard/DashboardTokensList/DashboardTokenItem.tsx (1)

73-73: Icon size increased for consistency—looks good.

The TokenInfoIcon size prop update to "lg" ensures consistent icon sizing across the app. No issues found.

apps/wallet-mobile/src/features/ReviewTx/common/WalletBalance.tsx (1)

113-113: Icon size increased for consistency—looks good.

The TokenInfoIcon size prop update to "lg" ensures consistent icon sizing across the app. No issues found.

apps/wallet-mobile/src/kernel/features.ts (1)

15-15: New feature flag added—looks good.

The swapTokenLinks flag is added for feature toggling. No issues found.

apps/wallet-mobile/src/components/Icon/Icon.stories.tsx (1)

213-214: LGTM! Added Portfolio2 icon to the Icon gallery.

The new Portfolio2 icon is correctly added to the storybook gallery, maintaining consistent formatting with other icon entries.

apps/wallet-mobile/src/components/Icon/Info.tsx (1)

8-8: SVG viewBox adjustments look good.

The viewBox is now shifted from "-2 -2 25 25" to "-1 -1 25 25", which adjusts the icon's coordinate system by 1 unit right and 1 unit down. This likely improves the icon's visual alignment.

packages/portfolio/src/helpers/create-cached-unknown-token-info.test.ts (1)

6-7: Test updated to match refactored token naming convention.

The test now correctly reflects the updated token naming pattern, changing from "Unknown (id)" to "id (unknown)" and using a more specific token ID example.

apps/wallet-mobile/src/features/ReviewTx/common/hooks/useOnConfirm.tsx (1)

13-13:

❓ Verification inconclusive

Check component import path casing.

The import statement imports ConfirmRawTxWithHW (uppercase "HW") but the file path is ../ConfirmRawTxWithHw (lowercase "w"). This casing mismatch could cause issues on case-sensitive file systems.


🏁 Script executed:

#!/bin/bash
# Check if the file exists with the expected casing
ls -la ../src/features/ReviewTx/common/ConfirmRawTx* 2>/dev/null || echo "Files not found with this pattern"

# Check both possible casings to determine which is correct
find ../src/features/ReviewTx/common -type f -name "ConfirmRawTxWith*.tsx" 2>/dev/null

Length of output: 210


Action Required: Verify Component Import Casing

The import in
apps/wallet-mobile/src/features/ReviewTx/common/hooks/useOnConfirm.tsx (line 13)

import { ConfirmRawTxWithHW } from '../ConfirmRawTxWithHw'

appears to have a casing mismatch—the imported identifier uses ConfirmRawTxWithHW (uppercase "HW") while the file path uses ConfirmRawTxWithHw (with a lowercase "w"). Our initial shell script (which searched from an incorrect relative path) did not yield a file match; this result may be due to an inaccurate search pattern rather than the file’s absence.

Please manually verify the following:

  • File Location & Name: In the parent directory (apps/wallet-mobile/src/features/ReviewTx/common), confirm whether the file is named ConfirmRawTxWithHW.tsx (or similar) or if the current file name (with lowercase "w") is intended.
  • Consistency: Ensure that the casing in the import statement exactly matches the actual file name. On case-sensitive file systems, any discrepancy could lead to runtime errors.

Please adjust either the import or the file name as necessary to resolve the potential issue.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/WarnSlippage.tsx (1)

5-8: Import paths have been simplified.

The import paths have been shortened to use relative imports, which reflects the project's directory reorganization as part of the swap feature refactoring. This change maintains the same functionality while improving code organization.

apps/wallet-mobile/src/features/Swap/common/constants.ts (2)

1-2: Added Portfolio namespace import.

Importing the Portfolio namespace from @yoroi/types to support the new undefinedToken constant.


7-7: Added standardized fallback token identifier.

This new constant provides a consistent way to represent unknown or undefined tokens throughout the swap feature, aligning with the broader token handling refactoring.

apps/wallet-mobile/src/features/Swap/common/Counter/Counter.tsx (2)

47-47: Font weight adjusted for counterText style.

Changed from medium to regular weight, properly aligning the style with its naming convention.


51-51: Font weight adjusted for counterTextBold style.

Changed from regular to medium weight, making the "bold" style actually bolder than the regular counterText style, which improves visual distinction between the two styles.

apps/wallet-mobile/src/kernel/i18n/global-messages.ts (1)

564-567: Added 'sell' action message for localization.

This new localization entry supports the swap feature's UI, ensuring consistent terminology for the sell action across the application.

apps/wallet-mobile/src/components/Icon/Swap.tsx (1)

6-6: Added default color for Swap icon.

Added grey as the default color for the Swap icon, improving component usability by not requiring callers to specify a color explicitly. This follows the same pattern used for the size prop.

apps/wallet-mobile/src/components/Icon/index.ts (2)

87-87: Added new Portfolio2 icon component import.

The import statement correctly adds the Portfolio2 icon component from the relative path.


260-260: Added Portfolio2 to the exported Icon object.

The Portfolio2 icon is properly added to the exported Icon object, making it available for use throughout the application.

packages/portfolio/src/helpers/create-unknown-token-info.test.ts (2)

8-9: Updated test case with more specific token ID and name.

The updated token ID and name values provide a more realistic test case for the createUnknownTokenInfo function.


33-46: Added test case for token IDs without dot suffix.

This new test case properly verifies the behavior of createUnknownTokenInfo when dealing with token IDs that don't contain a dot suffix. The test confirms that:

  1. The function returns the same ID
  2. It sets a default name of ' (unknown)' when no ASN can be extracted
  3. The returned object is properly frozen (immutable)

This is a good addition that improves test coverage for edge cases.

apps/wallet-mobile/src/components/NftPreview/NftPreview.tsx (2)

10-10: Updated import to use centralized portfolio image hook.

Replaced the previous image hook import with the new centralized usePortfolioImage hook, which is part of a broader refactoring to standardize image handling across the application.


37-45: Migrated to usePortfolioImage hook.

The component now uses the usePortfolioImage hook instead of the previous useNativeAssetImage hook. The new hook provides improved image fetching, caching, and error handling, with features like retry logic and loading state management.

The parameters passed to the hook maintain the same functionality, ensuring a smooth transition to the new implementation.

apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokensList/PortfolioWalletTokenList/TradeTokensBannerBig.tsx (1)

18-19: Navigation path simplified

The navigation has been updated from a nested route structure to a direct route. This change aligns with the broader refactoring of the swap feature's navigation structure, making it more straightforward and easier to maintain.

apps/wallet-mobile/src/features/Exchange/common/AmountCard/AmountCard.tsx (2)

9-9: LGTM: TokenInfoIcon import updated

The import path has been correctly updated to reference the TokenInfoIcon component from the Portfolio module.


83-83: Error handling simplified

The TokenInfoIcon component is now used directly without the Boundary wrapper. This is a good simplification since TokenInfoIcon already handles its own error states internally, avoiding redundant error handling layers.

apps/wallet-mobile/translations/messages/src/WalletNavigator.json (1)

7-9: Translation metadata updated to match code changes

The line numbers and index positions in the translation metadata have been correctly updated to reflect the changes in the WalletNavigator.tsx file, where swap-related code was removed. This is essential maintenance to keep translations working properly after refactoring.

Also applies to: 12-14, 22-24, 27-29, 37-39, 42-44, 52-54, 57-59, 67-69, 72-74, 82-84, 87-89, 97-99, 102-104, 112-114, 117-119, 127-129, 132-134, 142-144, 147-149, 157-159, 162-164, 172-174, 177-179

packages/portfolio/src/adapters/dullahan-api/transformers.test.ts (1)

72-98: Improved error handling for malformed responses

The test has been updated to verify the new behavior where malformed token-info entries are silently dropped instead of causing the entire operation to fail. This is a better approach as it:

  1. Makes the system more resilient by continuing to process valid entries
  2. Prevents individual malformed entries from affecting the entire application
  3. Aligns with the implementation change in transformers.ts where errors are now logged rather than thrown

This change will help improve application stability when dealing with partially invalid data.

apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTx/ReviewTx.tsx (2)

22-22: Type alignment with imported ReviewDetailsProps.

Good update replacing the inline type with the imported ReviewDetailsProps type, which helps maintain consistency across components. This change aligns with the updated type definition in the Overview component.


42-43: LGTM: Prop type correctly updated to use imported type.

Proper implementation using the imported ReviewDetailsProps type, which includes support for the optional height property for customizing modal height.

apps/wallet-mobile/src/features/Portfolio/common/hooks/useNavigateTo.tsx (2)

24-26: Navigation structure simplified for swap functionality.

The navigation target has been updated to use the new flat navigation structure with 'swap-main' screen instead of the previous nested navigation approach. This aligns with the swap feature refactoring.


29-31: Navigation target consistently updated for swap function.

Good consistency in updating both resetTabAndSwap and swap functions to use the same navigation target pattern.

packages/common/src/utils/strings.test.ts (2)

1-6: Import statement properly updated to include new utility functions.

The import statement has been updated to include both hexToAscii and asciiToHex functions that are being tested in this file.


57-67: Test cases for hexToAscii function.

Good test coverage for the hexToAscii function including:

  • Positive cases for valid hex to ASCII conversion
  • Edge cases for handling invalid hex input (odd length, non-hex characters)

This ensures the function behaves as expected under various input conditions.

apps/wallet-mobile/translations/messages/src/kernel/i18n/global-messages.json (2)

1637-1651: Added "Sell" translation string to support swap UI updates.

New translation message added with ID global.sell and default message "!!!Sell", which supports the refactored swap feature UI. This string complements the existing global.buy message that follows it.


1652-1666: Line numbers and indexes correctly updated.

The subsequent entry (global.buy) has been properly adjusted with updated line numbers and indexes to accommodate the newly added global.sell entry.

apps/wallet-mobile/src/features/Swap/useCases/ShowSubmittedTxScreen/SubmittedTxScreen.tsx (3)

12-12: Import updated to use new swap architecture

The import has been changed to use the new useSwap hook from the centralized SwapProvider, which is part of the swap feature refactoring.


18-18: State management updated to use new swap context

Updated to use the new useSwap hook instead of the previous useSwapForm, consistent with the architectural changes.


21-21: Form reset logic changed to use action-based approach

The direct function call has been replaced with a dispatch action pattern, aligning with the new state management architecture. This is a good practice as it centralizes state updates and makes them more predictable and easier to debug.

apps/wallet-mobile/src/components/Icon/Chevron.tsx (2)

7-7: Added default direction to Chevron component

Adding a default value for the direction prop improves developer experience by allowing the component to be used with fewer required props when the default down direction is desired.


11-11: Updated type definition to match default prop

The type definition has been updated to correctly mark the direction prop as optional, which is consistent with providing a default value.

apps/wallet-mobile/src/components/Icon/Refresh.tsx (2)

6-6: Simplified Refresh icon component props

The component signature has been simplified to remove the active prop, keeping only the essential size and color props with sensible defaults.


9-9: Removed conditional fill styling from Rect element

The fill attribute has been removed from the Rect element, simplifying the SVG structure. This is consistent with the removal of the active prop and suggests that the active state is now handled differently or is no longer needed.

packages/portfolio/src/adapters/dullahan-api/transformers.ts (2)

28-31: Improved error handling for malformed token info

The error handling has been improved to log a warning and continue processing valid tokens instead of throwing an exception when encountering malformed token info. This makes the application more resilient against API data issues.


66-67: Enhanced validation in token activity processing

Changed from using .parse() (which throws on failure) to .safeParse() with explicit success checking. This prevents exceptions from invalid data and makes the error handling more consistent with the approach used in toSecondaryTokenInfos.

packages/portfolio/src/helpers/create-cached-unknown-token-info.ts (1)

9-9: Simplified unknown token info creation

The function now directly calls createUnknownTokenInfo with just the id parameter, relying on its internal logic to generate the token name instead of constructing a custom name. This change aligns with the refactored implementation in create-unknown-token-info.ts that decodes the hex asset name from the ID and appends " (unknown)" if needed.

apps/wallet-mobile/src/components/Icon/Portfolio2.tsx (1)

6-15: Well-structured SVG icon implementation

The implementation follows the project's pattern for icon components with appropriate typing and default props. The SVG path is properly defined with all necessary attributes.

apps/wallet-mobile/translations/messages/src/features/ReviewTx/common/hooks/useStrings.json (1)

2-16: Clear and informative ADA description added

The added translation entry provides a useful description of ADA's role in the Cardano ecosystem, explaining its function for transaction fees and staking rewards. This information will improve user understanding of the native cryptocurrency.

apps/wallet-mobile/translations/messages/src/features/Swap/common/AmountCard/AmountCard.json (1)

32-60: LGTM! New translation keys added correctly.

The new translation keys for "From" and "To" have been properly added to support the refactored AmountCard component.

packages/portfolio/src/adapters/dullahan-api/api-maker.test.ts (4)

196-198: Updated call count to reflect removed test cases.

The test call count was correctly updated to reflect the removal of malformed response tests for tokenInfos and tokenTraits endpoints.


224-225: Updated call count to reflect removed test cases.

The test call count was correctly updated to reflect the removal of malformed response tests for tokenInfos and tokenTraits endpoints.


249-250: Updated call count to reflect removed test cases.

The test call count was correctly updated to reflect the removal of malformed response tests for tokenInfos and tokenTraits endpoints.


237-243:

❓ Verification inconclusive

Changed error handling behavior for tokenActivity.

The test now expects a successful response with empty data instead of an error for malformed tokenActivity responses. This aligns with the more tolerant error handling approach implemented in the portfolio adapter.

This change seems to indicate that the implementation of toTokenActivity now handles malformed data differently. Verify that this behavior is consistent with other API endpoints and confirm the intended approach:


🏁 Script executed:

#!/bin/bash
# Look for error handling patterns in the token activity transformer
rg -A 5 -B 5 "toTokenActivity" packages/portfolio/src/

Length of output: 6182


TokenActivity Transformation: Confirm Tolerant Error Handling Consistency
The latest changes in the toTokenActivity transformation now return an empty object within a successful (right) response when the API response is empty or contains malformed data. This behavior aligns with the tests in transformers.test.ts and with the pattern in api-maker.ts—where an error is only returned when there’s no valid activity and an explicit error exists.

  • The updated test in api-maker.test.ts (lines 237–243) now expects a response of the form:
    {
      tag: 'right',
      value: {
        status: 200,
        data: {},
      },
    }
  • The implementation in packages/portfolio/src/adapters/dullahan-api/transformers.ts supports this tolerant approach by returning an empty object when provided with an empty API response.
  • In packages/portfolio/src/adapters/dullahan-api/api-maker.ts, the logic first checks for valid activity; if none exists (and an error is present), only then is an error returned.

Action Required:
Please verify that this tolerant error handling approach is consistent across related API endpoints (e.g., any similar transformation functions like toTokenHistory) and that it fits the overall error handling design in the portfolio adapter.

apps/wallet-mobile/src/features/ReviewTx/common/hooks/useStrings.tsx (1)

9-9: Good addition of ADA description text for improved user education.

Adding a description of ADA as Cardano's native cryptocurrency helps users understand its utility for transaction fees and staking rewards. This enhances the UX by providing relevant context about the primary token.

Also applies to: 95-99

apps/wallet-mobile/src/features/ReviewTx/useCases/ReviewTxScreen/ReviewTxScreen.tsx (3)

20-21: Good extraction of the cbor parameter and developer utility.

Extracting the cbor parameter to a local constant improves code readability. The addition of a development-only copy button is a helpful debugging tool.

Also applies to: 22-22


32-34: Consistent use of the extracted cbor variable.

Using the extracted cbor variable in the hooks makes the code more maintainable by centralizing the access to this parameter.

Also applies to: 42-42, 44-44


58-65: Improved conditional logic using the extracted cbor variable.

The conditional checks in handleOnConfirm properly use the extracted cbor variable, making the code easier to understand and maintain.

packages/portfolio/src/adapters/dullahan-api/api-maker.ts (1)

121-122:

❓ Verification inconclusive

Error handling was removed from transformation

The transformation logic now directly calls toSecondaryTokenInfos(infos) without error handling, where previously there was likely a try-catch block handling transformation failures.

This change assumes the transformation function will never throw exceptions. Verify that toSecondaryTokenInfos has been updated to handle malformed data gracefully:


🏁 Script executed:

#!/bin/bash
# Check if the toSecondaryTokenInfos function has been updated to handle errors without throwing
rg -A 10 "toSecondaryTokenInfos" --type ts packages/portfolio/src/adapters/dullahan-api/transformers.ts

Length of output: 468


Attention: Potential Issue with Error Handling in Transformation

The updated implementation of toSecondaryTokenInfos in packages/portfolio/src/adapters/dullahan-api/transformers.ts does not appear to include any error handling (e.g., a try/catch block or validation logic) to gracefully handle malformed input data. The change in packages/portfolio/src/adapters/dullahan-api/api-maker.ts now directly calls:

const transformedResponseData = toSecondaryTokenInfos(infos)

without wrapping it in an error-handling construct. This assumes that the input data is well-formed, which might lead to unhandled exceptions if unexpected data is received.

  • Action: Please verify if this assumption is valid or if additional error handling should be incorporated either within toSecondaryTokenInfos or by adding validation before calling it.
apps/wallet-mobile/src/features/Swap/common/useSwapConfig.ts (3)

1-5: Modified imports to use new SwapProvider

The hook now relies on the SwapProvider context through the useSwap hook instead of direct wallet and portfolio token info hooks, aligning with the swap feature refactoring.


17-22: Simplified token validation logic

The code now derives the candidate token ID directly from the swap configuration's initial pair and validates it against the tokens available in the swap context.


23-33: Updated return object structure

The returned object now includes tokenOutId, excludedTokens, and partners instead of previous properties like buyTokenInfo, providing a more streamlined interface for token validation and configuration.

packages/swap/README.md (4)

1-6: Good addition of package overview documentation

This introduction clearly explains the purpose of the @yoroi/swap package and how it enhances the Yoroi wallet functionality.


7-15: Well-defined glossary of terms

The glossary provides clear definitions for key terms like DEX, Protocol, Aggregator, and Liquidity Pool, which helps establish a consistent understanding among developers and users.


16-37: Useful examples of services and protocols

Providing concrete examples of Aggregators, DEXes, and Protocols helps clarify the concepts and gives developers useful reference points.


38-47: Clear explanation of multi-role organizations

The explanation of how some organizations can play multiple roles (like MuesliSwap being a DEX, protocol provider, and aggregator) adds important nuance to the terminology.

apps/wallet-mobile/src/features/Swap/common/Protocol/ProtocolAvatar.tsx (2)

1-15: Well-structured component props

The props interface is clearly defined with appropriate types and default values. Good job including the preventOpenLink option for flexibility.


32-56: Good use of theme and atomic styles

The styling approach using theme colors and atomic styles enhances maintainability and consistency with the rest of the application.

packages/portfolio/src/helpers/create-unknown-token-info.ts (1)

15-17: Looks good - enhanced unknown token naming.

The property extraction and default name formatting using the parsed asset name creates a more informative default "unknown" token representation.

apps/wallet-mobile/src/yoroi-wallets/hooks/index.ts (2)

118-124: New hook for hex address conversion adds needed functionality.

The useAddressHex hook provides a clean way to convert Bech32 addresses to hex format, which is required by some endpoints. The implementation efficiently uses React Query for data fetching and caching.

There's a past comment about whether internal or external addresses should be used. Verify the current implementation meets your requirements by checking if any endpoints specifically need the hex format of the first external address.


451-451: Improved property naming for better semantics.

Renaming from frontendFees to aggregatedFrontendFeeTiers makes the property name more descriptive and better reflects what the data represents.

apps/wallet-mobile/src/features/ReviewTx/common/TokenDetails.tsx (6)

2-2: Good use of existing portfolio utilities.

Importing the isPrimaryTokenInfo utility from the portfolio package is a good practice for code reuse and consistency.


43-43: Enhanced token icon display.

Replacing the previous component with TokenInfoIcon improves consistency with the rest of the application and likely provides better image loading and error handling.


68-77: Optimization for primary tokens.

Disabling token discovery for primary tokens is a good optimization that prevents unnecessary API calls.


80-80: Simplified UI for primary tokens.

Using a dedicated description for primary tokens instead of tabs provides a cleaner and more focused user experience.


98-106: Improved loading state feedback.

Adding an ActivityIndicator during token discovery loading provides better visual feedback to users.


244-244: Better handling of missing token supply.

Displaying a dash instead of empty/null values for token supply improves the user experience.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/ShowPriceImpact.tsx (2)

9-9: Improved component API with simpler props.

Simplifying the component to only require priceImpact with a sensible default makes it more focused and reusable.


39-52: Enhanced styling with theme atoms.

Refactoring to use the useStyles hook with theme atoms improves theme consistency across the application and makes the component more maintainable.

apps/wallet-mobile/src/WalletNavigator.tsx (1)

24-24: LGTM: Simplified SwapProvider usage

The refactoring successfully simplifies the integration of the SwapProvider by removing nested providers and dependencies. This cleaner approach will improve component maintainability and potentially performance.

Also applies to: 74-175

apps/wallet-mobile/src/components/MediaPreview/MediaPreview.tsx (1)

12-12: LGTM: Great refactoring to centralize image loading logic

The MediaPreview component now properly leverages the usePortfolioImage hook, centralizing image loading concerns including URI construction, error handling, and loading states. This is a good architectural improvement that enhances maintainability.

Also applies to: 37-43, 50-59, 61-73

apps/wallet-mobile/translations/messages/src/features/Transactions/TxHistoryNavigator.json (1)

48-60: LGTM: Added new translation entries for updated UI

The added translation entries (swap.swapScreen.ordersSwapTab and menu.settings) properly support the new swap navigation structure, and the index adjustments throughout the file are accurate.

Also applies to: 363-375

apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioTokenDetails/Actions.tsx (3)

4-4: Update to explicit React import

Good change to use the more explicit * as React import pattern.


10-10: LGTM: Updated import path and hook usage

Correctly updated to use the local SwapProvider hook instead of the external package, aligning with the broader swap feature refactoring.

Also applies to: 23-24


35-40: LGTM: Refactored to use action-based state management

Successfully migrated from method calls to action dispatches, following the new pattern established in the swap feature refactor. The hardcoded values for order_type and slippage_tolerance align with the simplified approach.

Also applies to: 47-49

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/WarnLimitPrice.tsx (1)

1-51: Well-structured component with clean implementation

The WarnLimitPrice component is well-designed and follows React best practices. It clearly displays the comparison between wanted limit price and market price with proper styling and localization.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectProtocolScreen.tsx (1)

38-85: Overall implementation is good, with clear rendering logic

The protocol selection screen is well-structured with appropriate handling of selection, navigation, and display of protocol details.

apps/wallet-mobile/src/features/Portfolio/common/hooks/usePortfolioTokenInfos.ts (4)

7-14: Good improvement to hook flexibility

Adding the optional sourceId parameter with a default value and making the options parameter optional with a default empty object improves the hook's API and usability.


16-16: Properly updated query key to include sourceId

Correctly adding the sourceId to the query key ensures proper cache invalidation when the source changes.


20-20: Appropriate use of sourceId in the sync method

The sourceId is now correctly passed to the token manager's sync method.


25-25: Simplified unknown token info creation

The fallback token info creation has been simplified by using just the token id. This is cleaner and follows the single responsibility principle better.

apps/wallet-mobile/src/components/Button/Button.tsx (5)

29-30: Good addition of color override props

Adding bgColorsOverride and fgColorsOverride props provides good flexibility for customizing button appearance without modifying the component's core logic.


34-57: Clean implementation of props extraction and forwarding

Properly destructuring the new props and passing them to the useStyles hook maintains the component's clean architecture.


106-148: Well-implemented color override logic

The color override logic is implemented cleanly, using the provided overrides or falling back to default colors based on the button type.


167-168: Improved button shape styles for SecondaryText type

The explicit maxHeight and padding adjustments for the SecondaryText button type improve its visual consistency.


219-221: Refined icon sizing logic

The updated icon sizing logic now uses smaller sizes for Text and SecondaryText button types, which improves the visual hierarchy and consistency of the buttons.

apps/wallet-mobile/src/features/Transactions/useCases/TxHistory/ActionsBanner.tsx (3)

17-17: Clean import for new swap provider.
Bringing in useSwap from the new SwapProvider centralizes the swap logic and keeps the dependencies straightforward.


27-27: Consistent usage of the new swap form context.
Using the useSwap() hook here looks good. It's in line with the consolidated swap state management approach.


178-178: Route name update confirmed.
Changing the navigation route to 'swap-main' aligns well with the flattened swap flow.

apps/wallet-mobile/src/kernel/navigation.tsx (3)

12-12: Extended import for typed review details.
Importing ReviewDetailsProps clarifies the shape for the details? property in review-tx routes.


185-195: New and flatter swap routes.
This structure avoids deeper nesting and simplifies route management across the swap flow.


300-300: Refinement of the ReviewTxRoutes details property.
Adding details?: ReviewDetailsProps ensures strong typing and expands potential customization of the review transaction screen.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SelectTokenScreen.tsx (8)

1-11: Appropriate imports for token listing and fallback handling.
All imports appear necessary for search, listing, bounding errors, and theming.


12-31: Extra import of boundary components and typed navigation.
Using Boundary, ServiceUnavailable, and typed routes keeps error handling consistent and type-safe.


32-73: Comprehensive screen-level error and loading handling.
SelectTokenScreen leverages Boundary and an ErrorBoundary fallback to show a service-unavailable state. This robust approach helps maintain user experience if services fail or data is loading.


75-173: TokenList with sorted and filtered data.
Applying custom sorting logic for owned tokens & verified tokens, plus dynamic filtering, is well-structured. The usage of React.useMemo to optimize sorting and filtering is a good practice.


175-230: SelectableToken logic for switching or updating tokens.
The conditional logic correctly resets amounts if you pick the same token on the opposing side, and otherwise sets the correct token on the swap form. Great clarity in how each action is dispatched.


232-238: EmptyList fallback for searching.
Returning null when not searching or EmptySearchResult when the search yields no results is straightforward for consistent UI feedback.


240-256: Distinct empty search results component.
The separate EmptySearchResult approach is clean, providing a clear message and illustration when no matching assets are found.


258-301: Style definitions remain consistent with the app’s theming.
Leveraging theme atoms ensures proper spacing and color usage across the screen.

apps/wallet-mobile/src/components/RefreshButton/RefreshButton.tsx (5)

8-10: Well-structured props interface

The component defines a clean props interface by extending PressableProps and omitting the props that are managed internally.


12-22: Well-implemented animation logic

The animation implementation is clean and efficient:

  • Uses useRef with Animated.Value for state persistence
  • Properly resets animation value after completion
  • Correctly chains the original onPress handler

This ensures smooth rotation animation while maintaining the component's expected behavior.


24-33: Clean rotation interpolation

The rotation transformation is properly implemented with clear input and output ranges for the animation.


34-49: Effective component rendering with animation

The component structure properly handles:

  • Animated view containing the icon
  • Pressable state passed to child components
  • Proper prop spreading
  • Conditional styling based on pressed state

58-105: Well-organized styles with theming

The styling implementation:

  • Properly uses the theme system for colors
  • Handles different states (idle, pressed, disabled)
  • Uses atomic styling patterns consistently
  • Provides clean icon props based on state

The use of a separate useStyles hook helps keep the component rendering logic clean.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/LimitInput.tsx (6)

5-7: Good usage of the new SwapProvider context

The imports show the transition to the new unified swap context structure that's part of the larger refactoring.


17-22: Simplified state management

The component now uses the consolidated useSwap() hook instead of the previous form context, effectively:

  • Extracting token info directly from the new context
  • Determining disabled state from the order type
  • Simplifying the overall component structure

This aligns with the PR's goal of streamlining the swap feature architecture.


29-36: Improved input binding and change handling

The input field now:

  • Directly binds to swapForm.wantedPrice as its value
  • Uses a clean action dispatch pattern for updates
  • Properly handles changes with typed actions

This is a good improvement over the previous form handler approach.


41-42: Properly references input from context

The input now uses a ref from the swap context, allowing the parent context to programmatically focus or manipulate the input when needed.


47-49: Simplified token display

The token display has been simplified to show only the input token ticker or name, making the interface cleaner.


56-114: Improved styling consistency with theme

The styling:

  • Uses theme colors consistently
  • Applies proper border colors for different states
  • Handles disabled and active states correctly
  • Returns a properly typed object from the hook

The removal of price impact conditional rendering aligns with the architectural changes in the swap feature.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/EstimateSummary.tsx (7)

1-16: Well-organized imports

The imports correctly bring in:

  • UI components (Button, Icon)
  • Context providers (Modal, Wallet, Swap)
  • Common utility components (Protocol, Navigation)
  • Type definitions

This organization reflects the component's integration with the broader application architecture.


17-38: Robust null safety and data extraction

The component:

  • Safely extracts token info with fallbacks for undefined tokens
  • Properly handles undefined estimate by returning null
  • Uses nullish coalescing for ticker/name display
  • Safely accesses protocol from the first split

This ensures the component won't crash with incomplete data.


35-38: Careful price formatting logic

The price formatting logic:

  • Uses the appropriate token decimals when available
  • Trims trailing zeros for cleaner display
  • Falls back to fixed 6 decimals for very small values
  • Ensures values are never displayed as just "0"

This provides users with meaningful price information at all scales.


39-49: Modal integration for route details

The expand function effectively:

  • Opens a modal with appropriate title
  • Sets a reasonable height limit
  • Renders the splits component within the modal
  • Maintains consistent styling with the parent component

This provides a clean way to show detailed routing information without cluttering the main view.


50-95: Comprehensive order summary display

The component effectively:

  • Displays all key swap details (route, price, fees, min received)
  • Conditionally renders slippage tolerance only for market orders
  • Uses a consistent row-based layout
  • Properly integrates protocol avatars with navigation or expansion

The component provides a complete view of the swap estimate while maintaining a clean UI.


97-134: Reusable Row component with info tooltips

The Row component:

  • Accepts different value types (string, number, or React node)
  • Integrates with the modal system for descriptions
  • Properly styles labels and values
  • Includes info buttons with tooltips when descriptions are provided

This creates a consistent pattern for displaying key-value pairs throughout the summary.


158-207: Clean styling with atomic pattern

The styling implementation:

  • Uses theme atoms effectively
  • Creates consistent spacing and alignment
  • Properly styles text elements with appropriate colors
  • Creates clear visual hierarchy

The component styling is well-organized and maintainable.

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/SwapMainScreen.tsx (9)

1-26: Well-structured imports and constants

The imports properly bring in all needed components and utilities, and the constants are clearly defined with appropriate names and comments.


28-43: Good state initialization and token extraction

The component:

  • Properly tracks content height for layout adjustments
  • Uses appropriate hooks for device dimensions and keyboard state
  • Safely accesses token information with fallbacks
  • Extracts derived values like token tickers

This ensures the component handles all data states gracefully.


44-72: Robust limit price warning implementation

The swap action handler effectively:

  • Calculates price difference against market price
  • Compares against a percentage threshold
  • Shows appropriate warning for significant deviations
  • Safely handles the undefined case
  • Provides clear actions for confirming or canceling

This prevents users from accidentally placing limit orders far from market price.


74-87: Good layout measurement handling

The component:

  • Uses ScrollView for content that might exceed screen height
  • Measures content height on layout events
  • Adds padding for the action section
  • Maintains consistent styling

This ensures the UI works well on different device sizes.


88-122: Well-implemented order type toggle and action buttons

The header section:

  • Provides clear market/limit toggle buttons with active states
  • Includes refresh button with proper disabled state
  • Adds settings button with navigation
  • Maintains clean layout with proper spacing

This gives users easy access to key controls while keeping the UI clean.


124-154: Effective token input cards and switch button

The token input section:

  • Uses AmountCard components for both input and output
  • Properly positions the switch button between cards
  • Shows clear error messages when validation fails
  • Maintains clean layout with proper spacing

The switch button styling and positioning creates a clear visual relationship between the input and output fields.


157-172: Good conditional rendering based on order type

The component:

  • Shows LimitInput only for limit orders
  • Shows price impact only for market orders
  • Conditionally renders protocol selection for limit orders without estimates
  • Includes the EstimateSummary component

This ensures that only relevant UI elements are shown based on the current order type.


176-184: Adaptive action button container

The action button container:

  • Adapts styling based on content height and keyboard state
  • Adds a border when appropriate
  • Properly disables the button when swap isn't possible
  • Uses appropriate text based on order type

This creates a consistent and predictable UI even as the screen content changes.


188-264: Comprehensive styling with theme integration

The styling:

  • Properly uses theme colors and atoms
  • Creates consistent spacing and layout
  • Handles different states (active, disabled)
  • Includes proper positioning for absolute elements like the switch button

The styles are well-organized and maintainable.

apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenAmountItem.tsx (12)

3-3: New imports added for swap and modal functionalities.
These imports appear consistent with the expanded feature set (modal usage, new strings, token details, etc.). No evident issues with this approach.

Also applies to: 5-5, 7-7, 9-9, 12-14


27-27: Added optional orderType prop.
Declaring the type as 'limit' | 'market' is clear and helps prevent invalid usage.


38-40: Using hooks for strings, modal, and dimensions.
Nicely organized extraction of external data. The separation makes the code more readable and maintainable.


68-68: Dynamic icon sizing based on variant.
Good use of conditional logic to handle “swap” vs. default variant. This keeps the UI versatile.


72-74: Token name text.
Truncation in the middle for long names is a good pattern to preserve partial visibility of both ends.


83-83: Wrapped token amount text in a dedicated view.
This fosters improved layout consistency and alignment.


92-92: Conditional PairedBalance rendering.
Ensures that the paired balance is shown only when not in swap mode, aligning with the new design flow.


96-117: Refined rendering for swap variant.

  1. Display quantity if available.
  2. Show “info” button (when feature-flagged) to open token details.
    This is a neat pattern, combining feature flags with conditional UI.

160-166: Customized width and layout for quantityWrapper.
The layout ensures alignment for token amounts and icons. Looks good.


193-194: Added gap-related styles in row to separate elements.
Enhances visual spacing.


196-197: Padding for info button style.
Consistent with the design system’s spacing.


204-204: info color usage.
Provides a subtle contrast for the text and icon. No concerns here.

apps/wallet-mobile/src/features/Swap/common/navigation.ts (3)

11-16: New navigation routes for the refactored swap feature.
These routes cleanly separate protocol selection, token selection, swap main flow, orders, and settings.


26-26: Navigation target updated to 'swap-orders'.
This aligns with the layout changes for order management.


36-36: Navigation target updated to 'swap-main'.
Keeps the user flow consistent with the new swap architecture.

apps/wallet-mobile/src/features/ReviewTx/common/ConfirmRawTxWithHw.tsx (12)

1-5: New imports for theme, HW types, React, React Query.
All relevant imports appear necessary for hardware confirmation flows.


7-13: Pulling in common UI components and legacy HW modules.
Integrating the LedgerConnect and LedgerTransportSwitch from legacy modules is an efficient reuse of existing logic.


15-16: TransportType and Step enumerations.
Explicit typing improves clarity of the setup steps.


18-21: Props definition for ConfirmRawTxWithHW.
Simple but sufficient—ensures callback and transaction data are clearly defined.


23-30: Initialize state and retrieve wallet manager context.
Storing transportType and step in local state is logical for a step-by-step process.


32-35: onSelectTransport logic.
Transitions from transport selection to the connection step. Straightforward flow.


37-42: onConnectBLE method.
Sets step to “loading” and triggers sign with BLE device info. The approach looks correct.

Ensure that the event from Ledger devices is handled if BLE errors or disconnects occur. Consider adding error fallback or retry logic.


44-49: onConnectUSB method.
Similarly handles USB transport. Clear structure, mirroring the BLE logic.


51-58: Render step: select-transport.
Using LedgerTransportSwitch for user selection. Straightforward.


60-66: Render step: connect-transport.
Displays LedgerConnect. Good separation of steps for clarity.


68-75: Render step: loading.
Shows an ActivityIndicator plus instructions to continue on the Ledger. This is a proper gating feedback.


77-95: useStyles hook for theming.
Lay out spacing, alignment, text color. Looks consistent with the existing design tokens.

apps/wallet-mobile/src/features/Portfolio/common/TokenAmountItem/TokenInfoIcon.tsx (10)

9-9: Integrated usePortfolioImage hook.
A clean abstraction for retrieving token images with stored policy/name.


13-13: Extended size prop to include 'xl'.
Flexibility for bigger icons is nice for advanced designs.


16-19: Using new default size and hooking to useStyles
Simplifies the component usage, requiring fewer external style overrides.


21-27: Fallback to placeholder if token is undefined or loading fails.
Properly handles missing or invalid images, ensuring consistent UI.


29-34: Dedicated look for the primary token (e.g., ADA).
Visually distinguishing it from other tokens is typically helpful for user recognition.


38-46: Image component usage with onError/onLoad handling.
Ensures that we handle the success or failure states gracefully.


54-58: Applying a gray background for the placeholder.
Matches the overall theme’s neutral color usage.


62-68: Styling refinements for the icon wrapper.
The border radius, center alignment, and overflow logic are consistent across size variants.


69-73: xl size styling.
A larger dimension use case. Good to see this newly supported size.


77-85: Refined widths/heights for md and sm.
Makes the icon sizing consistent with the design system.

apps/wallet-mobile/src/features/Transactions/TxHistoryNavigator.tsx (18)

35-38: Imports for new swap screens

No issues found. The new imports for the swap screens look correct and are consistent with the newly introduced swap architecture.


43-43: Add SwapSettings import

No issues found. The import from ../Swap/useCases/SwapSettings/SwapSettings is correct.


46-46: Add HeaderRightSwap import

Looks good. Ensure that the HeaderRightSwap component is thematically consistent with the rest of the header.


214-215: Register new route "swap-main"

The new route for SwapMainScreen is correctly defined.


219-219: HeaderRight set to HeaderRightSwap

No issues found. This fosters quick navigation to the swap orders screen.


224-226: New route "swap-select-token"

No concerns. The route’s initialParams sets direction: 'in', which matches the new token selection flow.


229-230: Set "swapFromTitle"

No issues with adopting strings.swapFromTitle.


234-235: Swap orders route

The new "swap-orders" route is consistent with the updated navigation structure.


237-238: Title for "swap-orders"

Using strings.orderSwap for the title provides a clear naming.


243-244: Register "swap-settings" route

Looks good; the route references SwapSettings.


252-253: Register "swap-preprod-notice" route

No issues found. The naming is consistent with the intended environment notice.


256-257: Swap title

No issues found. This is consistent with the new UI flow labeling.


261-262: "swap-review" route

No issues found in referencing ReviewSwap.


264-264: Set title to "reviewSwapTitle"

Looks correct.


269-270: "swap-select-protocol" route

New route for SelectProtocolScreen is consistent with the updated swap architecture.


423-426: New message definition for orderSwap

The new localized message is properly declared.


510-513: Add "settings" localized message

No issues; it aligns with the new route’s title usage.


545-545: Using "orderSwap" and "settings" messages

No issues found. Ensures consistent UI text.

Also applies to: 548-548

apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/ReviewSwap.tsx (13)

2-2: Switch to namespace import for React

No issues. The approach is consistent with recommended best practices.


11-11: Introduce undefinedToken import

This fallback reference is appropriate for missing token IDs.


13-13: Import ProtocolAvatar

No issues. The new component effectively displays protocol information.


15-15: Use useSwap from the new SwapProvider

This aligns with your updated swap state management approach.


24-25: Add strings and track

No issues found. They are essential for i18n and analytics.


29-29: Obtain swapForm

Approach is consistent with the new SwapProvider context usage.


32-33: Retrieve tokenInInfo and tokenOutInfo

Looks solid. The optional chaining helps avoid null pointer issues.


58-58: Reset amounts after successful swap

No issues found. This action logic is consistent with clearing swapped tokens.


67-67: Obtain the protocol

No issues found. Using optional chaining for splits[0]?.protocol is robust.


72-73: Use cbor and custom protocol title

This is a sensible approach to pass custom UI elements in the transaction review.


74-74: Include TransactionSummary in details

Nice improvement for a more cohesive review experience.


89-89: Render TransactionSummary

No issues. The summary component usage helps keep the UI consistent.


100-100: Add swapButton

No issues. The testID is helpful for integration tests.

apps/wallet-mobile/src/features/Swap/common/strings.ts (10)

3-3: Updated import for global messages

No issues found. This import broadens the usage of shared messages.


9-12: New strings "via", "placeOrder", "yourAssets", "allAssets"

No concerns. Useful additions for the swap feature.


38-38: Introduce "auto"

No problems found.


117-119: Strings for "routingPreferences", "route", "routeDescription"

Looks good for guiding users about the swap route logic.


188-203: Define localized messages: 'via', 'placeOrder', 'yourAssets', 'allAssets'

These additions are consistent with the usage references above and help maintain a well-structured i18n approach.


306-309: Define "auto"

No issues. This string may be reused across the codebase.


310-313: Add "routingPreferences"

The message and ID are well-named.


314-321: Add "route" and "routeDescription"

No issues. Nicely clarifies how the swap route is determined.


778-781: Definition of "from"

No concerns. The label is consistent with the overall swap context.


782-785: Definition of "to"

No concerns.

apps/wallet-mobile/translations/messages/src/features/Swap/common/strings.json (1)

2-2191: All new translation keys appear consistent and well-structured.

No spelling or grammatical issues were detected, and key naming conventions align with the existing pattern.

apps/wallet-mobile/src/features/Swap/useCases/ListOrders/ListOrders.tsx (1)

117-120: Include or account for canceled orders in the filter logic.

Currently, status !== 'open' && status !== 'canceled' skips canceled orders altogether, so they are not displayed in either the open or completed list. This may lead to confusion if users expect to see canceled orders in the completed list or a separate category.

Would you like me to generate a quick check script to confirm there are no references to canceled orders elsewhere?

apps/wallet-mobile/src/features/Swap/common/AmountCard/AmountCard.tsx (1)

43-43: Usage of error only for the 'in' direction.

Line 43 sets const error = direction === 'in' ? tokenInput.error : null. Any error for the 'out' direction is hidden. Verify whether this is desired, or if you need a separate handling mechanism for 'out' direction errors.

apps/wallet-mobile/src/features/Swap/useCases/SwapSettings/SwapSettings.tsx (13)

2-2: Import consolidation looks good.

The imports have been properly updated to support the new swap feature architecture, including the new Swap type from @yoroi/types and the SwapProvider context.

Also applies to: 16-16


18-28: Good update of type definitions for slippage choices.

The type definitions have been properly updated to replace "Manual" with "Custom" in the CustomChoice type, and the GivenChoice options have been streamlined to exclude 0% and 3%.


32-38: Choice array properly aligned with type definitions.

Line 37 now uses "Custom" instead of "Manual" to match the updated type definitions, maintaining consistency throughout the component.


42-48: Component renamed and hook usage updated.

The component has been appropriately renamed from EditSlippageScreen to SwapSettings and now uses the new useSwap hook instead of the previous useSwapForm, correctly initializing the aggregator state from the new manager settings.


49-54: Well implemented aggregator assignment function.

The assignAggregator function properly updates both local state and the swap form's manager settings, and correctly triggers a refresh action to ensure UI updates.


55-59: Slippage default selection logic properly handled.

The code correctly identifies the default selected choice based on the manager settings and formats the default input value appropriately based on whether it's a custom value or not.


70-75: Good refactoring of slippage change handling.

The commit function nicely consolidates the slippage update logic into a single function, handling both tracking and state updates in one place, which improves code maintainability.


77-87: Handler functions updated correctly.

The choice and input handlers have been properly updated to use the new commit function, ensuring consistent behavior across different ways of changing the slippage value.


89-91: Input state management simplified.

The input enabled and error states are now derived from a single source of truth (isSelectedChoiceCustom), which reduces the possibility of inconsistent states.


96-107: UI text and styling improvements look good.

The headings and label styles have been updated for better visual consistency, using the translations from strings appropriately.


112-133: Conditional rendering for custom input is well implemented.

The TextInput component is now only rendered when "Custom" is selected, with appropriate conditional styling and helper text. The key-based re-rendering when the input changes between enabled/disabled states is a good approach.


135-173: New routing preferences section is well structured.

The new routing preferences section provides a clear UI for toggling between auto and manual aggregator selection, with proper conditional rendering of individual aggregator options when not in auto mode. The implementation correctly syncs with the swap form's manager settings.


190-256: Style updates enhance visual consistency.

The style updates properly support the new UI components, with clear separation between sections and appropriate styling for interactive elements. The use of theme colors for cursor and selection highlighting improves visual feedback.

apps/wallet-mobile/src/kernel/i18n/locales/en-US.json (9)

894-894: Added "Sell" global label.

New "Sell" label added to global namespace, which will be used alongside existing "Buy" label for consistent terminology.


1035-1035: Improved "limitPrice" label clarity.

Changed from "limitPrice" to more user-friendly "Buy at" which better describes the purpose of the field in the swap UI.


1062-1065: Added routing preferences localization.

Added new strings for the routing preferences section in the SwapSettings component, providing proper labels for the new UI elements.


1069-1070: Improved slippage tolerance description.

The slippage tolerance description has been expanded to provide clearer guidance to users about what slippage means and how it impacts their trading experience.


1075-1079: Added new swap UI strings.

Added essential strings for the redesigned swap UI: "via", "Place order", "Your assets", and "All assets", supporting the new components in the swap flow.


1082-1083: Added directional labels.

Added clear "From" and "To" labels for the swap direction, which improves user understanding of the swap flow.


1089-1089: Improved clarity of minimum received description.

Updated the description for "swapMinReceived" to better explain what this value represents, helping users understand the guarantee provided based on current conditions.


1302-1302: Added informative ADA description.

The new ADA description clearly explains ADA's role in the Cardano network, which improves user education during transaction review.


1371-1374: Fixed notification message formatting.

Updated notification strings for multiple assets to ensure consistent formatting and improve clarity for users when they receive transaction notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants