Skip to content

Commit

Permalink
fix(swap): install Ethereum app if at least one evm family in the swa…
Browse files Browse the repository at this point in the history
…p and not already present in the deps [LIVE-14666]
  • Loading branch information
Justkant committed Oct 28, 2024
1 parent 77f01ea commit d546208
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-cobras-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/live-common": patch
---

fix(swap): install Ethereum app if at least one evm family in the swap and not already present in the deps
30 changes: 21 additions & 9 deletions libs/ledger-live-common/src/hw/actions/startExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const createAction = (
? getMainAccount(exchange.toAccount, exchange.toParentAccount)
: null;

const request: AppRequest = useMemo(() => {
const request = useMemo<AppRequest>(() => {
if (isSwapDisableAppsInstall()) {
return {
appName: "Exchange",
Expand All @@ -135,16 +135,28 @@ export const createAction = (
requireLatestFirmware,
};
} else {
const shouldAddEthApp =
(mainFromAccount.currency.family === "evm" || mainToAccount.currency.family === "evm") &&
mainFromAccount.currency.managerAppName !== "Ethereum" &&
mainToAccount.currency.managerAppName !== "Ethereum";
const dependencies: AppRequest["dependencies"] = [
{
account: mainFromAccount,
},
{
account: mainToAccount,
},
];

if (shouldAddEthApp) {
dependencies.push({
appName: "Ethereum",
});
}

return {
appName: "Exchange",
dependencies: [
{
account: mainFromAccount,
},
{
account: mainToAccount,
},
],
dependencies,
requireLatestFirmware,
};
}
Expand Down

0 comments on commit d546208

Please sign in to comment.