Skip to content

Commit

Permalink
fix(LIVE-14956): Set a default 0 value for swap transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Couto committed Dec 17, 2024
1 parent eafb5d9 commit d30255e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
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",
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;
defaultFromAmount?: Number;
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

0 comments on commit d30255e

Please sign in to comment.