Skip to content

Conversation

@CremaFR
Copy link
Member

@CremaFR CremaFR commented Jan 7, 2026

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

πŸ“ Description

Removes the legacy swap form screens and related code

Changes

  • Mobile: Removed legacy swap form screens (Form/, SubScreens/) and navigation
  • Mobile: Cleaned up swap reducer, actions, and ProviderIcon component
  • Desktop: Removed legacy DeviceAction swap rendering and test mocks
  • Common: Removed initSwap, getExchangeRates, and Tron/Tezos swap utilities
  • Types: Cleaned up navigator types and removed unused swap screen definitions

❓ Context

- JIRA or GitHub link:


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

Copilot AI review requested due to automatic review settings January 7, 2026 10:52
@CremaFR CremaFR requested review from a team as code owners January 7, 2026 10:52
@vercel
Copy link

vercel bot commented Jan 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
web-tools Ready Ready Preview, Comment Jan 20, 2026 3:35pm
3 Skipped Deployments
Project Deployment Review Updated (UTC)
ledger-live-github-bot Ignored Ignored Preview Jan 20, 2026 3:35pm
native-ui-storybook Ignored Ignored Preview Jan 20, 2026 3:35pm
react-ui-storybook Ignored Ignored Preview Jan 20, 2026 3:35pm

Request Review

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

πŸ–₯️ Desktop

-> Run Desktop E2E

  • Select "Run workflow"
  • Branch: feat/remove-legacy
  • Device: nanoSP or stax

πŸ“± Mobile

-> Run Mobile E2E

  • Select "Run workflow"
  • Branch: feat/remove-legacy
  • Device: nanoX

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes legacy swap functionality from the codebase as part of a cleanup effort to transition to the new SwapLiveApp implementation.

