Skip to content

Commit

Permalink
feat(LIVE-17004) extract swap parameters from deeplink
Browse files Browse the repository at this point in the history
  • Loading branch information
ejaycoleman committed Feb 13, 2025
1 parent 6b7a7bd commit aae075c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-buttons-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

Extract swap parameters from deeplink
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useDeepLinkHandler() {
(
pathname: string,
state?: {
[k: string]: string;
[k: string]: string | Object;
},
search?: string,
) => {
Expand Down Expand Up @@ -203,9 +203,26 @@ export function useDeepLinkHandler() {
}
break;
}
case "swap":
navigate("/swap");
case "swap": {
const { amountFrom, fromToken, toToken } = query;

const state: {
defaultToken?: { fromTokenId: string; toTokenId: string };
defaultAmountFrom?: string;
} = {};

if (fromToken !== toToken) {
state.defaultToken = { fromTokenId: fromToken, toTokenId: toToken };
}

if (amountFrom) {
state.defaultAmountFrom = amountFrom;
}

navigate("/swap", state);

break;
}

case "bridge": {
const { origin, appName } = query;
Expand Down

0 comments on commit aae075c

Please sign in to comment.