-
Notifications
You must be signed in to change notification settings - Fork 448
feat: clean up swap legacy from LW #13567
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
|
There was a problem hiding this 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.
There was a problem hiding this 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.
9933578 to
527dd81
Compare
There was a problem hiding this 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.
527dd81 to
154f3b4
Compare
There was a problem hiding this 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.
There was a problem hiding this 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.
apps/ledger-live-mobile/src/components/RootNavigator/SwapNavigator.tsx
Outdated
Show resolved
Hide resolved
lpaquet-ledger
left a comment
There was a problem hiding this 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 π«‘
7cdd9a0 to
58ff3ea
Compare
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
5a3332f
58ff3ea to
5a3332f
Compare
There was a problem hiding this 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.
|


β Checklist
npx changesetwas attached.π Description
Removes the legacy swap form screens and related code
Changes
β Context
- JIRA or GitHub link:
π§ Checklist for the PR Reviewers