Key Changes

  • Removed the entire legacy swap form implementation including UI components, device actions, and business logic
  • Removed SwapFormNavigator and all associated form screens (Form, TxForm, Summary, Modal, etc.)
  • Removed backend swap functions (initSwap, getExchangeRates) and validation helpers (maybeTronEmptyAccount, maybeTezosAccountUnrevealedAccount, maybeKeepTronAccountAlive)
  • Removed legacy type definitions (InitSwapResult, SwapRequestEvent, InitSwapInput) from swap types
  • Cleaned up device action hooks and test mocks related to legacy swap

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libs/ledger-live-common/src/hw/actions/initSwap.ts Deleted legacy swap device action
libs/ledger-live-common/src/exchange/swap/types.ts Removed legacy swap type definitions
libs/ledger-live-common/src/exchange/swap/initSwap.ts Deleted legacy swap initialization logic
libs/ledger-live-common/src/exchange/swap/getExchangeRates.ts Deleted legacy rate fetching implementation
libs/ledger-live-common/src/exchange/swap/maybeTronEmptyAccount.ts Deleted Tron account validation
libs/ledger-live-common/src/exchange/swap/maybeTezosAccountUnrevealedAccount.ts Deleted Tezos account validation
libs/ledger-live-common/src/exchange/swap/maybeKeepTronAccountAlive.ts Deleted Tron account balance validation
libs/ledger-live-common/src/exchange/swap/mock.ts Removed legacy swap mock functions
libs/ledger-live-common/src/exchange/swap/index.ts Removed exports for deleted functions
libs/ledger-live-common/.unimportedrc.json Updated to remove initSwap.ts reference
apps/ledger-live-mobile/src/screens/Swap/Form/* Deleted all legacy swap form components
apps/ledger-live-mobile/src/components/RootNavigator/SwapFormNavigator.tsx Deleted legacy tab navigator
apps/ledger-live-mobile/src/components/RootNavigator/types/SwapFormNavigator.ts Deleted navigator type definitions
apps/ledger-live-mobile/src/components/RootNavigator/SwapNavigator.tsx Simplified to use SwapLiveApp only
apps/ledger-live-mobile/src/components/RootNavigator/types/SwapNavigator.ts Removed SwapFormNavigator import
apps/ledger-live-mobile/src/hooks/deviceActions.ts Removed useInitSwapDeviceAction hook
apps/ledger-live-mobile/src/families/stellar/ScreenEditMemoValue.tsx Removed SwapFormNavigator from type union
apps/ledger-live-mobile/src/families/stacks/ScreenEditMemo.tsx Removed SwapFormNavigator from type union
apps/ledger-live-mobile/src/components/DeviceAction/index.tsx Removed swap-related status fields
apps/ledger-live-mobile/e2e/* Removed legacy swap test helpers
apps/ledger-live-desktop/* Removed legacy swap test helpers and device action rendering
apps/cli/src/commands/ptx/swap.ts Deleted CLI swap command
apps/cli/src/commands-index.ts Removed swap command export
Comments suppressed due to low confidence (1)

apps/ledger-live-mobile/src/components/RootNavigator/types/SwapNavigator.ts:353

  • The type definitions still reference ScreenName.SwapForm in currentNavigation and nextNavigation union types throughout this file (e.g., lines 88, 92, 109, 113, etc.), but the SwapForm screen and SwapFormNavigator have been removed in this PR. These references should be updated to remove ScreenName.SwapForm from the union types, as the screen no longer exists and navigation to it will fail at runtime.
export type SwapNavigatorParamList = {
  [ScreenName.SwapTab]:
    | DetailsSwapParamList
    | DefaultAccountSwapParamList
    | SwapSelectCurrency
    | SwapPendingOperation;
  [ScreenName.SwapSelectAccount]: {
    target: Target;
    provider?: string;
    swap: SwapDataType;
    selectableCurrencyIds: string[];
    selectedCurrency?: CryptoCurrency | TokenCurrency;
  };
  [ScreenName.SwapSelectCurrency]: SwapSelectCurrency;
  [ScreenName.SwapSelectProvider]: {
    provider?: string;
    swap: SwapDataType;
    selectedRate: ExchangeRate | undefined;
  };
  [ScreenName.SwapSelectFees]: {
    accountId?: string;
    parentAccountId?: string;
    swap: SwapDataType;
    rate?: ExchangeRate;
    provider?: string;
    transaction?: Transaction | null;
    overrideAmountLabel?: string;
    hideTotal?: boolean;
    operation?: Operation;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.SwapHistory]: undefined;
  [ScreenName.SwapPendingOperation]: SwapPendingOperation;
  [ScreenName.SwapOperationDetails]: {
    swapOperation: SwapOperationDetails;
    fromPendingOperation?: true;
  };
  [ScreenName.AlgorandEditMemo]: {
    accountId?: string;
    parentId?: string;
    account: AlgorandAccount;
    transaction: AlgorandTransaction;
    status?: AlgorandTransactionStatus;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.BitcoinEditCustomFees]: {
    accountId: string;
    parentId?: string;
    transaction: BitcoinTransaction;
    status?: BitcoinTransactionStatus;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
    satPerByte?: BigNumber | null;
    setSatPerByte?: (_: BigNumber) => void;
  };
  [ScreenName.CardanoEditMemo]: {
    accountId: string;
    parentId?: string;
    account: CardanoAccount;
    transaction: CardanoTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.EvmCustomFees]: {
    accountId: string;
    parentId?: string;
    transaction: EvmTransaction;
    gasOptions?: GasOptions;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.EvmEditGasLimit]: {
    accountId: string;
    setGasLimit: (_: BigNumber) => void;
    gasLimit?: BigNumber | null;
    transaction: EvmTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.KaspaEditCustomFees]: {
    accountId: string;
    parentId?: string;
    transaction: KaspaTransaction;
    status?: KaspaTransactionStatus;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
    sompiPerByte?: BigNumber | null;
    setSompiPerByte?: (_: BigNumber) => void;
  };
  [ScreenName.StellarEditMemoValue]: {
    accountId: string;
    parentId?: string;
    account: Account;
    transaction: StellarTransaction;
    memoType?: string;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
  };
  [ScreenName.StellarEditCustomFees]: {
    accountId: string;
    parentId?: string;
    transaction: StellarTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.CosmosFamilyEditMemo]: {
    accountId: string;
    parentId?: string;
    account: CosmosAccount;
    transaction: CosmosTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.HederaEditMemo]: {
    accountId: string;
    parentId?: string;
    account: Account;
    transaction: HederaTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.XrpEditTag]: {
    accountId: string;
    parentId?: string;
    transaction: RippleTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.SolanaEditMemo]: {
    accountId: string;
    parentId?: string;
    account: SolanaAccount;
    transaction: SolanaTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.StellarEditMemoType]: {
    accountId: string;
    parentId?: string;
    account: Account;
    transaction: StellarTransaction;
    memoType?: string;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.InternetComputerEditMemo]: {
    accountId: string;
    account: Account;
    parentId?: string;
    transaction: ICPTransaction;
    currentNavigation: ScreenName.SignTransactionSummary;
  };
  [ScreenName.MinaEditMemo]: {
    accountId: string;
    account: Account;
    parentId?: string;
    transaction: MinaTransaction;
    currentNavigation: ScreenName.SignTransactionSummary;
  };

  [ScreenName.StacksEditMemo]: {
    accountId: string;
    parentId?: string;
    account: Account;
    transaction: StacksTransaction;
    memoType?: string;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.CasperEditTransferId]: {
    accountId: string;
    account: Account;
    parentId?: string;
    transaction: CasperTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.TonEditComment]: {
    accountId: string;
    account: Account;
    parentId?: string;
    transaction: TonTransaction;
    currentNavigation:
      | ScreenName.SignTransactionSummary
      | ScreenName.SendSummary
      | ScreenName.SwapForm;
    nextNavigation:
      | ScreenName.SignTransactionSelectDevice
      | ScreenName.SendSelectDevice
      | ScreenName.SwapForm;
  };
  [ScreenName.SwapCustomError]: {
    error?: SwapLiveError | Error;
  };
  [ScreenName.SwapLoading]: undefined;
};

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 7, 2026 14:36
@CremaFR CremaFR force-pushed the feat/remove-legacy branch from 9933578 to 527dd81 Compare January 7, 2026 14:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 58 out of 59 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CremaFR CremaFR force-pushed the feat/remove-legacy branch from 527dd81 to 154f3b4 Compare January 7, 2026 14:49
Copilot AI review requested due to automatic review settings January 7, 2026 15:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 63 out of 64 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 8, 2026 10:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 62 out of 63 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lpaquet-ledger
lpaquet-ledger previously approved these changes Jan 20, 2026
Copy link
Contributor

@lpaquet-ledger lpaquet-ledger left a comment

Choose a reason for hiding this comment

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

You will be missed 🫑

gre-ledger
gre-ledger previously approved these changes Jan 20, 2026
@CremaFR CremaFR changed the title feat: clean up feat: clean up swap legacy from LW Jan 20, 2026
@CremaFR CremaFR force-pushed the feat/remove-legacy branch from 7cdd9a0 to 58ff3ea Compare January 20, 2026 13:51
Removes the legacy swap form UI and related swap logic from mobile app, including:
- Removed legacy SwapFormNavigator and related screens
- Removed swap reducer and actions
- Cleaned up swap-related utilities and types
- Removed unused provider icons and components
- Updated navigation structure to use LiveApp swap flow
- Cleaned up exchange swap logic in ledger-live-common
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 64 out of 65 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required β‰₯ 80%)

See analysis details on SonarQube Cloud

@CremaFR CremaFR merged commit a4137bd into develop Jan 21, 2026
112 of 118 checks passed
@CremaFR CremaFR deleted the feat/remove-legacy branch January 21, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli common Has changes in live-common desktop Has changes in LLD mobile Has changes in LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants