diff --git a/packages/widget/src/components/Header/NavigationHeader.tsx b/packages/widget/src/components/Header/NavigationHeader.tsx index d93407b45..9c2a6f28a 100644 --- a/packages/widget/src/components/Header/NavigationHeader.tsx +++ b/packages/widget/src/components/Header/NavigationHeader.tsx @@ -58,7 +58,7 @@ export const NavigationHeader: React.FC = () => { > */} {backButtonRoutes.includes(pathname) ? ( { {pathname === '/' ? ( { { }; return ( { + const { setValue, getValues } = useFormContext(); + const handleClick = () => { + const [fromChain, fromToken, toChain, toToken] = getValues([ + SwapFormKey.FromChain, + SwapFormKey.FromToken, + SwapFormKey.ToChain, + SwapFormKey.ToToken, + ]); + setValue(SwapFormKey.FromChain, toChain); + setValue(SwapFormKey.FromToken, toToken); + setValue(SwapFormKey.ToChain, fromChain); + setValue(SwapFormKey.ToToken, fromToken); + setValue(SwapFormKey.FromAmount, ''); + }; + return ( + + + + ); +}; diff --git a/packages/widget/src/hooks/useSwapRoutes.ts b/packages/widget/src/hooks/useSwapRoutes.ts index 33caa039e..d8dce52f1 100644 --- a/packages/widget/src/hooks/useSwapRoutes.ts +++ b/packages/widget/src/hooks/useSwapRoutes.ts @@ -91,7 +91,7 @@ export const useSwapRoutes = () => { { enabled: isEnabled, refetchIntervalInBackground: true, - refetchInterval: 60_000, + refetchInterval: 30_000, staleTime: 30_000, // TODO: probably should be removed cacheTime: 30_000, diff --git a/packages/widget/src/pages/SwapPage/SwapPage.tsx b/packages/widget/src/pages/SwapPage/SwapPage.tsx index 2315652f1..90246be4d 100644 --- a/packages/widget/src/pages/SwapPage/SwapPage.tsx +++ b/packages/widget/src/pages/SwapPage/SwapPage.tsx @@ -1,5 +1,5 @@ -import { SwapVert as SwapVertIcon } from '@mui/icons-material'; import { Box } from '@mui/material'; +import { ReverseTokensButton } from '../../components/ReverseTokensButton'; import { SelectTokenButton } from '../../components/SelectTokenButton'; import { SwapButton } from '../../components/SwapButton'; import { SwapRoutes } from '../../components/SwapRoutes'; @@ -15,7 +15,7 @@ export const SwapPage: React.FC = () => { sx={{ display: 'flex', justifyContent: 'center', height: 40 }} py={0.5} > - +