Skip to content

Commit

Permalink
fix: pass correct target and source currency ids to swap live app (#6914
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kallen-ledger committed May 23, 2024
1 parent 9393c68 commit 65821db
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-waves-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Pass correct target and source currency to swap-live-app
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export type SwapWebProps = {
manifest: LiveAppManifest;
swapState?: Partial<SwapProps>;
liveAppUnavailable(): void;
sourceCurrencyId?: string;
targetCurrencyId?: string;
};

export const SwapWebManifestIDs = {
Expand All @@ -88,7 +90,13 @@ const SwapWebAppWrapper = styled.div`
flex: 1;
`;

const SwapWebView = ({ manifest, swapState, liveAppUnavailable }: SwapWebProps) => {
const SwapWebView = ({
manifest,
swapState,
liveAppUnavailable,
sourceCurrencyId,
targetCurrencyId,
}: SwapWebProps) => {
const {
colors: {
palette: { type: themeType },
Expand Down Expand Up @@ -197,8 +205,8 @@ const SwapWebView = ({ manifest, swapState, liveAppUnavailable }: SwapWebProps)
const searchParams = new URLSearchParams();

const swapParams = {
from: fromCurrency,
to: toCurrency,
from: sourceCurrencyId,
to: targetCurrencyId,
amountFrom: swapState?.fromAmount,
addressFrom: addressFrom,
addressTo: addressTo,
Expand All @@ -220,7 +228,8 @@ const SwapWebView = ({ manifest, swapState, liveAppUnavailable }: SwapWebProps)
fromCurrency,
swapState?.estimatedFees,
swapState?.fromAmount,
toCurrency,
targetCurrencyId,
sourceCurrencyId,
]);

// return loader???
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ const SwapForm = () => {
liveApp={
swapLiveAppManifestID && manifest ? (
<SwapWebView
sourceCurrencyId={sourceCurrency?.id}
targetCurrencyId={targetCurrency?.id}
manifest={manifest}
swapState={swapWebProps}
// When live app crash, it should disable live app and fall back to native UI
Expand Down

0 comments on commit 65821db

Please sign in to comment.