Skip to content
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

fix(LIVE-14956): Set a default 0 value for swap transactions #8710

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/moody-oranges-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

Set default value for swap exchanges
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default function BalanceInfos({
state: {
from: history.location.pathname,
defaultAccount,
defaultAmountFrom: "0",
defaultParentAccount: parentAccount,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export default function AccountContextMenu({
state: {
defaultCurrency: currency,
defaultAccount: account,
defaultAmountFrom: "0",
defaultParentAccount: parentAccount,
from: history.location.pathname,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const AccountHeaderActions = ({ account, parentAccount, openModal }: Props) => {
defaultCurrency: currency,
defaultAccount: account,
defaultParentAccount: parentAccount,
defaultAmountFrom: "0",
from: history.location.pathname,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export default function AssetBalanceSummaryHeader({
defaultAccount: account,
defaultParentAccount: parentAccount,
defaultCurrency: currency,
defaultAmountFrom: "0",
Couto marked this conversation as resolved.
Show resolved Hide resolved
from: history.location.pathname,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => {
const { state } = useLocation<{
defaultAccount?: AccountLike;
defaultParentAccount?: Account;
defaultAmountFrom?: string;
from?: string;
}>();
const { networkStatus } = useNetworkStatus();
Expand Down Expand Up @@ -402,11 +403,23 @@ const SwapWebView = ({ manifest, liveAppUnavailable }: SwapWebProps) => {
state?.defaultAccount,
state?.defaultParentAccount,
).id,
amountFrom: state?.defaultAmountFrom || "",
}
: {}),
...(state?.from
? {
fromPath: simplifyFromPath(state?.from),
}
: {}),
...(state?.from ? { fromPath: simplifyFromPath(state?.from) } : {}),
}).toString(),
[isOffline, state?.defaultAccount, state?.defaultParentAccount, state?.from, walletState],
[
isOffline,
state?.defaultAccount,
state?.defaultParentAccount,
state?.defaultAmountFrom,
state?.from,
walletState,
],
);

const onSwapWebviewError = (error?: SwapLiveError) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const useMarketActions = ({ currency, page, currenciesAll }: MarketAction
state: {
defaultCurrency: internalCurrency,
defaultAccount,
defaultAmountFrom: "0",
defaultParentAccount:
"parentId" in defaultAccount && defaultAccount.parentId
? flattenedAccounts.find(a => a.id === defaultAccount.parentId)
Expand Down
Loading