Skip to content

Commit

Permalink
use gas token balance for swap token selection
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-d committed Jan 15, 2025
1 parent 6dc121b commit 7996c88
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/src/app/swap/explore/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ const ExplorePage = () => {
if (!tokenAddress || tokenAddress === appConfig.nullAddress)
return { amount: 0, amountUSD: 0 };

const { isGasToken } = getTokenFromAddress(tokenAddress) || {};
const { value } = await getBalance(appConfig.wagmiConfig, {
address,
token: tokenAddress,
// display gas token balance for WETH
token: isGasToken ? undefined : tokenAddress,
});
const amount = Number(
getFormattedStringFromTokenAmount(
Expand All @@ -138,7 +140,7 @@ const ExplorePage = () => {
);
setTokenBalances(balances);
})();
}, [address, tokensData]);
}, [address, tokensData, getTokenFromAddress]);

const allAssetsData = useMemo(() => {
if (showMockData) return mockSwapExploreAssets();
Expand Down

0 comments on commit 7996c88

Please sign in to comment.