Skip to content

Commit

Permalink
Merge branch 'feat/swap-slide' of github.com:RabbyHub/Rabby into feat…
Browse files Browse the repository at this point in the history
…/swap-slide
  • Loading branch information
vvvvvv1vvvvvv committed Dec 20, 2024
2 parents 7d14681 + 89b5d8b commit bf1e510
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/ui/views/Swap/Component/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ReactComponent as RcIconWalletCC } from '@/ui/assets/swap/wallet-cc.svg
import { tokenAmountBn } from '@/ui/utils/token';
import clsx from 'clsx';
import SkeletonInput from 'antd/lib/skeleton/Input';
import { useRabbyDispatch } from '@/ui/store';
import { ReactComponent as RcIconInfoCC } from 'ui/assets/info-cc.svg';
import { QuoteProvider, useSetRabbyFee } from '../hooks';
import { TooltipWithMagnetArrow } from '@/ui/component/Tooltip/TooltipWithMagnetArrow';
Expand Down Expand Up @@ -93,8 +92,6 @@ export const SwapTokenItem = (props: SwapTokenItemProps) => {
} = props;
const { t } = useTranslation();

const dispatch = useRabbyDispatch();

const inputRef = useRef<Input>();

const isFrom = type === 'from';
Expand Down Expand Up @@ -123,9 +120,6 @@ export const SwapTokenItem = (props: SwapTokenItemProps) => {
inputRef?.current?.focus?.();
});
}
if (type === 'to') {
dispatch.swap.setRecentSwapToToken(newToken);
}
},
[onTokenChange, type]
);
Expand Down
12 changes: 11 additions & 1 deletion src/ui/views/Swap/hooks/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,22 @@ export const useTokenPair = (userAddress: string) => {
defaultToken: defaultSelectedFromToken || getChainDefaultToken(chain),
});

const [receiveToken, setReceiveToken] = useTokenInfo({
const [receiveToken, _setReceiveToken] = useTokenInfo({
userAddress,
chain,
defaultToken: defaultSelectedToToken,
});

const setReceiveToken = useCallback(
(token?: TokenItem) => {
_setReceiveToken(token);
if (token) {
dispatch.swap.setRecentSwapToToken(token);
}
},
[_setReceiveToken, dispatch?.swap?.setSelectedToToken]
);

const [bestQuoteDex, setBestQuoteDex] = useState<string>('');

const setActiveProvider: React.Dispatch<
Expand Down

0 comments on commit bf1e510

Please sign in to comment.