Skip to content

Commit

Permalink
fix: max native token amount on swap (#2407)
Browse files Browse the repository at this point in the history
* fix: max native token amount on swap

* fix: ui
  • Loading branch information
dmy147 authored Jul 19, 2024
1 parent bc01a83 commit 28696fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/ui/views/Swap/Component/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,10 @@ export const Main = () => {
<div
className={clsx(
'text-r-neutral-title-1',
'underline cursor-pointer',
!payTokenIsNativeToken && 'underline cursor-pointer',
!payToken && 'hidden'
)}
onClick={() => {
handleBalance();
}}
onClick={handleBalance}
>
{t('global.Balance')}: {formatAmount(payToken?.amount || 0)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/Swap/hooks/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ export const useTokenPair = (userAddress: string) => {
);

const handleBalance = useCallback(() => {
if (payToken) {
if (!payTokenIsNativeToken && payToken) {
setPayAmount(tokenAmountBn(payToken).toString(10));
}
}, [payToken]);
}, [payToken, payTokenIsNativeToken]);

const isStableCoin = useMemo(() => {
if (payToken?.price && receiveToken?.price) {
Expand Down

0 comments on commit 28696fa

Please sign in to comment.