@lifi/widget
Version:
LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.
26 lines • 1.29 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useChainSelect } from '../../components/ChainSelect/useChainSelect.js';
import { SelectChainContent } from '../../components/Chains/SelectChainContent.js';
import { useTokenSelect } from '../../components/TokenList/useTokenSelect.js';
import { useHeader } from '../../hooks/useHeader.js';
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
export const SelectChainPage = ({ formType, selectNativeToken, }) => {
const { navigateBack } = useNavigateBack();
const { setCurrentChain } = useChainSelect(formType);
const selectToken = useTokenSelect(formType, navigateBack);
const { t } = useTranslation();
useHeader(t('header.selectChain'));
const handleClick = useCallback(async (chain) => {
if (selectNativeToken) {
selectToken(chain.nativeToken.address, chain.id);
}
else {
setCurrentChain(chain.id);
navigateBack();
}
}, [navigateBack, selectNativeToken, selectToken, setCurrentChain]);
return (_jsx(SelectChainContent, { inExpansion: false, formType: formType, onSelect: handleClick }));
};
//# sourceMappingURL=SelectChainPage.js.map