diff --git a/src/entries/popup/pages/swap/index.tsx b/src/entries/popup/pages/swap/index.tsx index 9b57f71ecb..ebf560cd38 100644 --- a/src/entries/popup/pages/swap/index.tsx +++ b/src/entries/popup/pages/swap/index.tsx @@ -453,6 +453,17 @@ export function Swap({ bridge = false }: { bridge?: boolean }) { [assetsToSell, isHidden], ); + const highestEth = useMemo(() => { + const eths = unhiddenAssetsToSell.filter((asset) => asset.symbol === 'ETH'); + return eths?.length + ? eths.reduce((highest, next) => { + return Number(highest.balance.amount) > Number(next.balance.amount) + ? highest + : next; + }) + : null; + }, [unhiddenAssetsToSell]); + const unhiddenAssetsToBuy = useMemo(() => { return assetsToBuy.map((assets) => { return { @@ -618,7 +629,11 @@ export function Swap({ bridge = false }: { bridge?: boolean }) { if (savedTokenToSell) { setAssetToSell(savedTokenToSell); } else { - setAssetToSell(unhiddenAssetsToSell[0]); + if (highestEth) { + setAssetToSell(highestEth); + } else { + setAssetToSell(unhiddenAssetsToSell[0]); + } setDefaultAssetWasSet(true); } setDidPopulateSavedTokens(true);